tor-browser

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

importScripts_mixedcontent.html (1097B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE html>
      6 <script>
      7  function ok(cond, msg) {
      8    window.parent.postMessage({status: "ok", data: cond, msg}, "*");
      9  }
     10  function finish() {
     11    window.parent.postMessage({status: "done"}, "*");
     12  }
     13 
     14  function testSharedWorker() {
     15    var sw = new SharedWorker("importForeignScripts_worker.js");
     16    sw.port.onmessage = function(e) {
     17      if (e.data == "finish") {
     18        finish();
     19        return;
     20      }
     21      ok(e.data === "good", "mixed content for shared workers is correctly blocked");
     22    };
     23 
     24    sw.onerror = function() {
     25      ok(false, "Error on shared worker ");
     26    };
     27 
     28    sw.port.postMessage("start");
     29  }
     30 
     31  var worker = new Worker("importForeignScripts_worker.js");
     32 
     33  worker.onmessage = function(e) {
     34    if (e.data == "finish") {
     35      testSharedWorker();
     36      return;
     37    }
     38    ok(e.data === "good", "mixed content is correctly blocked");
     39  }
     40 
     41  worker.onerror = function() {
     42    ok(false, "Error on worker");
     43  }
     44 
     45  worker.postMessage("start");
     46 </script>