dom/tests/mochitest/bugs/test_window_bar.html

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:1806bc340dde
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 type="text/javascript" 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 var numWindows = 0;
32
33 /* Called when our popup loads. */
34 function testWindow(w)
35 {
36
37 // If dom.disable_window_open_feature.X is true, then we can't disable
38 // feature X when we call window.open from content. So to check that our popup
39 // has the right bars shown, we need to check that it obeys first the pref
40 // and then the arguments to window.open, if applicable.
41
42 function checkFeature(feature, prefname) {
43 if (prefname === undefined)
44 prefname = feature;
45
46 if (SpecialPowers.getBoolPref('dom.disable_window_open_feature.' + prefname)) {
47 is(w[feature].visible, true, feature + ' should always be true.');
48 }
49 else {
50 // w.location.search == '?true' if we expect the bars to be on, and
51 // '?false' otherwise.
52 var enabled = w.location.search == '?true';
53 is(w[feature].visible, enabled, feature + ' should follow window.open settings.');
54 }
55 }
56
57 checkFeature('menubar');
58 checkFeature('toolbar');
59 checkFeature('personalbar');
60 checkFeature('scrollbars');
61 checkFeature('statusbar', 'status');
62 checkFeature('locationbar', 'location');
63
64 w.close();
65
66 numWindows++;
67 if (numWindows == 2) {
68 // We're done!
69 SimpleTest.finish();
70 }
71
72 }
73
74 SimpleTest.waitForExplicitFinish();
75
76 // These will call back into testWindow when they open.
77
78 var allBarsWindow =
79 window.open('file_window_bar.html?true', 'all-bars',
80 'menubar=yes,toolbar=yes,location=yes,' +
81 'personalbar=yes,status=yes,scrollbars=yes',
82 true);
83
84 var noBarsWindow =
85 window.open('file_window_bar.html?false', 'no-bars',
86 'menubar=no,toolbar=no,location=no,' +
87 'personalbar=no,status=no,scrollbars=no',
88 false);
89
90 </script>
91 </pre>
92 </body>
93 </html>

mercurial