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