tor-browser

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

test_messageChannel_worker_forceClose.html (710B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for forcing the closing of the port in workers</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body>
     10 <div id="content"></div>
     11 <pre id="test">
     12 </pre>
     13  <script type="application/javascript">
     14 
     15  var worker = new Worker('data:javascript,onmessage = function(e) { "doing nothing with this port"; }');
     16 
     17  var mc = new MessageChannel();
     18  worker.postMessage(42, [mc.port2]);
     19 
     20  for (var i = 0; i < 10; ++i) {
     21    mc.port1.postMessage(i);
     22  }
     23 
     24  ok(true, "All the messages are sent! We should shutdown correctly.");
     25  </script>
     26 </body>
     27 </html>