OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <title>href of link with rel=stylesheet must be in src list</title> |
| 5 <script src='/resources/testharness.js'></script> |
| 6 <script src='/resources/testharnessreport.js'></script> |
| 7 <script> |
| 8 var head = document.getElementsByTagName('head')[0]; |
| 9 var link = document.createElement('link'); |
| 10 link.setAttribute('rel', 'stylesheet'); |
| 11 link.setAttribute('type', 'text/css'); |
| 12 link.setAttribute('href', location.protocol + |
| 13 '//www1.' + |
| 14 location.hostname + |
| 15 ':' + |
| 16 location.port + |
| 17 '/content-security-policy/style-src/3_3.css'); |
| 18 head.appendChild(link); |
| 19 |
| 20 onload = function doTest() { |
| 21 test(function() { |
| 22 var text = document.getElementById("content"); |
| 23 assert_true(getComputedStyle(text).marginLeft != "2px", "Style sheet
loaded from origin not in style-src directive should be blocked"); |
| 24 }); |
| 25 } |
| 26 </script> |
| 27 </head> |
| 28 <body> |
| 29 <h1>href of link with rel=stylesheet must be in src list</h1> |
| 30 <div id='log'></div> |
| 31 |
| 32 <div id="content">This text should not have a margin-left of 2</div> |
| 33 |
| 34 <script async defer src='../support/checkReport.sub.js?reportField=violated-
directive&reportValue=style-src%20%27self%27'></script> |
| 35 |
| 36 </body> |
| 37 </html> |
OLD | NEW |