browser_597071.js (1233B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 /** 5 * Bug 597071 - Closed windows should only be resurrected when there is a single 6 * popup window 7 */ 8 add_task(async function test_close_last_nonpopup_window() { 9 // Purge the list of closed windows. 10 forgetClosedWindows(); 11 12 let oldState = ss.getWindowState(window); 13 14 let popupState = { 15 windows: [{ tabs: [{ entries: [] }], isPopup: true, hidden: "toolbar" }], 16 }; 17 18 // Set this window to be a popup. 19 ss.setWindowState(window, JSON.stringify(popupState), true); 20 21 // Open a new window with a tab. 22 let win = await BrowserTestUtils.openNewBrowserWindow({ private: false }); 23 let tab = BrowserTestUtils.addTab(win.gBrowser, "http://example.com/"); 24 await BrowserTestUtils.browserLoaded(tab.linkedBrowser); 25 26 // Make sure sessionstore sees this window. 27 let state = JSON.parse(ss.getBrowserState()); 28 is(state.windows.length, 2, "sessionstore knows about this window"); 29 30 // Closed the window and check the closed window count. 31 await BrowserTestUtils.closeWindow(win); 32 is(ss.getClosedWindowCount(), 1, "correct closed window count"); 33 34 // Cleanup. 35 ss.setWindowState(window, oldState, true); 36 });