michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Bug 597071 - Closed windows should only be resurrected when there is a single michael@0: * popup window michael@0: */ michael@0: add_task(function test_close_last_nonpopup_window() { michael@0: // Purge the list of closed windows. michael@0: while (ss.getClosedWindowCount()) { michael@0: ss.forgetClosedWindow(0); michael@0: } michael@0: michael@0: let oldState = ss.getWindowState(window); michael@0: michael@0: let popupState = {windows: [ michael@0: {tabs: [{entries: []}], isPopup: true, hidden: "toolbar"} michael@0: ]}; michael@0: michael@0: // Set this window to be a popup. michael@0: ss.setWindowState(window, JSON.stringify(popupState), true); michael@0: michael@0: // Open a new window with a tab. michael@0: let win = yield promiseNewWindowLoaded({private: false}); michael@0: let tab = win.gBrowser.addTab("http://example.com/"); michael@0: yield promiseBrowserLoaded(tab.linkedBrowser); michael@0: michael@0: // Make sure sessionstore sees this window. michael@0: let state = JSON.parse(ss.getBrowserState()); michael@0: is(state.windows.length, 2, "sessionstore knows about this window"); michael@0: michael@0: // Closed the window and check the closed window count. michael@0: yield promiseWindowClosed(win); michael@0: is(ss.getClosedWindowCount(), 1, "correct closed window count"); michael@0: michael@0: // Cleanup. michael@0: ss.setWindowState(window, oldState, true); michael@0: });