summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html')
-rw-r--r--testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html
new file mode 100644
index 0000000000..909956a54f
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/sandboxing/resources/sandbox-javascript-window-open.html
@@ -0,0 +1,18 @@
+<script>
+ // Forward message from the openee toward the parent.
+ window.addEventListener("message", event => top.postMessage(event.data, "*"));
+
+ let check_sandboxed = `"
+ <script>
+ try {
+ document.domain = document.domain;
+ opener.postMessage('allow-document-domain', '*');
+ } catch (error) {
+ opener.postMessage('disallow-document-domain', '*');
+ }
+ </scr`+`ipt>
+ "`;
+
+ window.open('about:blank', "window_name");
+ window.open("javascript:" + check_sandboxed, "window_name");
+</script>