dom/workers/test/test_xhr_timeout.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/workers/test/test_xhr_timeout.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=498998
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 498998</title>
    1.11 +  <script type="application/javascript"
    1.12 +          src="/MochiKit/MochiKit.js"></script>
    1.13 +  <script type="application/javascript"
    1.14 +          src="/tests/SimpleTest/SimpleTest.js"></script>
    1.15 +  <link rel="stylesheet"
    1.16 +        type="text/css"
    1.17 +        href="/tests/SimpleTest/test.css">
    1.18 +</head>
    1.19 +<body>
    1.20 +
    1.21 +<a target="_blank"
    1.22 +   href="https://bugzilla.mozilla.org/show_bug.cgi?id=498998"
    1.23 +  >Mozilla Bug 498998 (Worker XMLHttpRequest timeout)</a>
    1.24 +<p id="display"></p>
    1.25 +<div id="content">
    1.26 +  This test takes over 1 minute to run, probably over 2 minutes.
    1.27 +</div>
    1.28 +<pre id="test">
    1.29 +<script type="text/javascript">
    1.30 +  var worker = new Worker("../../../content/base/test/test_XHR_timeout.js");
    1.31 +
    1.32 +  worker.addEventListener("message", function (event) {
    1.33 +    if (event.data == "done") {
    1.34 +      SimpleTest.finish();
    1.35 +      return;
    1.36 +    }
    1.37 +    if (event.data == "start") {
    1.38 +      return;
    1.39 +    }
    1.40 +    if (event.data.type == "is") {
    1.41 +      SimpleTest.is(event.data.got, event.data.expected, event.data.msg);
    1.42 +      return;
    1.43 +    }
    1.44 +    if (event.data.type == "ok") {
    1.45 +      SimpleTest.ok(event.data.bool, event.data.msg);
    1.46 +      return;
    1.47 +    }
    1.48 +  });
    1.49 +  // Final test harness setup and launch.
    1.50 +  (function() {
    1.51 +    SimpleTest.waitForExplicitFinish();
    1.52 +    SimpleTest.requestLongerTimeout(20);
    1.53 +    var msg = "This test will take approximately " + (20 * 10)
    1.54 +    msg += " seconds to complete, at most.";
    1.55 +    document.getElementById("content").firstChild.nodeValue = msg;
    1.56 +    worker.postMessage("start");
    1.57 +  })();
    1.58 +</script>
    1.59 +</pre>
    1.60 +</body>
    1.61 +</html>

mercurial