dom/workers/test/test_xhr_timeout.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial