OLD | NEW |
(Empty) | |
| 1 <?php |
| 2 header("Content-Security-Policy-Report-Only: block-all-mixed-content"); |
| 3 ?> |
| 4 <!doctype html> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <body> |
| 8 <script> |
| 9 async_test(t => { |
| 10 var i = document.createElement('img'); |
| 11 i.onerror = t.assert_unreached; |
| 12 i.onload = t.step_func_done(_ => { |
| 13 assert_equals(128, i.naturalWidth); |
| 14 assert_equals(128, i.naturalHeight); |
| 15 }); |
| 16 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=1"; |
| 17 }, "Mixed images are allowed in the presence of 'block-all-mixed-content' in
report-only mode."); |
| 18 |
| 19 async_test(t => { |
| 20 var i = document.createElement('img'); |
| 21 document.addEventListener('securitypolicyviolation', t.step_func_done(e
=> { |
| 22 var expectations = { |
| 23 'documentURI': document.location.toString(), |
| 24 'referrer': document.referrer, |
| 25 'blockedURI': 'http://127.0.0.1:8080', |
| 26 'violatedDirective': 'block-all-mixed-content', |
| 27 'effectiveDirective': 'block-all-mixed-content', |
| 28 'originalPolicy': 'block-all-mixed-content', |
| 29 'sourceFile': '', |
| 30 'lineNumber': 0, |
| 31 'columnNumber': 0, |
| 32 'statusCode': 0 |
| 33 }; |
| 34 for (key in expectations) |
| 35 assert_equals(expectations[key], e[key], key); |
| 36 })); |
| 37 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=2"; |
| 38 }, "Mixed images generate CSP violation reports in the presence of 'block-al
l-mixed-content'."); |
| 39 </script> |
OLD | NEW |