Skip to content

Commit

Permalink
HTML: test WindowProxy self references
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Mar 7, 2019
1 parent 405751f commit b0806cd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions html/browsers/the-window-object/self-et-al.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
"frames",
"globalThis",
"self",
"window"
].forEach(windowProxySelfReference => {
test(() => {
const frame = document.body.appendChild(document.createElement("iframe")),
otherW = frame.contentWindow;
assert_equals(otherW[windowProxySelfReference], otherW);
frame.remove();
assert_equals(otherW[windowProxySelfReference], otherW);
}, `iframeWindow.${windowProxySelfReference} before and after removal`);

async_test(t => {
const otherW = window.open();
assert_equals(otherW[windowProxySelfReference], otherW);
otherW.close();
assert_equals(otherW[windowProxySelfReference], otherW);
t.step_timeout(() => {
assert_equals(otherW.opener, null); // Ensure browsing context is discarded
assert_equals(otherW[windowProxySelfReference], otherW);
t.done();
}, 250);
}, `popupWindow.${windowProxySelfReference} before, after closing, and after discarding`)
});

0 comments on commit b0806cd

Please sign in to comment.