tor-browser

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

test_importScripts_2.html (884B)


      1 <head>
      2  <title>Test for Worker importScripts</title>
      3  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      5 </head>
      6 <body>
      7 <script id="worker" type="javascript/worker">
      8 onmessage = async function(msg) {
      9  try {
     10    self.importScripts("N:", "");
     11  } catch (ex) {
     12    postMessage("done");
     13  }
     14 };
     15 
     16 </script>
     17 <script>
     18 SimpleTest.waitForExplicitFinish();
     19 document.addEventListener("DOMContentLoaded", async () => {
     20    const blob = new Blob([document.querySelector('#worker').textContent],
     21                          {type: "text/javascript"});
     22    const worker = new Worker(window.URL.createObjectURL(blob));
     23    worker.postMessage([], []);
     24    worker.onmessage = function(e) {
     25      if (e.data == "done") {
     26        ok(true);
     27        SimpleTest.finish();
     28      }
     29    };
     30 });
     31 </script>
     32 </pre>
     33 </body>
     34 </html>