tor-browser

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

javascript-window-open-blocked.html (759B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4    <title>Window.open should not open javascript url if not allowed.</title>
      5    <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc';">
      6    <script nonce='abc' src='/resources/testharness.js'></script>
      7    <script nonce='abc' src='/resources/testharnessreport.js'></script>
      8 </head>
      9 <body>
     10  <script nonce='abc'>
     11    var t = async_test("Check that a securitypolicyviolation event is fired");
     12    window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
     13      assert_equals(e.blockedURI, "inline");
     14      assert_equals(e.violatedDirective, "script-src-elem");
     15    }));
     16 
     17    window.open('javascript:test(function() { assert_unreached("FAIL")});', 'new');
     18  </script>
     19 </body>
     20 </html>