diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/windows/post-message')
28 files changed, 441 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-cross-partition.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-cross-partition.sub.html new file mode 100644 index 0000000000..f91d9403ea --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-cross-partition.sub.html @@ -0,0 +1,26 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: First-Party to First-Party, Cross-Partition</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Window. +// Step 2. (Site 2 Window) send "Site 2 Window" message to Site 1 Window. +// Step 3. (Site 1 Window) receive "Site 2 Window" message and exit. + +async_test(t => { + // Step 3 + const listener = t.step_func(e => { + if (e.data === "Site 2 Window") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2Window = window.open("http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/first-party-to-first-party-cross-partition-window.html", "", "noopener=false"); + t.add_cleanup(() => site2Window.close()); +}, "postMessage: First-Party to First-Party, Cross-Partition"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-same-partition.html b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-same-partition.html new file mode 100644 index 0000000000..6fc915298b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-first-party-same-partition.html @@ -0,0 +1,26 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: First-Party to First-Party, Same-Partition</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window A) set up listener and open Site 1 Window B. +// Step 2. (Site 1 Window B) send "Site 1 Window B" message to Site 1 Window A. +// Step 3. (Site 1 Window A) receive "Site 1 Window B" message and exit. + +async_test(t => { + // Step 3 + const listener = t.step_func(e => { + if (e.data === "Site 1 Window B") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site1WindowB = window.open("/html/browsers/windows/post-message/resources/first-party-to-first-party-same-partition-window.html", "", "noopener=false"); + t.add_cleanup(() => site1WindowB.close()); +}, "postMessage: First-Party to First-Party, Same-Partition"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-cross-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-cross-origin.sub.html new file mode 100644 index 0000000000..de776f8381 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-cross-origin.sub.html @@ -0,0 +1,27 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: First-Party to Third-Party, Cross-Partition, Cross-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Window. +// Step 2. (Site 2 Window) open Site 3 Frame. +// Step 3. (Site 3 Frame) send "Site 3 Frame" message to Site 1 Window. +// Step 4. (Site 1 Window) receive "Site 1 Frame" message and exit. + +async_test(t => { + // Step 4 + const listener = t.step_func(e => { + if (e.data === "Site 3 Frame") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2Window = window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-window.sub.https.html", "", "noopener=false"); + t.add_cleanup(() => site2Window.close()); +}, "postMessage: First-Party to Third-Party, Cross-Partition, Cross-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-same-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-same-origin.sub.html new file mode 100644 index 0000000000..490b647fa4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/first-party-to-third-party-cross-partition-same-origin.sub.html @@ -0,0 +1,27 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Window. +// Step 2. (Site 2 Window) open Site 1 Frame. +// Step 3. (Site 1 Frame) send "Site 1 Frame" message to Site 1 Window. +// Step 4. (Site 1 Window) receive "Site 1 Frame" message and exit. + +async_test(t => { + // Step 4 + const listener = t.step_func(e => { + if (e.data === "Site 1 Frame") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2Window = window.open("http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-window.sub.html", "", "noopener=false"); + t.add_cleanup(() => site2Window.close()); +}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-cross-partition-window.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-cross-partition-window.html new file mode 100644 index 0000000000..cdfa9d95ca --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-cross-partition-window.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 2 (html/browsers/windows/post-message/first-party-to-first-party-cross-partition.sub.html) +window.opener.postMessage("Site 2 Window", "*"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-same-partition-window.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-same-partition-window.html new file mode 100644 index 0000000000..4baf45d3c8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-first-party-same-partition-window.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 2 (html/browsers/windows/post-message/first-party-to-first-party-same-partition.html) +window.opener.postMessage("Site 1 Window B", window.opener.origin); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-iframe.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-iframe.https.html new file mode 100644 index 0000000000..eef594831a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-iframe.https.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 3 (html/browsers/windows/post-message/first-party-to-third-party-cross-partition-cross-origin.sub.html) +window.top.opener.postMessage("Site 3 Frame", "*"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-window.sub.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-window.sub.https.html new file mode 100644 index 0000000000..7edfbd9328 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-window.sub.https.html @@ -0,0 +1,6 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<!--Step 2 (html/browsers/windows/post-message/first-party-to-third-party-cross-partition-cross-origin.sub.html)--> +<iframe src="https://{{host}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-cross-origin-iframe.https.html"></iframe> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-iframe.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-iframe.html new file mode 100644 index 0000000000..eb17036c8c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-iframe.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 3 (html/browsers/windows/post-message/first-party-to-third-party-cross-partition-same-origin.sub.html) +window.top.opener.postMessage("Site 1 Frame", window.top.opener.origin); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-window.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-window.sub.html new file mode 100644 index 0000000000..f99b96c466 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-window.sub.html @@ -0,0 +1,6 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<!--Step 2 (html/browsers/windows/post-message/first-party-to-third-party-cross-partition-same-origin.sub.html)--> +<iframe src="http://{{host}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/first-party-to-third-party-cross-partition-same-origin-iframe.html"></iframe> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-iframe.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-iframe.sub.html new file mode 100644 index 0000000000..348efb3f9c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-iframe.sub.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 4 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html) +let site2Window; +const listener = e => { + if (e.data === "Site 3 Window") { + site2Window.close(); + window.top.postMessage("Site 2 Frame", "*"); + } +}; +// Step 2 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html) +window.addEventListener("message", listener); +site2Window = window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-window.https.html", "", "noopener=false"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-window.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-window.https.html new file mode 100644 index 0000000000..0045909494 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-window.https.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 3 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html) +window.opener.postMessage("Site 3 Window", "*"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-iframe.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-iframe.sub.html new file mode 100644 index 0000000000..405b1053d3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-iframe.sub.html @@ -0,0 +1,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> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-window.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-window.html new file mode 100644 index 0000000000..0ae51e3fc1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-window.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 3 (html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html) +window.opener.postMessage("Site 2 Window", window.opener.origin); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-a.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-a.sub.html new file mode 100644 index 0000000000..a11f3640e8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-a.sub.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 5 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html) +let site3Window; +const listener = e => { + if (e.data === "Site 4 Frame") { + site3Window.close(); + window.top.postMessage("Site 2 Frame", "*"); + } +}; +// Step 2 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html) +window.addEventListener("message", listener); +site3Window = window.open("https://{{host}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-window.sub.https.html", "", "noopener=false"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-b.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-b.https.html new file mode 100644 index 0000000000..f56e2b35d8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-b.https.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 4 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html) +window.top.opener.postMessage("Site 4 Frame", "*"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-window.sub.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-window.sub.https.html new file mode 100644 index 0000000000..1307287587 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-window.sub.https.html @@ -0,0 +1,6 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<!--Step 3 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html)--> +<iframe src="https://{{hosts[alt][]}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-b.https.html"></iframe> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-a.sub.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-a.sub.https.html new file mode 100644 index 0000000000..ec551bfdec --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-a.sub.https.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 5 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html) +let site3Window; +const listener = e => { + if (e.data === "Site 2 Frame B") { + site3Window.close(); + window.top.postMessage("Site 2 Frame A", "*"); + } +}; +// Step 2 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html) +window.addEventListener("message", listener); +site3Window = window.open("https://{{host}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-window.sub.https.html", "", "noopener=false"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-b.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-b.https.html new file mode 100644 index 0000000000..fc15b1f125 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-b.https.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 4 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html) +window.top.opener.postMessage("Site 2 Frame B", window.top.opener.origin); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-window.sub.https.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-window.sub.https.html new file mode 100644 index 0000000000..f26f709db3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-window.sub.https.html @@ -0,0 +1,6 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<!--Step 3 (html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html)--> +<iframe src="https://{{hosts[alt][]}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-b.https.html"></iframe> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-a.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-a.sub.html new file mode 100644 index 0000000000..339dc9f06e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-a.sub.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 5 (html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html) +let site2WindowB; +const listener = e => { + if (e.data === "Site 2 Frame B") { + site2WindowB.close(); + window.top.postMessage("Site 2 Frame A", "*"); + } +}; +// Step 2 (html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html) +window.addEventListener("message", listener); +site2WindowB = window.open("http://{{host}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-window.sub.html", "", "noopener=false"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-b.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-b.html new file mode 100644 index 0000000000..daaf236bfc --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-b.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<script> +// Step 4 (html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html) +window.top.opener.postMessage("Site 2 Frame B", window.top.opener.origin); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-window.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-window.sub.html new file mode 100644 index 0000000000..7cea58f235 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-window.sub.html @@ -0,0 +1,6 @@ +<!doctype html> +<meta charset=utf-8> +<body> +<!--Step 3 (html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html)--> +<iframe src="http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-b.html"></iframe> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html new file mode 100644 index 0000000000..2618e966de --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-cross-origin.sub.html @@ -0,0 +1,29 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: Third-Party to First-Party, Cross-Partition, Cross-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Frame. +// Step 2. (Site 2 Frame) set up listener and open Site 3 Window. +// Step 3. (Site 3 Window) send "Site 3 Window" message to Site 2 Frame. +// Step 4. (Site 2 Frame) receive "Site 3 Window" message and send "Site 2 Frame" message to Site 1 Window. +// Step 5. (Site 1 Window) receive "Site 2 Frame" message and exit. + +async_test(t => { + // Step 5 + const listener = t.step_func(e => { + if (e.data === "Site 2 Frame") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2Frame = document.createElement("iframe"); + site2Frame.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-cross-origin-iframe.sub.html"; + document.body.appendChild(site2Frame); +}, "postMessage: Third-Party to First-Party, Cross-Partition, Cross-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html new file mode 100644 index 0000000000..735b458841 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-first-party-cross-partition-same-origin.sub.html @@ -0,0 +1,29 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: Third-Party to First-Party, Cross-Partition, Same-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Frame. +// Step 2. (Site 2 Frame) set up listener and open Site 2 Window. +// Step 3. (Site 2 Window) send "Site 2 Window" message to Site 2 Frame. +// Step 4. (Site 2 Frame) receive "Site 2 Window" message and send "Site 2 Frame" message to Site 1 Window. +// Step 5. (Site 1 Window) receive "Site 2 Frame" message and exit. + +async_test(t => { + // Step 5 + const listener = t.step_func(e => { + if (e.data === "Site 2 Frame") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2Frame = document.createElement("iframe"); + site2Frame.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-first-party-cross-partition-same-origin-iframe.sub.html"; + document.body.appendChild(site2Frame); +}, "postMessage: Third-Party to First-Party, Cross-Partition, Same-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html new file mode 100644 index 0000000000..1083071f7d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-cross-origin.sub.html @@ -0,0 +1,30 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: Third-Party to Third-Party, Cross-Partition, Cross-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Frame. +// Step 2. (Site 2 Frame) set up listener and open Site 3 Window. +// Step 3. (Site 3 Window) open Site 4 Frame. +// Step 4. (Site 4 Frame) send "Site 4 Frame" message to Site 2 Frame. +// Step 5. (Site 2 Frame) receive "Site 4 Frame" message and send "Site 2 Frame" message to Site 1 Window. +// Step 6. (Site 1 Window) receive "Site 2 Frame" message and exit. + +async_test(t => { + // Step 6 + const listener = t.step_func(e => { + if (e.data === "Site 2 Frame") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2FrameA = document.createElement("iframe"); + site2FrameA.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-cross-origin-iframe-a.sub.html"; + document.body.appendChild(site2FrameA); +}, "postMessage: Third-Party to Third-Party, Cross-Partition, Cross-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html new file mode 100644 index 0000000000..9caf6c11e4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-cross-partition-same-origin.sub.html @@ -0,0 +1,30 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: Third-Party to Third-Party, Cross-Partition, Same-Origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window) set up listener and open Site 2 Frame A. +// Step 2. (Site 2 Frame A) set up listener and open Site 3 Window. +// Step 3. (Site 3 Window) open Site 2 Frame B. +// Step 4. (Site 2 Frame B) send "Site 2 Frame B" message to Site 2 Frame A. +// Step 5. (Site 2 Frame A) receive "Site 2 Frame B" message and send "Site 2 Frame A" message to Site 1 Window. +// Step 6. (Site 1 Window) receive "Site 2 Frame A" message and exit. + +async_test(t => { + // Step 6 + const listener = t.step_func(e => { + if (e.data === "Site 2 Frame A") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2FrameA = document.createElement("iframe"); + site2FrameA.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-cross-partition-same-origin-iframe-a.sub.https.html"; + document.body.appendChild(site2FrameA); +}, "postMessage: Third-Party to Third-Party, Cross-Partition, Same-Origin"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html new file mode 100644 index 0000000000..c90a055268 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/post-message/third-party-to-third-party-same-partition.sub.html @@ -0,0 +1,30 @@ +<!doctype html> +<meta charset=utf-8> +<title>postMessage: Third-Party to Third-Party, Same-Partition</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Here's the set-up for this test: +// Step 1. (Site 1 Window A) set up listener and open Site 2 Frame A. +// Step 2. (Site 2 Frame A) set up listener and open Site 1 Window B. +// Step 3. (Site 1 Window B) open Site 2 Frame B. +// Step 4. (Site 2 Frame B) send "Site 2 Frame B" message to Site 2 Frame A. +// Step 5. (Site 2 Frame A) receive "Site 2 Frame B" message and send "Site 2 Frame A" message to Site 1 Window A. +// Step 6. (Site 1 Window A) receive "Site 2 Frame A" message and exit. + +async_test(t => { + // Step 6 + const listener = t.step_func(e => { + if (e.data === "Site 2 Frame A") { + t.done(); + } + }); + // Step 1 + window.addEventListener("message", listener); + const site2FrameA = document.createElement("iframe"); + site2FrameA.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-third-party-same-partition-iframe-a.sub.html"; + document.body.appendChild(site2FrameA); +}, "postMessage: Third-Party to Third-Party, Same-Partition"); +</script> +</body> |