summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/support
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/the-window-object/support')
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html17
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/closed.html12
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html15
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html13
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/same-origin-iframe.html8
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/sizing-target.html17
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/window-open-popup-target.html24
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/support/windowFeature-values-target.html24
8 files changed, 130 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html
new file mode 100644
index 0000000000..9921e7a577
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+ const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
+ const barPropsObj = {};
+ const channelName = location.search.substr(1);
+ const channel = new BroadcastChannel(channelName);
+ for (const prop of barProps) {
+ barPropsObj[prop] = window[prop].visible;
+ }
+ channel.postMessage(barPropsObj);
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = () => { window.close() };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/closed.html b/testing/web-platform/tests/html/browsers/the-window-object/support/closed.html
new file mode 100644
index 0000000000..3b70598e34
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/closed.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!--
+ There's two URL parameters supported here:
+
+ window: The property name of a getter on the global object that returns the relevant WindowProxy
+ object to message.
+ ident: A reasonably unique identifier that will be echoed as the message.
+-->
+<script>
+ const params = new URLSearchParams(location.search);
+ self[params.get("window")].postMessage(params.get("ident"), "*");
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html
new file mode 100644
index 0000000000..41e197a746
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/noopener-target.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<script>
+ var channelName = location.search.substr(1);
+ var channel = new BroadcastChannel(channelName);
+ channel.postMessage({ name: window.name,
+ haveOpener: window.opener !== null });
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = function() {
+ window.close();
+ };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html
new file mode 100644
index 0000000000..c2446c6fe9
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html
@@ -0,0 +1,13 @@
+<script>
+ const channelName = location.search.substr(1),
+ channel = new BroadcastChannel(channelName);
+ channel.postMessage({ name: window.name,
+ haveOpener: window.opener !== null,
+ referrer: document.referrer });
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = () => window.close();
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/same-origin-iframe.html b/testing/web-platform/tests/html/browsers/the-window-object/support/same-origin-iframe.html
new file mode 100644
index 0000000000..763d9e466b
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/same-origin-iframe.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script>
+ window.addEventListener('load', () => { window.didLoadFrame = true; });
+ </script>
+ </head>
+</html>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/sizing-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/sizing-target.html
new file mode 100644
index 0000000000..7cd5348a85
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/sizing-target.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script>
+ const windowProps = ["innerWidth", "innerHeight"];
+ const windowPropsObj = {};
+ const channelName = location.search.substr(1);
+ const channel = new BroadcastChannel(channelName);
+ for (const prop of windowProps) {
+ windowPropsObj[prop] = window[prop];
+ }
+ channel.postMessage(windowPropsObj);
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = () => { window.close() };
+</script>
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/window-open-popup-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/window-open-popup-target.html
new file mode 100644
index 0000000000..a0588de829
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/window-open-popup-target.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script>
+ var channelName = window.name;
+ var channel = new BroadcastChannel(channelName);
+ const allBarProps = [
+ window.locationbar.visible,
+ window.menubar.visible,
+ window.personalbar.visible,
+ window.scrollbars.visible,
+ window.statusbar.visible,
+ window.toolbar.visible
+ ];
+ const allTrue = allBarProps.every(x=>x);
+ const allFalse = allBarProps.every(x=>!x);
+ channel.postMessage({isPopup: allFalse, mixedState: !allTrue && !allFalse});
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = function() {
+ window.close();
+ };
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/windowFeature-values-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/windowFeature-values-target.html
new file mode 100644
index 0000000000..3a78ddf660
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/support/windowFeature-values-target.html
@@ -0,0 +1,24 @@
+<script>
+ const channelName = location.search.substr(1),
+ channel = new BroadcastChannel(channelName);
+
+ const haveOpener = window.opener !== null;
+ const haveReferrer = document.referrer !== null && document.referrer !== "";
+ const allBarProps = [
+ window.locationbar.visible,
+ window.menubar.visible,
+ window.personalbar.visible,
+ window.scrollbars.visible,
+ window.statusbar.visible,
+ window.toolbar.visible
+ ];
+ const isPopup = allBarProps.every(x=>!x);
+
+ channel.postMessage({haveOpener, haveReferrer, isPopup});
+
+ // Because messages are not delivered synchronously and because closing a
+ // browsing context prompts the eventual clearing of all task sources, this
+ // document should not be closed until the opener document has confirmed
+ // receipt.
+ channel.onmessage = () => window.close();
+</script>