Wed, 31 Dec 2014 06:09:35 +0100
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 | function test() { |
michael@0 | 5 | let state = { windows: [{ tabs: [ |
michael@0 | 6 | {entries: [{url: "about:mozilla"}], hidden: true}, |
michael@0 | 7 | {entries: [{url: "about:rights"}], hidden: true} |
michael@0 | 8 | ] }] }; |
michael@0 | 9 | |
michael@0 | 10 | waitForExplicitFinish(); |
michael@0 | 11 | |
michael@0 | 12 | newWindowWithState(state, function (win) { |
michael@0 | 13 | registerCleanupFunction(function () win.close()); |
michael@0 | 14 | |
michael@0 | 15 | is(win.gBrowser.tabs.length, 2, "two tabs were restored"); |
michael@0 | 16 | is(win.gBrowser.visibleTabs.length, 1, "one tab is visible"); |
michael@0 | 17 | |
michael@0 | 18 | let tab = win.gBrowser.visibleTabs[0]; |
michael@0 | 19 | is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "visible tab is about:mozilla"); |
michael@0 | 20 | |
michael@0 | 21 | finish(); |
michael@0 | 22 | }); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | function newWindowWithState(state, callback) { |
michael@0 | 26 | let opts = "chrome,all,dialog=no,height=800,width=800"; |
michael@0 | 27 | let win = window.openDialog(getBrowserURL(), "_blank", opts); |
michael@0 | 28 | |
michael@0 | 29 | win.addEventListener("load", function onLoad() { |
michael@0 | 30 | win.removeEventListener("load", onLoad, false); |
michael@0 | 31 | |
michael@0 | 32 | executeSoon(function () { |
michael@0 | 33 | win.addEventListener("SSWindowStateReady", function onReady() { |
michael@0 | 34 | win.removeEventListener("SSWindowStateReady", onReady, false); |
michael@0 | 35 | whenTabRestored(win.gBrowser.tabs[0], () => callback(win)); |
michael@0 | 36 | }, false); |
michael@0 | 37 | |
michael@0 | 38 | ss.setWindowState(win, JSON.stringify(state), true); |
michael@0 | 39 | }); |
michael@0 | 40 | }, false); |
michael@0 | 41 | } |