tor-browser

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

test_XHR_timeout.html (1611B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=525816
      5 -->
      6 <head>
      7  <title>Test for Bug 525816</title>
      8  <script type="application/javascript"
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet"
     11        type="text/css"
     12        href="/tests/SimpleTest/test.css">
     13 </head>
     14 <body>
     15 
     16 <a target="_blank"
     17   href="https://bugzilla.mozilla.org/show_bug.cgi?id=525816"
     18  >Mozilla Bug 525816 (XMLHttpRequest timeout)</a>
     19 <p id="display"></p>
     20 <div id="content">
     21  This test takes over 1 minute to run, probably over 2 minutes.
     22 </div>
     23 <pre id="test">
     24 <script class="testbody"
     25        type="text/javascript"
     26        src="test_XHR_timeout.js"></script>
     27 <script type="text/javascript">
     28  window.addEventListener("message", function (event) {
     29  if (event.data == "done") {
     30    SimpleTest.finish();
     31    return;
     32  }
     33  if (event.data == "start") {
     34    return;
     35  }
     36  if (event.data.type == "is") {
     37    SimpleTest.is(event.data.got, event.data.expected, event.data.msg);
     38    return;
     39  }
     40  if (event.data.type == "ok") {
     41    SimpleTest.ok(event.data.bool, event.data.msg);
     42 
     43  }
     44 });
     45  // Final test harness setup and launch.
     46  (function() {
     47    SimpleTest.waitForExplicitFinish();
     48    SimpleTest.requestLongerTimeout(TestRequests.length);
     49    SimpleTest.requestFlakyTimeout("This is testing XHR timeouts.");
     50    var msg = "This test will take approximately " + (TestRequests.length * 10)
     51    msg += " seconds to complete, at most.";
     52    document.getElementById("content").firstChild.nodeValue = msg;
     53    window.postMessage("start", "*");
     54  })();
     55 </script>
     56 </pre>
     57 </body>
     58 </html>