1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/sessionstore/test/browser_524745.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function test() { 1.9 + /** Test for Bug 524745 **/ 1.10 + 1.11 + let uniqKey = "bug524745"; 1.12 + let uniqVal = Date.now(); 1.13 + 1.14 + waitForExplicitFinish(); 1.15 + 1.16 + whenNewWindowLoaded({ private: false }, function (window_B) { 1.17 + waitForFocus(function() { 1.18 + // Add identifying information to window_B 1.19 + ss.setWindowValue(window_B, uniqKey, uniqVal); 1.20 + let state = JSON.parse(ss.getBrowserState()); 1.21 + let selectedWindow = state.windows[state.selectedWindow - 1]; 1.22 + is(selectedWindow.extData && selectedWindow.extData[uniqKey], uniqVal, 1.23 + "selectedWindow is window_B"); 1.24 + 1.25 + // Now minimize window_B. The selected window shouldn't have the secret data 1.26 + window_B.minimize(); 1.27 + waitForFocus(function() { 1.28 + state = JSON.parse(ss.getBrowserState()); 1.29 + selectedWindow = state.windows[state.selectedWindow - 1]; 1.30 + ok(!selectedWindow.extData || !selectedWindow.extData[uniqKey], 1.31 + "selectedWindow is not window_B after minimizing it"); 1.32 + 1.33 + // Now minimize the last open window (assumes no other tests left windows open) 1.34 + window.minimize(); 1.35 + state = JSON.parse(ss.getBrowserState()); 1.36 + is(state.selectedWindow, 0, 1.37 + "selectedWindow should be 0 when all windows are minimized"); 1.38 + 1.39 + // Cleanup 1.40 + window.restore(); 1.41 + window_B.close(); 1.42 + finish(); 1.43 + }); 1.44 + }, window_B); 1.45 + }); 1.46 +}