tor-browser

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

style-src-elem-blocked-src-allowed.html (828B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5    <meta http-equiv="Content-Security-Policy" content="style-src-elem 'none';
      6    style-src 'unsafe-inline';">
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script>
     10      var t = async_test("Should fire a security policy violation event");
     11      window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
     12        assert_equals(e.violatedDirective, 'style-src-elem');
     13        assert_equals(e.blockedURI, 'inline');
     14      }));
     15    </script>
     16 </head>
     17 
     18 <body>
     19  <style>
     20    body {background: green;}
     21  </style>
     22  <script>
     23    async_test(function(test) {
     24      assert_equals(document.styleSheets.length, 0);
     25      test.done();
     26    }, "The inline style should not be applied");
     27  </script>
     28 </body>
     29 
     30 </html>