forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML: the condition for opening a popup by window.open, and BarProp v…
…alues for each case For whatwg/html#5872 and whatwg/html#4431
- Loading branch information
Showing
2 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
127 changes: 127 additions & 0 deletions
127
...r-creating-and-navigating-browsing-contexts-by-name/open-features-is-popup-condition.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML: window.open `features`: condition for is popup</title> | ||
<meta name=timeout content=long> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/window-object.html#window-open-steps"> | ||
|
||
<!-- user agents are not required to support open features other than `noopener` | ||
and on some platforms position and size features don't make sense --> | ||
<meta name="flags" content="may" /> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/PrefixedPostMessage.js"></script> | ||
<script> | ||
var windowURL = 'resources/is-popup-barprop.html'; | ||
|
||
// features, visible | ||
// NOTE: visible == !isPopup | ||
[ | ||
// Empty feature results in non-popup. | ||
[undefined, true], | ||
|
||
// The explicit popup feature. | ||
["popup", false], | ||
["popup=1", false], | ||
["popup=0", true], | ||
|
||
// Other feature alone results in popup. | ||
["location", false], | ||
["location=yes", false], | ||
["location=no", false], | ||
|
||
["toolbar", false], | ||
["toolbar=yes", false], | ||
["toolbar=no", false], | ||
|
||
["menubar", false], | ||
["menubar=yes", false], | ||
["menubar=no", false], | ||
|
||
["resizable", false], | ||
["resizable=yes", false], | ||
["resizable=no", false], | ||
|
||
["scrollbars", false], | ||
["scrollbars=yes", false], | ||
["scrollbars=no", false], | ||
|
||
["status", false], | ||
["status=yes", false], | ||
["status=no", false], | ||
|
||
["titlebar", false], | ||
["titlebar=yes", false], | ||
["titlebar=no", false], | ||
|
||
["close", false], | ||
["close=yes", false], | ||
["close=no", false], | ||
|
||
["minimizable", false], | ||
["minimizable=yes", false], | ||
["minimizable=no", false], | ||
|
||
["personalbar", false], | ||
["personalbar=yes", false], | ||
["personalbar=no", false], | ||
|
||
["left=500", false], | ||
["screenX=500", false], | ||
|
||
["top=500", false], | ||
["screenY=500", false], | ||
|
||
["width=500", false], | ||
["innerWidth=500", false], | ||
|
||
["outerWidth=500", false], | ||
|
||
["height=500", false], | ||
["innerHeight=500", false], | ||
|
||
["outerHeight=500", false], | ||
|
||
// The following combination results in non-popup. | ||
["location,toolbar,menubar,resizable,scrollbars,status", true], | ||
|
||
// Either location or toolbar is required for non-popup. | ||
["location,menubar,resizable,scrollbars,status", true], | ||
["toolbar,menubar,resizable,scrollbars,status", true], | ||
|
||
["resizable,scrollbars,status", false], | ||
["location=no,menubar=no,resizable,scrollbars,status", false], | ||
|
||
// menubar is required for non-popup. | ||
["location,toolbar,resizable,scrollbars,status", false], | ||
|
||
// resizable is required for non-popup, but defaults to true | ||
["location,toolbar,menubar,scrollbars,status", true], | ||
["location,toolbar,menubar,resizable=no,scrollbars,status", false], | ||
|
||
// scrollbars is required for non-popup. | ||
["location,toolbar,menubar,resizable,status", false], | ||
|
||
// status is required for non-popup. | ||
["location,toolbar,menubar,resizable,scrollbars", false], | ||
|
||
// The explicit popup feature has priority than others. | ||
["popup=1,location,toolbar,menubar,resizable,scrollbars,status", false], | ||
["popup=0,location,toolbar,menubar,resizable,scrollbars", true], | ||
].forEach(([features, visible]) => { | ||
async_test(t => { | ||
var prefixedMessage = new PrefixedMessageTest(); | ||
prefixedMessage.onMessage(t.step_func_done((data, e) => { | ||
e.source.close(); | ||
assert_equals(data.locationbar, visible, `window.locationbar.visible`); | ||
assert_equals(data.menubar, visible, `window.menubar.visible`); | ||
assert_equals(data.personalbar, visible, `window.personalbar.visible`); | ||
assert_equals(data.scrollbars, visible, `window.scrollbars.visible`); | ||
assert_equals(data.statusbar, visible, `window.statusbar.visible`); | ||
assert_equals(data.toolbar, visible, `window.toolbar.visible`); | ||
})); | ||
var win = window.open(prefixedMessage.url(windowURL), '', features); | ||
}, `${format_value(features)} should set BarProp visibility to ${visible}`); | ||
}); | ||
|
||
</script> |
15 changes: 15 additions & 0 deletions
15
...pis-for-creating-and-navigating-browsing-contexts-by-name/resources/is-popup-barprop.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script src="/common/PrefixedPostMessage.js"></script> | ||
<script> | ||
var prefixedMessage = new PrefixedMessageResource(); | ||
function sendBarProps() { | ||
prefixedMessage.postToOpener({ | ||
locationbar: window.locationbar.visible, | ||
menubar: window.menubar.visible, | ||
personalbar: window.personalbar.visible, | ||
scrollbars: window.scrollbars.visible, | ||
statusbar: window.statusbar.visible, | ||
toolbar: window.toolbar.visible, | ||
}); | ||
} | ||
window.addEventListener('load', sendBarProps); | ||
</script> |