|
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(function test_close_last_nonpopup_window() { |
|
9 // Purge the list of closed windows. |
|
10 while (ss.getClosedWindowCount()) { |
|
11 ss.forgetClosedWindow(0); |
|
12 } |
|
13 |
|
14 let oldState = ss.getWindowState(window); |
|
15 |
|
16 let popupState = {windows: [ |
|
17 {tabs: [{entries: []}], isPopup: true, hidden: "toolbar"} |
|
18 ]}; |
|
19 |
|
20 // Set this window to be a popup. |
|
21 ss.setWindowState(window, JSON.stringify(popupState), true); |
|
22 |
|
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); |
|
27 |
|
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"); |
|
31 |
|
32 // Closed the window and check the closed window count. |
|
33 yield promiseWindowClosed(win); |
|
34 is(ss.getClosedWindowCount(), 1, "correct closed window count"); |
|
35 |
|
36 // Cleanup. |
|
37 ss.setWindowState(window, oldState, true); |
|
38 }); |