summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-iframe.sub.html
blob: 405b1053d33da9e4f21504308b51fc5c69ee34a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!doctype html>
<meta charset=utf-8>
<body>
<script>
// Step 4 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html)
let site2Window;
const listener = e => {
  if (e.data === "Site 2 Window") {
    site2Window.close();
    window.top.postMessage("Site 2 Frame", "*");
  }
};
// Step 2 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html)
window.addEventListener("message", listener);
site2Window = window.open("http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-window.html", "", "noopener=false");
</script>
</body>