Skip to content

HTML: window.open("", "", "noreferrer") - #15352

Merged
annevk merged 4 commits into
masterfrom
annevk/window-open-noreferrer
Feb 26, 2019
Merged

annevk merged 4 commits into
masterfrom
annevk/window-open-noreferrer

Conversation

@annevk

@annevk annevk commented Feb 12, 2019

Copy link
Copy Markdown
Member

`\u000C${feature}`
].forEach(variant => {
const win = window.open(windowURL, "", variant);
assert_equals(win, null, `"${variant}" should activate feature "${feature}"`);

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.

This assertion (and the assert_not_equals later) is specific to the noopener feature. Although noreferrer means the same thing, the file name/function name suggests this is more generic than it is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's a good point, I'll rename.

annevk added a commit to whatwg/html that referenced this pull request Feb 12, 2019
annevk added a commit to whatwg/html that referenced this pull request Feb 12, 2019
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
mustaqahmed pushed a commit to mustaqahmed/html that referenced this pull request Feb 15, 2019
@annevk
annevk requested a review from zcorpan February 24, 2019 08:08

@zcorpan zcorpan 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 % nit

assert_equals(e.data.referrer, "");
assert_equals(e.data.haveOpener, false);

channel.postMessage(null);

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.

This will not be reached if an assertion fails, so the popup will not be closed. Having this first, or using add_cleanup, would do the trick I believe.

@annevk
annevk merged commit 22abb9c into master Feb 26, 2019
@annevk
annevk deleted the annevk/window-open-noreferrer branch February 26, 2019 11:01
@cdumez

cdumez commented Mar 29, 2019

Copy link
Copy Markdown
Contributor

BroadcastChannel :( I had to rewrite the test using localStorage instead so it would run in WebKit.

@annevk

annevk commented Mar 30, 2019

Copy link
Copy Markdown
Member Author

@cdumez what is an alternative strategy? Also, any chance WebKit will add BroadcastChannel?

@cdumez

cdumez commented Mar 30, 2019

Copy link
Copy Markdown
Contributor

As I said, I used localStorage as an alternative. I guess cookies could work too. I am not aware of any plan to adopt BroadcastChannel.

@annevk

annevk commented Apr 5, 2019

Copy link
Copy Markdown
Member Author

@cdumez ah right, sorry. Wouldn't you rather folks use BroadcastChannel than abuse localStorage for messaging between disconnected top-level browsing contexts?

@cdumez

cdumez commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

I do not think people should do this in shipping code, and localStorage is good enough for testing purposes.

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.

5 participants