OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 |
| 4 <head> |
| 5 <!-- Programmatically converted from a WebKit Reftest, please forgive result
ing idiosyncracies.--> |
| 6 <title>scriptnonce-redirect</title> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script nonce="noncynonce"> |
| 10 function log(msg) { |
| 11 test(function() { |
| 12 assert_unreached(msg) |
| 13 }); |
| 14 } |
| 15 |
| 16 </script> |
| 17 <script nonce="noncynonce"> |
| 18 var t_alert = async_test('Expecting alerts: ["PASS"]'); |
| 19 var expected_alerts = ["PASS"]; |
| 20 |
| 21 function alert_assert(msg) { |
| 22 t_alert.step(function() { |
| 23 if (msg.match(/^FAIL/i)) { |
| 24 assert_unreached(msg); |
| 25 t_alert.done(); |
| 26 } |
| 27 for (var i = 0; i < expected_alerts.length; i++) { |
| 28 if (expected_alerts[i] == msg) { |
| 29 assert_true(expected_alerts[i] == msg); |
| 30 expected_alerts.splice(i, 1); |
| 31 if (expected_alerts.length == 0) { |
| 32 t_alert.done(); |
| 33 } |
| 34 return; |
| 35 } |
| 36 } |
| 37 assert_unreached('unexpected alert: ' + msg); |
| 38 t_log.done(); |
| 39 }); |
| 40 } |
| 41 |
| 42 </script> |
| 43 <!-- enforcing policy: |
| 44 script-src 'self' 'unsafe-inline' 'nonce-noncynonce'; connect-src 'self'; |
| 45 --> |
| 46 </head> |
| 47 |
| 48 <body> |
| 49 This tests whether a deferred script load caused by a redirect is properly a
llowed by a nonce. |
| 50 <script nonce="noncynonce" src="/common/redirect.py?location=http://{{host}}
:{{ports[http][0]}}/content-security-policy/support/alert-pass.js"></script> |
| 51 <script nonce="noncynonce"> |
| 52 |
| 53 |
| 54 </script> |
| 55 <div id="log"></div> |
| 56 <script async defer src="../support/checkReport.sub.js?reportExists=false"><
/script> |
| 57 </body> |
| 58 |
| 59 </html> |
OLD | NEW |