browser/components/sessionstore/test/browser_495495.js

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 function test() {
     6   /** Test for Bug 495495 **/
     8   waitForExplicitFinish();
    10   let newWin = openDialog(location, "_blank", "chrome,all,dialog=no,toolbar=yes");
    11   newWin.addEventListener("load", function() {
    12     newWin.removeEventListener("load", arguments.callee, false);
    14     executeSoon(function() {
    15       let state1 = ss.getWindowState(newWin);
    16       newWin.close();
    18       newWin = openDialog(location, "_blank",
    19         "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar=no,location,personal,directories,dialog=no");
    20       newWin.addEventListener("load", function() {
    21         newWin.removeEventListener("load", arguments.callee, false);
    23         executeSoon(function() {
    24           let state2 = ss.getWindowState(newWin);
    25           newWin.close();
    27           function testState(state, expected, callback) {
    28             let win = openDialog(location, "_blank", "chrome,all,dialog=no");
    29             win.addEventListener("load", function() {
    30               win.removeEventListener("load", arguments.callee, false);
    32               is(win.gURLBar.readOnly, false,
    33                  "URL bar should not be read-only before setting the state");
    34               is(win.gURLBar.getAttribute("enablehistory"), "true",
    35                  "URL bar autocomplete should be enabled before setting the state");
    36               ss.setWindowState(win, state, true);
    37               is(win.gURLBar.readOnly, expected.readOnly,
    38                  "URL bar read-only state should be restored correctly");
    39               is(win.gURLBar.getAttribute("enablehistory"), expected.enablehistory,
    40                  "URL bar autocomplete state should be restored correctly");
    42               win.close();
    43               executeSoon(callback);
    44             }, false);
    45           }
    47           testState(state1, {readOnly: false, enablehistory: "true"}, function() {
    48             testState(state2, {readOnly: true, enablehistory: "false"}, finish);
    49           });
    50         });
    51       }, false);
    52     });
    53   }, false);
    54 }

mercurial