test_csp_style_src_empty_hash.html (942B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1609122 - Empty Style Element with valid style-src hash </title> 5 <!-- Including SimpleTest.js so we can use waitForExplicitFinish !--> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 8 <meta http-equiv="Content-Security-Policy" content="style-src 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=';"> 9 </head> 10 <body> 11 <iframe style="width:100%;" id="testframe"></iframe> 12 13 <script class="testbody" type="text/javascript"> 14 15 SimpleTest.waitForExplicitFinish(); 16 17 /* Description of the test: 18 * We try to load a stylesheet that is empty with a matching hash 19 * sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' should match "" 20 * thus allow the style to be accessed 21 */ 22 23 24 var s = document.head.appendChild(document.createElement("style")); 25 s.disabled = true; 26 27 is(s.disabled, true, "Empty Stylesheet with matching Hash was not blocked"); 28 SimpleTest.finish(); 29 30 </script> 31 </body> 32 </html>