open-features-tokenization-width-height.html (2499B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML: window.open `features`: tokenization -- size features `width` and `height`</title> 4 <meta name=timeout content=long> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name"> 6 7 <!-- user agents are not required to support open features other than `noopener` 8 and on some platforms position and size features don't make sense --> 9 <meta name="flags" content="may" /> 10 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <script src="/common/PrefixedPostMessage.js"></script> 14 <script> 15 var windowURL = 'resources/message-opener.html'; 16 var width = 'width=401,'; 17 var height = 'height=402,'; 18 19 [ 'width=401', 20 ' width = 401', 21 'width==401', 22 '\nwidth= 401', 23 ',width=401,,', 24 'WIDTH=401' 25 ].forEach((features, idx, arr) => { 26 async_test(t => { 27 var prefixedMessage = new PrefixedMessageTest(); 28 prefixedMessage.onMessage(t.step_func_done((data, e) => { 29 e.source.close(); 30 assert_equals(data.width, 401); 31 })); 32 var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerWidth=401', '', height + features); 33 }, `${format_value(features)} should set width of opened window`); 34 }); 35 36 [ 'height=402', 37 ' height = 402', 38 'height==402', 39 '\nheight= 402', 40 ',height=402,,', 41 'HEIGHT=402' 42 ].forEach((features, idx, arr) => { 43 async_test(t => { 44 var prefixedMessage = new PrefixedMessageTest(); 45 prefixedMessage.onMessage(t.step_func_done((data, e) => { 46 e.source.close(); 47 assert_equals(data.height, 402); 48 })); 49 var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402', '', width + features); 50 }, `${format_value(features)} should set height of opened window`); 51 }); 52 53 [ 'height=402,width=401', 54 ' height = 402 , width = 401 ,', 55 'height==402 width = 401', 56 '\nheight= 402,,width=\n401', 57 ',height=402,,width==401', 58 'HEIGHT=402, WIDTH=401' 59 ].forEach((features, idx, arr) => { 60 async_test(t => { 61 var prefixedMessage = new PrefixedMessageTest(); 62 prefixedMessage.onMessage(t.step_func_done((data, e) => { 63 e.source.close(); 64 assert_equals(data.height, 402); 65 assert_equals(data.width, 401) 66 })); 67 var win = window.open(prefixedMessage.url(windowURL) + '&expected_innerHeight=402&expected_innerWidth=401', '', features); 68 }, `${format_value(features)} should set height and width of opened window`); 69 }); 70 71 </script>