tor-browser

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

style-src-inline-style-with-csstext.html (885B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4    <meta http-equiv="Content-Security-Policy" content="style-src 'self';">
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7 
      8    <script>
      9      var t = async_test("Manipulating cssText should be allowed with 'self'");
     10      document.addEventListener("securitypolicyviolation", t.unreached_func("Should not trigger a security policy violation"));
     11    </script>
     12 </head>
     13 <body>
     14    <div id='log'></div>
     15 
     16    <div id="content">Lorem ipsum</div>
     17 
     18    <script>
     19      t.step(function() {
     20        var contentEl = document.getElementById("content");
     21        contentEl.style.cssText = 'margin-left: 2px;';
     22        var marginLeftVal = getComputedStyle(contentEl).getPropertyValue('margin-left');
     23        assert_equals(marginLeftVal, "2px");
     24        t.done();
     25      });
     26    </script>
     27 
     28 </body>
     29 </html>