tor-browser

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

connect-src-beacon-blocked.sub.html (1434B)


      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'; script-src 'self' 'unsafe-inline';">
      7    <title>connect-src-beacon-blocked</title>
      8    <script src="/resources/testharness.js"></script>
      9    <script src="/resources/testharnessreport.js"></script>
     10    <script src='../support/logTest.sub.js?logs=["Pass", "violated-directive=connect-src"]'></script>
     11    <script src="../support/alertAssert.sub.js?alerts=[]"></script>
     12    <!-- enforcing policy:
     13 connect-src 'self' http://{{host}}:{{ports[http][0]}}; script-src 'self' 'unsafe-inline';
     14 -->
     15 </head>
     16 
     17 <body>
     18    <script>
     19        window.addEventListener('securitypolicyviolation', function(e) {
     20            log("violated-directive=" + e.violatedDirective);
     21        });
     22 
     23        if (typeof navigator.sendBeacon != 'function') {
     24            t_log.set_status(t_log.NOTRUN, "No navigator.sendBeacon, cannot run test.");
     25            t_log.phase = t_log.phases.HAS_RESULT;
     26            t_log.done();
     27        } else {
     28            try {
     29                var es = navigator.sendBeacon("http://www1.{{host}}:{{ports[http][0]}}/security/contentSecurityPolicy/echo-report.php");
     30                log("Pass");
     31            } catch (e) {
     32                log("Fail");
     33            }
     34        }
     35    </script>
     36    <div id="log"></div>
     37 </body>
     38 
     39 </html>