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