| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <head> | |
| 3 <title>Upgrade Insecure Requests: IFrames.</title> | |
| 4 <script src="/resources/testharness.js"></script> | |
| 5 <script src="/resources/testharnessreport.js"></script> | |
| 6 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> | |
| 7 <meta http-equiv="Content-Security-Policy" content="frame-src https:"> | |
| 8 </head> | |
| 9 <body> | |
| 10 <script> | |
| 11 async_test(t => { | |
| 12 var i = document.createElement('iframe'); | |
| 13 | |
| 14 // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we | |
| 15 // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't | |
| 16 // work, it won't load. | |
| 17 i.src = "http://127.0.0.1:8443/security/resources/post-origin-to-parent.html
"; | |
| 18 | |
| 19 window.addEventListener('message', t.step_func(e => { | |
| 20 if (e.source == i.contentWindow) { | |
| 21 assert_equals("https://127.0.0.1:8443", e.data.origin); | |
| 22 t.done(); | |
| 23 } | |
| 24 })); | |
| 25 document.body.appendChild(i); | |
| 26 }, "Same-host frames are upgraded, and do not violate CSP."); | |
| 27 | |
| 28 async_test(t => { | |
| 29 var i = document.createElement('iframe'); | |
| 30 | |
| 31 // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we | |
| 32 // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't | |
| 33 // work, it won't load. | |
| 34 i.src = "http://example.test:8443/security/resources/post-origin-to-parent.h
tml"; | |
| 35 | |
| 36 window.addEventListener('message', t.step_func(e => { | |
| 37 if (e.source == i.contentWindow) { | |
| 38 assert_equals("https://example.test:8443", e.data.origin); | |
| 39 t.done(); | |
| 40 } | |
| 41 })); | |
| 42 document.body.appendChild(i); | |
| 43 }, "Cross-host frames are upgraded, and do not violate CSP."); | |
| 44 | |
| 45 </script> | |
| 46 </body> | |
| OLD | NEW |