Skip to content

HTML: window.closed - #15561

Merged
annevk merged 4 commits into
masterfrom
annevk/window.closed
Mar 7, 2019
Merged

annevk merged 4 commits into
masterfrom
annevk/window.closed

Conversation

@annevk

@annevk annevk commented Feb 26, 2019 •

Copy link
Copy Markdown
Member
  • Better test titles.
  • Create some cross-origin/site tests. (In particular is this all still sync?)
  • Maybe add testing of close() by invoking it on WindowProxy objects formerly belonging to removed browsing contexts and seeing to it that nothing happens

@foolip

foolip commented Feb 26, 2019

Copy link
Copy Markdown
Member

@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?

@annevk

annevk commented Feb 27, 2019

Copy link
Copy Markdown
Member Author

@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.

@foolip

foolip commented Feb 27, 2019

Copy link
Copy Markdown
Member

https://api.github.com/repos/web-platform-tests/wpt/pulls/15561 says "mergeable_state": "draft" so it would at least be possible to handle this.

@foolip

foolip commented Feb 27, 2019

Copy link
Copy Markdown
Member

Filed web-platform-tests/wpt-pr-bot#69 about this.

@annevk
annevk marked this pull request as ready for review March 1, 2019 13:26
annevk added a commit to whatwg/html that referenced this pull request Mar 1, 2019

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with potential clarity improvementsm

const openee = window.open();
closedTest(openee, () => openee.close());

// This should not matter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "These should not throw" or something?

<!DOCTYPE html>
<script>
const params = new URLSearchParams(location.search);
self[params.get("window")].postMessage(params.get("ident"), "*");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@domenic domenic Mar 1, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"auxiliary" and "frame" are a bit confusing together, since it makes me think of iframe/frame elements.

@annevk
annevk merged commit 391ee6b into master Mar 7, 2019
@annevk
annevk deleted the annevk/window.closed branch March 7, 2019 15:46
annevk added a commit to whatwg/html that referenced this pull request Mar 7, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants