Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML: window.open `features`: tokenization -- size features `width` and `height`</title>
<meta name=timeout content=long>
<!-- 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/message-opener.html';
var width = 'width=401,';
var height = 'height=402,';
[ 'width=401',
' width = 401',
'width==401',
'\nwidth= 401',
',width=401,,',
'WIDTH=401'
].forEach((features, idx, arr) => {
async_test(t => {
var prefixedMessage = new PrefixedMessageTest();
prefixedMessage.onMessage(t.step_func_done((data, e) => {
e.source.close();
assert_equals(data.width, 401);
}));
var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=401', '', height + features);
}, `${format_value(features)} should set width of opened window`);
});
[ 'height=402',
' height = 402',
'height==402',
'\nheight= 402',
',height=402,,',
'HEIGHT=402'
].forEach((features, idx, arr) => {
async_test(t => {
var prefixedMessage = new PrefixedMessageTest();
prefixedMessage.onMessage(t.step_func_done((data, e) => {
e.source.close();
assert_equals(data.height, 402);
}));
var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402', '', width + features);
}, `${format_value(features)} should set height of opened window`);
});
[ 'height=402,width=401',
' height = 402 , width = 401 ,',
'height==402 width = 401',
'\nheight= 402,,width=\n401',
',height=402,,width==401',
'HEIGHT=402, WIDTH=401'
].forEach((features, idx, arr) => {
async_test(t => {
var prefixedMessage = new PrefixedMessageTest();
prefixedMessage.onMessage(t.step_func_done((data, e) => {
e.source.close();
assert_equals(data.height, 402);
assert_equals(data.width, 401)
}));
var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402&expected_innerWidth=401', '', features);
}, `${format_value(features)} should set height and width of opened window`);
});
</script>