tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AJAX_setup.js (810B)


      1 var AJAXtests = [];
      2 
      3 function runAJAXTest() {
      4  if (AJAXtests.length == 0) {
      5    SimpleTest.finish();
      6    return;
      7  }
      8 
      9  var test = AJAXtests.shift();
     10  var testframe = document.getElementById("testframe");
     11  testframe.src = test;
     12 }
     13 
     14 function onManifestLoad(manifest) {
     15  if (manifest?.testcases) {
     16    AJAXtests = manifest.testcases;
     17    runAJAXTest();
     18  } else {
     19    ok(false, "manifest check: no manifest!?!");
     20    SimpleTest.finish();
     21  }
     22 }
     23 
     24 function fetchManifest() {
     25  var d = fetch("manifest.json");
     26  d.then(response=>response.json()).then(onManifestLoad).catch(onManifestLoad);
     27 }
     28 
     29 // Double timeout duration. Since this test case takes longer than 300 seconds
     30 // on B2G emulator.
     31 // See bug 968783.
     32 SimpleTest.requestLongerTimeout(2);
     33 
     34 SimpleTest.waitForExplicitFinish();
     35 addLoadEvent(fetchManifest);