style-blocked.html (800B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Security-Policy" content="style-src 'none'"> 5 <title>style-blocked</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script> 9 async_test(t => { 10 window.addEventListener('securitypolicyviolation', 11 t.step_func_done(e => { 12 assert_equals(e.violatedDirective, "style-src-elem"); 13 })); 14 }, "Violated directive is script-src-elem."); 15 </script> 16 <link rel="stylesheet" href="resources/blue.css"> 17 </head> 18 <body> 19 <script> 20 test(t => { 21 assert_equals(document.styleSheets.length, 1); 22 }, "document.styleSheets should contain an item for the blocked CSS."); 23 </script> 24 </body> 25 </html>