tor-browser

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

shared-worker-connect-src-allowed.sub.html (1346B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5    <!-- Programmatically converted from a WebKit Reftest, please forgive resulting idiosyncracies.-->
      6    <meta http-equiv="Content-Security-Policy" content="connect-src 'self' http://{{domains[www1]}}:{{ports[http][0]}}; script-src 'self' 'unsafe-inline';">
      7    <title>shared-worker-connect-src-allowed</title>
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testharnessreport.js"></script>
     10    <script src='../support/logTest.sub.js?logs=["xhr allowed","TEST COMPLETE"]'></script>
     11    <script src='../support/alertAssert.sub.js?alerts=[]'></script>
     12 </head>
     13 
     14 <body>
     15  <script>
     16    window.addEventListener('securitypolicyviolation', function(e) {
     17        log("violated-directive=" + e.violatedDirective);
     18    });
     19 
     20    if(typeof SharedWorker != 'function') {
     21        t_log.set_status(t_alert.NOTRUN, "No SharedWorker, cannot run test.");
     22        t_log.phase = t_alert.phases.HAS_RESULT;
     23      	t_log.done();
     24    } else {
     25        try {
     26            var worker = new SharedWorker('/content-security-policy/connect-src/support/shared-worker-make-xhr-allowed.sub.js');
     27            worker.port.onmessage = function(event) {
     28                log(event.data);
     29            };
     30        } catch (e) {
     31            log(e);
     32        }
     33    }
     34 
     35    </script>
     36    <div id="log"></div>
     37 </body>
     38 
     39 </html>