tor-browser

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

test_promise.html (1032B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE HTML>
      6 <html>
      7 <head>
      8  <title>Test for Promise object in workers</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <p id="display"></p>
     14 <div id="content" style="display: none"></div>
     15 <pre id="test"></pre>
     16 <script class="testbody" type="text/javascript">
     17 
     18  function runTest() {
     19    var worker = new Worker("promise_worker.js");
     20 
     21    worker.onmessage = function(event) {
     22 
     23      if (event.data.type == 'finish') {
     24        SimpleTest.finish();
     25      } else if (event.data.type == 'status') {
     26        ok(event.data.status, event.data.msg);
     27      }
     28    }
     29 
     30    worker.onerror = function(event) {
     31      ok(false, "Worker had an error: " + event.message);
     32      SimpleTest.finish();
     33    };
     34 
     35    worker.postMessage(true);
     36  }
     37 
     38  SimpleTest.waitForExplicitFinish();
     39  runTest();
     40 </script>
     41 </pre>
     42 </body>
     43 </html>