dom/tests/mochitest/bugs/test_window_bar.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 /* Test that the following window properties work:
    22      menubar
    23      toolbar
    24      locationbar
    25      personalbar
    26      statusbar
    27      scrollbars
    29 */
    31 var numWindows = 0;
    33 /* Called when our popup loads. */
    34 function testWindow(w)
    35 {
    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.
    42   function checkFeature(feature, prefname) {
    43     if (prefname === undefined)
    44       prefname = feature;
    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   }
    57   checkFeature('menubar');
    58   checkFeature('toolbar');
    59   checkFeature('personalbar');
    60   checkFeature('scrollbars');
    61   checkFeature('statusbar', 'status');
    62   checkFeature('locationbar', 'location');
    64   w.close();
    66   numWindows++;
    67   if (numWindows == 2) {
    68     // We're done!
    69     SimpleTest.finish();
    70   }
    72 }
    74 SimpleTest.waitForExplicitFinish();
    76 // These will call back into testWindow when they open.
    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);
    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);
    90 </script>
    91 </pre>
    92 </body>
    93 </html>

mercurial