OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 |
| 4 <head> |
| 5 <title>frame-src-allowed</title> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src='../support/logTest.sub.js?logs=["PASS IFrame %231 generated a l
oad event."]'></script> |
| 9 <script> |
| 10 window.addEventListener("message", function(event) { |
| 11 alert_assert(event.data); |
| 12 }, false); |
| 13 |
| 14 var t_alert = async_test('Expecting alerts: ["PASS"]'); |
| 15 var expected_alerts = ["PASS"]; |
| 16 |
| 17 function alert_assert(msg) { |
| 18 t_alert.step(function() { |
| 19 if (msg.match(/^FAIL/i)) { |
| 20 assert_unreached(msg); |
| 21 t_alert.done(); |
| 22 } |
| 23 for (var i = 0; i < expected_alerts.length; i++) { |
| 24 if (expected_alerts[i] == msg) { |
| 25 assert_true(expected_alerts[i] == msg); |
| 26 expected_alerts.splice(i, 1); |
| 27 if (expected_alerts.length == 0) { |
| 28 t_alert.done(); |
| 29 } |
| 30 return; |
| 31 } |
| 32 } |
| 33 assert_unreached('unexpected alert: ' + msg); |
| 34 t_log.done(); |
| 35 }); |
| 36 } |
| 37 |
| 38 </script> |
| 39 <!-- enforcing policy: |
| 40 Content-Security-Policy: frame-src 'self'; script-src 'self' 'unsafe-inline'; co
nnect-src 'self'; |
| 41 --> |
| 42 <p> |
| 43 This iframe should be allowed. |
| 44 </p> |
| 45 <script> |
| 46 window.wasPostTestScriptParsed = true; |
| 47 var loads = 0; |
| 48 |
| 49 function loadEvent() { |
| 50 loads++; |
| 51 log("PASS " + "IFrame #" + loads + " generated a load event."); |
| 52 } |
| 53 |
| 54 </script> |
| 55 </head> |
| 56 |
| 57 <body> |
| 58 <iframe src="/content-security-policy/blink-contrib/resources/postmessage-pa
ss.html" onload="loadEvent()"></iframe> |
| 59 <div id="log"></div> |
| 60 <script async defer src="../support/checkReport.sub.js?reportExists=false"><
/script> |
| 61 </body> |
| 62 |
| 63 </html> |
OLD | NEW |