Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js; r=mconley
authorSteven MacLeod <smacleod@mozilla.com>
Wed, 11 Feb 2015 16:46:43 -0500
changeset 233816 8c349714246d33d6179544822298f150f6c55d85
parent 233815 bb14b5ecea678dd87cb055d99d7db753cc39f9f8
child 233817 b6d4485350048d715e8586fe23a77413ca70ee5d
push id28425
push usercbook@mozilla.com
push dateTue, 17 Mar 2015 10:33:06 +0000
treeherdermozilla-central@a194e8023090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1132566, 1142678
milestone39.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 1132566 - Make test e10s compatible: browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js; r=mconley The new version which is e10s compatible has been completely disabled though because of leaks in non-e10s test runs (see Bug 1142678). The old non-e10s compatible test has been renamed to browser_privatebrowsing_aboutHomeButtonAfterWindowClose_old.js and is still enabled until Bug 1142678 is fixed to maintain the test coverage.
browser/components/privatebrowsing/test/browser/browser.ini
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose_old.js
--- a/browser/components/privatebrowsing/test/browser/browser.ini
+++ b/browser/components/privatebrowsing/test/browser/browser.ini
@@ -13,16 +13,18 @@ support-files =
   browser_privatebrowsing_windowtitle_page.html
   head.js
   popup.html
   title.sjs
 
 [browser_privatebrowsing_DownloadLastDirWithCPS.js]
 skip-if = e10s
 [browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js]
+skip-if = true # Bug 1142678 - Loading a message sending frame script into a private about:home tab causes leaks
+[browser_privatebrowsing_aboutHomeButtonAfterWindowClose_old.js]
 skip-if = e10s
 [browser_privatebrowsing_aboutSessionRestore.js]
 skip-if = e10s
 [browser_privatebrowsing_cache.js]
 skip-if = e10s
 [browser_privatebrowsing_certexceptionsui.js]
 skip-if = e10s
 [browser_privatebrowsing_concurrent.js]
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js
@@ -1,50 +1,26 @@
 /* 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 the Session Restore about:home button
-// is disabled in private mode
+// This test checks that the Session Restore "Restore Previous Session"
+// button on about:home is disabled in private mode
+add_task(function* test_no_sessionrestore_button() {
+  // Opening, then closing, a private window shouldn't create session data.
+  (yield BrowserTestUtils.openNewBrowserWindow({private: true})).close();
 
-function test() {
-  waitForExplicitFinish();
+  let win = yield BrowserTestUtils.openNewBrowserWindow({private: true});
+  let tab = win.gBrowser.addTab("about:home");
+  let browser = tab.linkedBrowser;
 
-  function testNoSessionRestoreButton() {
-    let win = OpenBrowserWindow({private: true});
-    win.addEventListener("load", function onLoad() {
-      win.removeEventListener("load", onLoad, false);
-      executeSoon(function() {
-        info("The second private window got loaded");
-        let newTab = win.gBrowser.addTab();
-        win.gBrowser.selectedTab = newTab;
-        let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
-        tabBrowser.addEventListener("load", function tabLoadListener() {
-          if (win.content.location != "about:home") {
-            win.content.location = "about:home";
-            return;
-          }
-          tabBrowser.removeEventListener("load", tabLoadListener, true);
-          executeSoon(function() {
-            info("about:home got loaded");
-            let sessionRestoreButton = win.gBrowser
-                                          .contentDocument
-                                          .getElementById("restorePreviousSession");
-            is(win.getComputedStyle(sessionRestoreButton).display, 
-               "none", "The Session Restore about:home button should be disabled");
-            win.close();
-            finish();
-          });
-        }, true);
-      });
-    }, false);
-  }
+  yield BrowserTestUtils.browserLoaded(browser);
 
-  let win = OpenBrowserWindow({private: true});
-  win.addEventListener("load", function onload() {
-    win.removeEventListener("load", onload, false);
-    executeSoon(function() {
-      info("The first private window got loaded");
-      win.close();
-      testNoSessionRestoreButton();
-    });
-  }, false);
-}
+  let display = yield ContentTask.spawn(browser, {}, function* (){
+    let button = content.document.getElementById("restorePreviousSession");
+    return content.getComputedStyle(button).display;
+  });
+
+  is(display, "none",
+    "The Session Restore about:home button should be disabled");
+
+  win.close();
+});
new file mode 100644
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose_old.js
@@ -0,0 +1,50 @@
+/* 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 the Session Restore about:home button
+// is disabled in private mode
+
+function test() {
+  waitForExplicitFinish();
+
+  function testNoSessionRestoreButton() {
+    let win = OpenBrowserWindow({private: true});
+    win.addEventListener("load", function onLoad() {
+      win.removeEventListener("load", onLoad, false);
+      executeSoon(function() {
+        info("The second private window got loaded");
+        let newTab = win.gBrowser.addTab();
+        win.gBrowser.selectedTab = newTab;
+        let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
+        tabBrowser.addEventListener("load", function tabLoadListener() {
+          if (win.content.location != "about:home") {
+            win.content.location = "about:home";
+            return;
+          }
+          tabBrowser.removeEventListener("load", tabLoadListener, true);
+          executeSoon(function() {
+            info("about:home got loaded");
+            let sessionRestoreButton = win.gBrowser
+                                          .contentDocument
+                                          .getElementById("restorePreviousSession");
+            is(win.getComputedStyle(sessionRestoreButton).display, 
+               "none", "The Session Restore about:home button should be disabled");
+            win.close();
+            finish();
+          });
+        }, true);
+      });
+    }, false);
+  }
+
+  let win = OpenBrowserWindow({private: true});
+  win.addEventListener("load", function onload() {
+    win.removeEventListener("load", onload, false);
+    executeSoon(function() {
+      info("The first private window got loaded");
+      win.close();
+      testNoSessionRestoreButton();
+    });
+  }, false);
+}