|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 function test() { |
|
6 /** Test for Bug 524745 **/ |
|
7 |
|
8 let uniqKey = "bug524745"; |
|
9 let uniqVal = Date.now(); |
|
10 |
|
11 waitForExplicitFinish(); |
|
12 |
|
13 whenNewWindowLoaded({ private: false }, function (window_B) { |
|
14 waitForFocus(function() { |
|
15 // Add identifying information to window_B |
|
16 ss.setWindowValue(window_B, uniqKey, uniqVal); |
|
17 let state = JSON.parse(ss.getBrowserState()); |
|
18 let selectedWindow = state.windows[state.selectedWindow - 1]; |
|
19 is(selectedWindow.extData && selectedWindow.extData[uniqKey], uniqVal, |
|
20 "selectedWindow is window_B"); |
|
21 |
|
22 // Now minimize window_B. The selected window shouldn't have the secret data |
|
23 window_B.minimize(); |
|
24 waitForFocus(function() { |
|
25 state = JSON.parse(ss.getBrowserState()); |
|
26 selectedWindow = state.windows[state.selectedWindow - 1]; |
|
27 ok(!selectedWindow.extData || !selectedWindow.extData[uniqKey], |
|
28 "selectedWindow is not window_B after minimizing it"); |
|
29 |
|
30 // Now minimize the last open window (assumes no other tests left windows open) |
|
31 window.minimize(); |
|
32 state = JSON.parse(ss.getBrowserState()); |
|
33 is(state.selectedWindow, 0, |
|
34 "selectedWindow should be 0 when all windows are minimized"); |
|
35 |
|
36 // Cleanup |
|
37 window.restore(); |
|
38 window_B.close(); |
|
39 finish(); |
|
40 }); |
|
41 }, window_B); |
|
42 }); |
|
43 } |