tor-browser

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

Worker-creation-happens-in-parallel.https.html (783B)


      1 <!DOCTYPE html>
      2 <title>Test that creation of a "new Worker()" will occur in parallel to the main JS thread performing other computation, and can be joined with.</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script>
      6 promise_test(t => {
      7  return new Promise(resolve => {
      8    let worker = new Worker("support/Worker-creation-happens-in-parallel.js");
      9    let sab = new Uint8Array(new SharedArrayBuffer(16));
     10    window.sab = sab;
     11    worker.postMessage(sab);
     12    let end = performance.now() + 10*1000;
     13    while(sab[0] != 1 && performance.now() < end) /*wait to join with the result*/;
     14    assert_true(sab[0] == 1);
     15    resolve();
     16  });
     17 }, 'Tests that creation of a "new Worker()" will occur in parallel');
     18 </script>