Bug 862371 - Test that closed private windows can't be restored.r=ttaubert
authorIoana Budnar <ioana.budnar@softvision.ro>
Tue, 07 May 2013 14:03:14 +0300
changeset 142485 64fb2941a3f5d1fde58ab45f7fceccc409ccfe06
parent 141936 8922af45886ec5c41b9f2cb8e77a61ab55b58315
child 142486 4475f15789cc2d222cd1b389a94874aa1c9cfe20
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs862371
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 862371 - Test that closed private windows can't be restored.r=ttaubert
browser/components/sessionstore/test/Makefile.in
browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
--- a/browser/components/sessionstore/test/Makefile.in
+++ b/browser/components/sessionstore/test/Makefile.in
@@ -25,16 +25,17 @@ MOCHITEST_BROWSER_FILES = \
 	browser_dying_cache.js \
 	browser_form_restore_events.js \
 	browser_form_restore_events_sample.html \
 	browser_formdata_format.js \
 	browser_formdata_format_sample.html \
 	browser_input.js \
 	browser_input_sample.html \
 	browser_pageshow.js \
+	browser_windowRestore_perwindowpb.js \
 	browser_248970_b_perwindowpb.js \
 	browser_248970_b_sample.html \
 	browser_339445.js \
 	browser_339445_sample.html \
 	browser_345898.js \
 	browser_346337.js \
 	browser_346337_sample.html \
 	browser_350525.js \
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This test checks that closed private windows can't be restored
+
+function test() {
+  waitForExplicitFinish();
+
+  // Purging the list of closed windows
+  while(ss.getClosedWindowCount() > 0)
+    ss.forgetClosedWindow(0);
+
+  // Load a private window, then close it 
+  // and verify it doesn't get remembered for restoring
+  var win = OpenBrowserWindow({private: true});
+
+  whenWindowLoaded(win, function onload() {
+    info("The private window got loaded");
+    win.addEventListener("SSWindowClosing", function onclosing() {
+      win.removeEventListener("SSWindowClosing", onclosing, false);
+      executeSoon(function () {
+        is (ss.getClosedWindowCount(), 0,
+            "The private window should not have been stored");
+        finish();
+      });
+    }, false);
+    win.close();
+  });
+}