summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/windows/opener-string.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/windows/opener-string.window.js')
-rw-r--r--testing/web-platform/tests/html/browsers/windows/opener-string.window.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/windows/opener-string.window.js b/testing/web-platform/tests/html/browsers/windows/opener-string.window.js
new file mode 100644
index 0000000000..a39c584d20
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/opener-string.window.js
@@ -0,0 +1,14 @@
+test(t => {
+ const popup = window.open();
+ t.add_cleanup(() => popup.close());
+ assert_equals(popup.opener, self, "The opener of the popup is me");
+ assert_equals(Object.getOwnPropertyDescriptor(popup, "opener").writable, undefined);
+
+ popup.opener = "blah";
+ assert_equals(popup.opener, "blah", "The popup's opener is now a string");
+ assert_equals(Object.getOwnPropertyDescriptor(popup, "opener").writable, true);
+
+ const openerGetter = Object.getOwnPropertyDescriptor(self, "opener").get;
+ const popupOpener = openerGetter.call(popup);
+ assert_equals(popupOpener, self, "The underlying opener of the popup is still me");
+}, "Setting popup.opener to a string");