Repository navigation
HTML: window.closed - #15561
HTML: window.closed#15561
Conversation
|
@annevk I didn't know draft PRs were a thing, I presume it's new. Would it be better if @wpt-pr-bot didn't notify anyone until it's published, if that's the verb? |
|
@foolip yeah, it's a new thing I wanted to play with. "Ready for review" is the button I can press to make it a proper PR it seems like. |
|
https://api.github.com/repos/web-platform-tests/wpt/pulls/15561 says |
|
Filed web-platform-tests/wpt-pr-bot#69 about this. |
domenic
left a comment
There was a problem hiding this comment.
LGTM with potential clarity improvementsm
| const openee = window.open(); | ||
| closedTest(openee, () => openee.close()); | ||
|
|
||
| // This should not matter |
There was a problem hiding this comment.
Maybe "These should not throw" or something?
| <!DOCTYPE html> | ||
| <script> | ||
| const params = new URLSearchParams(location.search); | ||
| self[params.get("window")].postMessage(params.get("ident"), "*"); |
There was a problem hiding this comment.
I think this would be clearer if you documented what the two params do. Especially the window one was hard to figure out.
| url: `${get_host_info().HTTP_NOTSAMESITE_ORIGIN}${support}` | ||
| } | ||
| ].forEach(val => { | ||
| async_test(t => { |
There was a problem hiding this comment.
Can you add a comment explaining why these are waiting on the postMessage? I guess it is basically trying to do a cross-site window.onload = runTheActualTest?
There was a problem hiding this comment.
I guess you could make it more self-documenting by having some wrapper so that it was
runTestWhileWaitingForLoad({
type: "cross-origin",
setup() {
const frame = document.createElement("iframe");
frame.src = url;
document.body.append(frame);
return frame;
},
test() {
closedTest(frame.contentWindow, () => frame.remove());
self.removeEventListener("message", listener);
}
});or something similar.
| }, `closed and ${val.type} nested browsing context`); | ||
|
|
||
| async_test(t => { | ||
| const ident = `${val.type}-auxiliaryframe`, |
There was a problem hiding this comment.
"auxiliary" and "frame" are a bit confusing together, since it makes me think of iframe/frame elements.
close() needed to queue a task to close, though closed needs to immediately know when close() is invoked too. Tests: web-platform-tests/wpt#15561 & web-platform-tests/wpt#15649. Fixes #4405. Helps with #4363.
close()by invoking it on WindowProxy objects formerly belonging to removed browsing contexts and seeing to it that nothing happens