browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     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 +// This test checks that closed private windows can't be restored
     1.9 +
    1.10 +function test() {
    1.11 +  waitForExplicitFinish();
    1.12 +
    1.13 +  // Purging the list of closed windows
    1.14 +  while(ss.getClosedWindowCount() > 0)
    1.15 +    ss.forgetClosedWindow(0);
    1.16 +
    1.17 +  // Load a private window, then close it 
    1.18 +  // and verify it doesn't get remembered for restoring
    1.19 +  whenNewWindowLoaded({private: true}, function (win) {
    1.20 +    info("The private window got loaded");
    1.21 +    win.addEventListener("SSWindowClosing", function onclosing() {
    1.22 +      win.removeEventListener("SSWindowClosing", onclosing, false);
    1.23 +      executeSoon(function () {
    1.24 +        is (ss.getClosedWindowCount(), 0,
    1.25 +            "The private window should not have been stored");
    1.26 +        finish();
    1.27 +      });
    1.28 +    }, false);
    1.29 +    win.close();
    1.30 +  });
    1.31 +}

mercurial