browser/components/sessionstore/test/browser_588426.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:f5fc430e2b96
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 let state = { windows: [{ tabs: [
6 {entries: [{url: "about:mozilla"}], hidden: true},
7 {entries: [{url: "about:rights"}], hidden: true}
8 ] }] };
9
10 waitForExplicitFinish();
11
12 newWindowWithState(state, function (win) {
13 registerCleanupFunction(function () win.close());
14
15 is(win.gBrowser.tabs.length, 2, "two tabs were restored");
16 is(win.gBrowser.visibleTabs.length, 1, "one tab is visible");
17
18 let tab = win.gBrowser.visibleTabs[0];
19 is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "visible tab is about:mozilla");
20
21 finish();
22 });
23 }
24
25 function newWindowWithState(state, callback) {
26 let opts = "chrome,all,dialog=no,height=800,width=800";
27 let win = window.openDialog(getBrowserURL(), "_blank", opts);
28
29 win.addEventListener("load", function onLoad() {
30 win.removeEventListener("load", onLoad, false);
31
32 executeSoon(function () {
33 win.addEventListener("SSWindowStateReady", function onReady() {
34 win.removeEventListener("SSWindowStateReady", onReady, false);
35 whenTabRestored(win.gBrowser.tabs[0], () => callback(win));
36 }, false);
37
38 ss.setWindowState(win, JSON.stringify(state), true);
39 });
40 }, false);
41 }

mercurial