Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML: ensure BarProps are visible for noopener/noreferrer #16330

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];

test(() => {
for(const prop of barProps) {
assert_true(window[prop].visible);
}
}, "All bars visible");

["noopener", "noreferrer"].forEach(openerStyle => {
async_test(t => {
const channelName = "5454" + openerStyle + "34324";
const channel = new BroadcastChannel(channelName);
window.open("support/BarProp-target.html?" + channelName, "", openerStyle);
channel.onmessage = t.step_func_done(e => {
// Send message first so if asserts throw the popup is still closed
channel.postMessage(null);

for(const prop of barProps) {
assert_true(e.data[prop]);
}
});
}, `window.open() with ${openerStyle} should have all bars visible`);
});
17 changes: 17 additions & 0 deletions html/browsers/the-window-object/support/BarProp-target.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
const barPropsObj = {};
const channelName = location.search.substr(1);
const channel = new BroadcastChannel(channelName);
for (const prop of barProps) {
barPropsObj[prop] = window[prop].visible;
}
channel.postMessage(barPropsObj);

// Because messages are not delivered synchronously and because closing a
// browsing context prompts the eventual clearing of all task sources, this
// document should not be closed until the opener document has confirmed
// receipt.
channel.onmessage = () => { window.close() };
</script>