OLD | NEW |
1 <meta http-equiv="Content-Security-Policy" content="frame-src 'none'"> | 1 <!doctype html> |
2 <script src="resources/dump-as-text.js"></script> | 2 <script src="/resources/testharness.js"></script> |
3 <iframe src="resources/alert-fail.html"></iframe> | 3 <script src="/resources/testharnessreport.js"></script> |
| 4 <meta http-equiv="Content-Security-Policy" content="frame-src 'self'"> |
| 5 <script> |
| 6 async_test(t => { |
| 7 var watcher = new EventWatcher(t, document, ['securitypolicyviolation'])
; |
| 8 watcher |
| 9 .wait_for('securitypolicyviolation') |
| 10 .then(t.step_func(e => { |
| 11 assert_equals(e.blockedURI, "http://localhost:8000", "The report
ed URL should be stripped."); |
| 12 assert_equals(e.lineNumber, 21, "IFrame injected from script on
this page."); |
| 13 t.done(); |
| 14 })); |
| 15 |
| 16 window.onmessage = t.unreached_func('No message should be sent from the
frame.'); |
| 17 window.onload = _ => { |
| 18 var url = "http://localhost:8000/security/resources/post-done.html"; |
| 19 var i = document.createElement('iframe'); |
| 20 i.src = url; |
| 21 document.body.appendChild(i); |
| 22 }; |
| 23 }, "The unredirected frame is blocked."); |
| 24 </script> |
OLD | NEW |