tor-browser

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

Worker_terminate_event_queue.htm (721B)


      1 <!DOCTYPE html>
      2 <title> AbstractWorker terminate(): clear event queue </title>
      3 <meta name="timeout" content="long">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <div id=log></div>
      7 <script>
      8 async_test(function() {
      9  var testResult;
     10  var worker = new Worker('./support/WorkerTerminate.js');
     11  worker.onmessage = this.step_func(function(e) {
     12    testResult = e.data;
     13    if (testResult >= 10000) {
     14      worker.terminate();
     15      worker.onmessage = this.unreached_func('Unexpected message event');
     16      setTimeout(this.step_func_done(function() {
     17        assert_equals(testResult, 10000);
     18      }), 100);
     19    }
     20  });
     21  worker.postMessage("ping");
     22 });
     23 </script>