style-src-inline-style-attribute-allowed.html (886B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';"> 5 <script src='/resources/testharness.js'></script> 6 <script src='/resources/testharnessreport.js'></script> 7 8 <script> 9 var t = async_test("Inline style attribute should apply with 'unsafe-inline'"); 10 document.addEventListener("securitypolicyviolation", t.unreached_func("Should not trigger a security policy violation")); 11 onload = t.step_func_done(function(e) { 12 var contentEl = document.getElementById("content"); 13 var marginLeftVal = getComputedStyle(contentEl).getPropertyValue('margin-left'); 14 assert_equals(marginLeftVal, "2px"); 15 }); 16 </script> 17 </head> 18 <body> 19 <div id='log'></div> 20 21 <div id="content" style="margin-left: 2px">Lorem ipsum</div> 22 23 </body> 24 </html>