| <!-- webkit-test-runner [ SiteIsolationEnabled=true ] --> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script> |
| |
| description("Verifies window.open can successfully open a window with the same origin as an iframe of this window"); |
| jsTestIsAsync = true; |
| |
| function runTest() { |
| openedWindow = window.open("http://localhost:8000/site-isolation/resources/post-message-to-opener.html"); |
| } |
| |
| function runTestIfInTestRunner() { if (window.testRunner) { runTest() } } |
| |
| addEventListener("message", (event) => { |
| if (event.data == 'initial ping') { |
| openedWindow.postMessage('initial reply', '*'); |
| return; |
| } |
| if (event.data.startsWith("opened window received: ")) { |
| testPassed("received message from opened window: " + event.data); |
| finishJSTest(); |
| } |
| }); |
| |
| </script> |
| <body onload="runTestIfInTestRunner()"> |
| <button onclick="runTest()">click to run test manually in a browser</button> |
| <iframe src='http://localhost:8000/site-isolation/resources/green-background.html'></iframe> |
| </body> |