browser/components/sessionstore/test/browser_597071.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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

mercurial