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.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Bug 597071 - Closed windows should only be resurrected when there is a single
6 * popup window
7 */
8 add_task(function test_close_last_nonpopup_window() {
9 // Purge the list of closed windows.
10 while (ss.getClosedWindowCount()) {
11 ss.forgetClosedWindow(0);
12 }
14 let oldState = ss.getWindowState(window);
16 let popupState = {windows: [
17 {tabs: [{entries: []}], isPopup: true, hidden: "toolbar"}
18 ]};
20 // Set this window to be a popup.
21 ss.setWindowState(window, JSON.stringify(popupState), true);
23 // Open a new window with a tab.
24 let win = yield promiseNewWindowLoaded({private: false});
25 let tab = win.gBrowser.addTab("http://example.com/");
26 yield promiseBrowserLoaded(tab.linkedBrowser);
28 // Make sure sessionstore sees this window.
29 let state = JSON.parse(ss.getBrowserState());
30 is(state.windows.length, 2, "sessionstore knows about this window");
32 // Closed the window and check the closed window count.
33 yield promiseWindowClosed(win);
34 is(ss.getClosedWindowCount(), 1, "correct closed window count");
36 // Cleanup.
37 ss.setWindowState(window, oldState, true);
38 });