tor-browser

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

worker.html (1008B)


      1 <script src=/resources/testharness.js></script>
      2 <script src=/resources/testharnessreport.js></script>
      3 <div id=log></div>
      4 <script>
      5  var workers = [],
      6      fails = ["", "?type=", "?type=x", "?type=x/x", "?type=text/html", "?type=text/json"],
      7      passes = ["?type=text/javascript", "?type=text/ecmascript", "?type=text/ecmascript;yay"]
      8 
      9  fails.forEach(function(urlpart) {
     10    async_test(function(t) {
     11      var w = new Worker("resources/worker.py" + urlpart)
     12      w.onmessage = t.unreached_func("Unexpected message event")
     13      w.onerror = t.step_func_done(function(){})
     14      workers.push(w) // avoid GC
     15    }, "URL query: " + urlpart)
     16  })
     17 
     18  passes.forEach(function(urlpart) {
     19    async_test(function(t) {
     20      var w = new Worker("resources/worker.py" + urlpart)
     21      w.onmessage = t.step_func_done(function(e){
     22        assert_equals(e.data, "hi")
     23      })
     24      w.onerror = t.unreached_func("Unexpected error event")
     25      workers.push(w) // avoid GC
     26    }, "URL query: " + urlpart)
     27  })
     28 </script>