michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function test() { michael@0: /** Test for Bug 524745 **/ michael@0: michael@0: let uniqKey = "bug524745"; michael@0: let uniqVal = Date.now(); michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: whenNewWindowLoaded({ private: false }, function (window_B) { michael@0: waitForFocus(function() { michael@0: // Add identifying information to window_B michael@0: ss.setWindowValue(window_B, uniqKey, uniqVal); michael@0: let state = JSON.parse(ss.getBrowserState()); michael@0: let selectedWindow = state.windows[state.selectedWindow - 1]; michael@0: is(selectedWindow.extData && selectedWindow.extData[uniqKey], uniqVal, michael@0: "selectedWindow is window_B"); michael@0: michael@0: // Now minimize window_B. The selected window shouldn't have the secret data michael@0: window_B.minimize(); michael@0: waitForFocus(function() { michael@0: state = JSON.parse(ss.getBrowserState()); michael@0: selectedWindow = state.windows[state.selectedWindow - 1]; michael@0: ok(!selectedWindow.extData || !selectedWindow.extData[uniqKey], michael@0: "selectedWindow is not window_B after minimizing it"); michael@0: michael@0: // Now minimize the last open window (assumes no other tests left windows open) michael@0: window.minimize(); michael@0: state = JSON.parse(ss.getBrowserState()); michael@0: is(state.selectedWindow, 0, michael@0: "selectedWindow should be 0 when all windows are minimized"); michael@0: michael@0: // Cleanup michael@0: window.restore(); michael@0: window_B.close(); michael@0: finish(); michael@0: }); michael@0: }, window_B); michael@0: }); michael@0: }