michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let state = {windows:[{tabs:[ michael@0: {entries:[{url:"http://example.com#1"}]}, michael@0: {entries:[{url:"http://example.com#2"}], hidden: true} michael@0: ]}]}; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithState(state, function (aWindow) { michael@0: let tab = aWindow.gBrowser.tabs[1]; michael@0: ok(tab.hidden, "the second tab is hidden"); michael@0: michael@0: let tabShown = false; michael@0: let tabShowCallback = function () tabShown = true; michael@0: tab.addEventListener("TabShow", tabShowCallback, false); michael@0: michael@0: let tabState = ss.getTabState(tab); michael@0: ss.setTabState(tab, tabState); michael@0: michael@0: tab.removeEventListener("TabShow", tabShowCallback, false); michael@0: ok(tab.hidden && !tabShown, "tab remains hidden"); michael@0: michael@0: finish(); michael@0: }); michael@0: } michael@0: michael@0: // ---------- michael@0: function newWindowWithState(aState, aCallback) { michael@0: let opts = "chrome,all,dialog=no,height=800,width=800"; michael@0: let win = window.openDialog(getBrowserURL(), "_blank", opts); michael@0: michael@0: registerCleanupFunction(function () win.close()); michael@0: michael@0: whenWindowLoaded(win, function onWindowLoaded(aWin) { michael@0: ss.setWindowState(aWin, JSON.stringify(aState), true); michael@0: executeSoon(function () aCallback(aWin)); michael@0: }); michael@0: }