browser/components/sessionstore/test/browser_524745.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     5 function test() {
     6   /** Test for Bug 524745 **/
     8   let uniqKey = "bug524745";
     9   let uniqVal = Date.now();
    11   waitForExplicitFinish();
    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");
    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");
    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");
    36         // Cleanup
    37         window.restore();
    38         window_B.close();
    39         finish();
    40       });
    41     }, window_B);
    42   });
    43 }

mercurial