browser/components/sessionstore/test/browser_701377.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 let state = {windows:[{tabs:[
     5   {entries:[{url:"http://example.com#1"}]},
     6   {entries:[{url:"http://example.com#2"}], hidden: true}
     7 ]}]};
     9 function test() {
    10   waitForExplicitFinish();
    12   newWindowWithState(state, function (aWindow) {
    13     let tab = aWindow.gBrowser.tabs[1];
    14     ok(tab.hidden, "the second tab is hidden");
    16     let tabShown = false;
    17     let tabShowCallback = function () tabShown = true;
    18     tab.addEventListener("TabShow", tabShowCallback, false);
    20     let tabState = ss.getTabState(tab);
    21     ss.setTabState(tab, tabState);
    23     tab.removeEventListener("TabShow", tabShowCallback, false);
    24     ok(tab.hidden && !tabShown, "tab remains hidden");
    26     finish();
    27   });
    28 }
    30 // ----------
    31 function newWindowWithState(aState, aCallback) {
    32   let opts = "chrome,all,dialog=no,height=800,width=800";
    33   let win = window.openDialog(getBrowserURL(), "_blank", opts);
    35   registerCleanupFunction(function () win.close());
    37   whenWindowLoaded(win, function onWindowLoaded(aWin) {
    38     ss.setWindowState(aWin, JSON.stringify(aState), true);
    39     executeSoon(function () aCallback(aWin));
    40   });
    41 }

mercurial