tor-browser

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

file_child-src_worker.html (1010B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <head>
      4    <title>Bug 1045891</title>
      5  </head>
      6  <body>
      7  <script type="text/javascript">
      8    page_id = window.location.hash.substring(1);
      9    try {
     10      worker = new Worker('file_testserver.sjs?file='+
     11          escape("tests/dom/security/test/csp/file_child-src_worker.js")
     12          +"&type=text/javascript");
     13 
     14      worker.onerror = function(e) {
     15        window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888');
     16        e.preventDefault();
     17      }
     18 
     19      worker.onmessage = function(ev) {
     20        window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888');
     21      }
     22 
     23      worker.postMessage('foo');
     24    }
     25    catch (e) {
     26      if (e.message.match(/Failed to load script/)) {
     27        window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888');
     28      } else {
     29        window.parent.postMessage({id:page_id, message:"exception"}, 'http://mochi.test:8888');
     30      }
     31    }
     32  </script>
     33  </body>
     34 </html>