test_window_bar.html (3612B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=642338 5 --> 6 <head> 7 <title>Test for Bug 642338</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642338">Mozilla Bug 642338</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 /* Test that the following window properties work: 21 22 menubar 23 toolbar 24 locationbar 25 personalbar 26 statusbar 27 scrollbars 28 29 */ 30 31 // Popup is opened if one of the following condtitions is met: 32 // * both location and toolbar are false 33 // * menubar is false 34 // * resizable is false 35 // * scrollbars is false 36 // * status is false 37 var featuresList = [ 38 { 39 type: 'non-popup', 40 target: 'all-bars-toolbar', 41 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes', 42 }, 43 { 44 type: 'non-popup', 45 target: 'all-bars-location', 46 features: 'location=yes,menubar=yes,status=yes,scrollbars=yes', 47 }, 48 { 49 type: 'popup', 50 target: 'no-menubar', 51 features: 'toolbar=yes,menubar=no,status=yes,scrollbars=yes', 52 }, 53 { 54 type: 'popup', 55 target: 'no-toolbar', 56 features: 'toolbar=no,menubar=yes,status=yes,scrollbars=yes', 57 }, 58 { 59 type: 'popup', 60 target: 'no-status', 61 features: 'toolbar=yes,menubar=yes,status=no,scrollbars=yes', 62 }, 63 { 64 type: 'popup', 65 target: 'no-scrollbars', 66 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=no', 67 }, 68 { 69 type: 'popup', 70 target: 'no-bars', 71 features: 'toolbar=no,menubar=no,status=no,scrollbars=no', 72 }, 73 { 74 type: 'popup', 75 target: 'no-resizable', 76 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes' 77 + ',resizable=no', 78 }, 79 { 80 type: 'non-popup', 81 target: 'width-sized', 82 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes' 83 + ',width=500', 84 }, 85 { 86 // if features isnt empty, toolbar and location defaults to false, 87 // and that results in popup. 88 type: 'popup', 89 target: 'only-width-sized', 90 features: 'width=500', 91 }, 92 { 93 type: 'non-popup', 94 target: 'height-sized', 95 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes' 96 + ',height=500', 97 }, 98 { 99 type: 'non-popup', 100 target: 'sized', 101 features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes' 102 + ',width=500,height=500', 103 }, 104 { 105 type: 'popup', 106 target: 'only-sized', 107 features: 'width=500,height=500', 108 }, 109 ]; 110 111 var numWindows = 0; 112 113 /* Called when our popup loads. */ 114 function testWindow(w) 115 { 116 function checkFeature(feature) { 117 if (w.location.search.startsWith('?popup')) { 118 is(w[feature].visible, false, `${feature} should be hidden for popup (${w.name}).`); 119 } else { 120 is(w[feature].visible, true, `${feature} should be visible for non-popup (${w.name}).`); 121 } 122 } 123 124 // If popup is opened, all BarProp.visible become false. 125 checkFeature('menubar'); 126 checkFeature('toolbar'); 127 checkFeature('personalbar'); 128 checkFeature('scrollbars'); 129 checkFeature('statusbar'); 130 checkFeature('locationbar'); 131 132 w.close(); 133 134 numWindows++; 135 if (numWindows == featuresList.length) { 136 // We're done! 137 SimpleTest.finish(); 138 } 139 140 } 141 142 SimpleTest.waitForExplicitFinish(); 143 for (var item of featuresList) { 144 // This will call back into testWindow when they open. 145 window.open(`file_window_bar.html?${item.type}`, item.target, item.features); 146 } 147 148 </script> 149 </pre> 150 </body> 151 </html>