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.

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

mercurial