Backed out changeset ba2692e1cbcf (bug 1252376) due to intermittent leaks.
authorMike de Boer <mdeboer@mozilla.com>
Wed, 30 Nov 2016 11:31:44 +0100
changeset 369696 13736e2db6eb94b02dd28cc88f2943b8109aa374
parent 369695 a69583d2dbc6fdc18f63761a89cf539c356668be
child 369735 3b3a1f1c4b9ba4889d2921a4e23b305340e2e5f9
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1252376
milestone53.0a1
backs outba2692e1cbcf1e2362b01d282eb3de0ed5e00004
first release with
nightly linux32
13736e2db6eb / 53.0a1 / 20161130030206 / files
nightly linux64
13736e2db6eb / 53.0a1 / 20161130030206 / files
nightly mac
13736e2db6eb / 53.0a1 / 20161130030206 / files
nightly win32
13736e2db6eb / 53.0a1 / 20161130030206 / files
nightly win64
13736e2db6eb / 53.0a1 / 20161130030206 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset ba2692e1cbcf (bug 1252376) due to intermittent leaks. MozReview-Commit-ID: IPFyfMhhLhv
browser/components/sessionstore/test/browser_privatetabs.js
browser/components/sessionstore/test/head.js
toolkit/modules/PrivateBrowsingUtils.jsm
--- a/browser/components/sessionstore/test/browser_privatetabs.js
+++ b/browser/components/sessionstore/test/browser_privatetabs.js
@@ -10,85 +10,90 @@ add_task(function cleanup() {
 
 add_task(function() {
   let URL_PUBLIC = "http://example.com/public/" + Math.random();
   let URL_PRIVATE = "http://example.com/private/" + Math.random();
   let tab1, tab2;
   try {
     // Setup a public tab and a private tab
     info("Setting up public tab");
-    tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, URL_PUBLIC);
+    tab1 = gBrowser.addTab(URL_PUBLIC);
+    yield promiseBrowserLoaded(tab1.linkedBrowser);
 
     info("Setting up private tab");
-    tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser);
+    tab2 = gBrowser.addTab();
+    yield promiseBrowserLoaded(tab2.linkedBrowser);
     yield setUsePrivateBrowsing(tab2.linkedBrowser, true);
     tab2.linkedBrowser.loadURI(URL_PRIVATE);
-    yield BrowserTestUtils.browserLoaded(tab2.linkedBrowser, false, URL_PRIVATE);
+    yield promiseBrowserLoaded(tab2.linkedBrowser);
 
     info("Flush to make sure chrome received all data.");
     yield TabStateFlusher.flush(tab1.linkedBrowser);
     yield TabStateFlusher.flush(tab2.linkedBrowser);
 
     info("Checking out state");
     let state = yield promiseRecoveryFileContents();
 
+    info("State: " + state);
     // Ensure that sessionstore.js only knows about the public tab
     ok(state.indexOf(URL_PUBLIC) != -1, "State contains public tab");
     ok(state.indexOf(URL_PRIVATE) == -1, "State does not contain private tab");
 
     // Ensure that we can close and undo close the public tab but not the private tab
-    yield BrowserTestUtils.removeTab(tab2);
+    gBrowser.removeTab(tab2);
     tab2 = null;
 
-    yield BrowserTestUtils.removeTab(tab1);
+    gBrowser.removeTab(tab1);
     tab1 = null;
 
     tab1 = ss.undoCloseTab(window, 0);
     ok(true, "Public tab supports undo close");
 
     is(ss.getClosedTabCount(window), 0, "Private tab does not support undo close");
 
   } finally {
     if (tab1) {
-      yield BrowserTestUtils.removeTab(tab1);
+      gBrowser.removeTab(tab1);
     }
     if (tab2) {
-      yield BrowserTestUtils.removeTab(tab2);
+      gBrowser.removeTab(tab2);
     }
   }
 });
 
 add_task(function () {
   const FRAME_SCRIPT = "data:," +
     "docShell.QueryInterface%28Components.interfaces.nsILoadContext%29.usePrivateBrowsing%3Dtrue";
 
   // Clear the list of closed windows.
   forgetClosedWindows();
 
   // Create a new window to attach our frame script to.
-  let win = yield BrowserTestUtils.openNewBrowserWindow();
+  let win = yield promiseNewWindowLoaded();
   let mm = win.getGroupMessageManager("browsers");
   mm.loadFrameScript(FRAME_SCRIPT, true);
 
   // Create a new tab in the new window that will load the frame script.
-  let tab = yield BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:mozilla");
+  let tab = win.gBrowser.addTab("about:mozilla");
   let browser = tab.linkedBrowser;
+  yield promiseBrowserLoaded(browser);
   yield TabStateFlusher.flush(browser);
 
   // Check that we consider the tab as private.
   let state = JSON.parse(ss.getTabState(tab));
   ok(state.isPrivate, "tab considered private");
 
   // Ensure we don't allow restoring closed private tabs in non-private windows.
-  yield BrowserTestUtils.removeTab(tab);
+  win.gBrowser.removeTab(tab);
   is(ss.getClosedTabCount(win), 0, "no tabs to restore");
 
   // Create a new tab in the new window that will load the frame script.
-  tab = yield BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:mozilla");
+  tab = win.gBrowser.addTab("about:mozilla");
   browser = tab.linkedBrowser;
+  yield promiseBrowserLoaded(browser);
   yield TabStateFlusher.flush(browser);
 
   // Check that we consider the tab as private.
   state = JSON.parse(ss.getTabState(tab));
   ok(state.isPrivate, "tab considered private");
 
   // Check that all private tabs are removed when the non-private
   // window is closed and we don't save windows without any tabs.
@@ -96,29 +101,30 @@ add_task(function () {
   is(ss.getClosedWindowCount(), 0, "no windows to restore");
 });
 
 add_task(function () {
   // Clear the list of closed windows.
   forgetClosedWindows();
 
   // Create a new window to attach our frame script to.
-  let win = yield BrowserTestUtils.openNewBrowserWindow({private: true});
+  let win = yield promiseNewWindowLoaded({private: true});
 
   // Create a new tab in the new window that will load the frame script.
-  let tab = yield BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:mozilla");
+  let tab = win.gBrowser.addTab("about:mozilla");
   let browser = tab.linkedBrowser;
+  yield promiseBrowserLoaded(browser);
   yield TabStateFlusher.flush(browser);
 
   // Check that we consider the tab as private.
   let state = JSON.parse(ss.getTabState(tab));
   ok(state.isPrivate, "tab considered private");
 
   // Ensure that closed tabs in a private windows can be restored.
-  yield BrowserTestUtils.removeTab(tab);
+  win.gBrowser.removeTab(tab);
   is(ss.getClosedTabCount(win), 1, "there is a single tab to restore");
 
   // Ensure that closed private windows can never be restored.
   yield BrowserTestUtils.closeWindow(win);
   is(ss.getClosedWindowCount(), 0, "no windows to restore");
 });
 
 function setUsePrivateBrowsing(browser, val) {
--- a/browser/components/sessionstore/test/head.js
+++ b/browser/components/sessionstore/test/head.js
@@ -18,20 +18,16 @@ var mm = Cc["@mozilla.org/globalmessagem
 for (let script of FRAME_SCRIPTS) {
   mm.loadFrameScript(script, true);
 }
 
 registerCleanupFunction(() => {
   for (let script of FRAME_SCRIPTS) {
     mm.removeDelayedFrameScript(script, true);
   }
-
-  // Force a garbage collect after the end of each test run, to make sure that it
-  // won't interfere with the timing of the next test to be run from the suite.
-  window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).garbageCollect();
 });
 
 const {Promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
 const {SessionStore} = Cu.import("resource:///modules/sessionstore/SessionStore.jsm", {});
 const {SessionSaver} = Cu.import("resource:///modules/sessionstore/SessionSaver.jsm", {});
 const {SessionFile} = Cu.import("resource:///modules/sessionstore/SessionFile.jsm", {});
 const {TabState} = Cu.import("resource:///modules/sessionstore/TabState.jsm", {});
 const {TabStateFlusher} = Cu.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
--- a/toolkit/modules/PrivateBrowsingUtils.jsm
+++ b/toolkit/modules/PrivateBrowsingUtils.jsm
@@ -1,29 +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.EXPORTED_SYMBOLS = ["PrivateBrowsingUtils"];
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
 
 const kAutoStartPref = "browser.privatebrowsing.autostart";
 
 // This will be set to true when the PB mode is autostarted from the command
 // line for the current session.
 var gTemporaryAutoStartMode = false;
 
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
 this.PrivateBrowsingUtils = {
   // Rather than passing content windows to this function, please use
   // isBrowserPrivate since it works with e10s.
   isWindowPrivate: function pbu_isWindowPrivate(aWindow) {
-    if (!(aWindow instanceof Ci.nsIDOMChromeWindow)) {
+    if (!(aWindow instanceof Components.interfaces.nsIDOMChromeWindow)) {
       dump("WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. " +
            "Use isContentWindowPrivate instead (but only for frame scripts).\n"
            + new Error().stack);
     }
 
     return this.privacyContextFromWindow(aWindow).usePrivateBrowsing;
   },
 
@@ -39,25 +40,19 @@ this.PrivateBrowsingUtils = {
       // browsing status since the only alternative is to check the
       // content window, which is in another process.
       return this.isWindowPrivate(chromeWin);
     }
     return this.privacyContextFromWindow(aBrowser.contentWindow).usePrivateBrowsing;
   },
 
   privacyContextFromWindow: function pbu_privacyContextFromWindow(aWindow) {
-    let context = { usePrivateBrowsing: false };
-    try {
-      context = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                       .getInterface(Ci.nsIWebNavigation)
-                       .QueryInterface(Ci.nsILoadContext);
-    } catch (ex) {
-      Cu.reportError(ex);
-    }
-    return context;
+    return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+                  .getInterface(Ci.nsIWebNavigation)
+                  .QueryInterface(Ci.nsILoadContext);
   },
 
   addToTrackingAllowlist(aURI) {
     let pbmtpWhitelist = Cc["@mozilla.org/pbm-tp-whitelist;1"]
                            .getService(Ci.nsIPrivateBrowsingTrackingProtectionWhitelist);
     pbmtpWhitelist.addToAllowList(aURI);
   },
 
@@ -81,17 +76,17 @@ this.PrivateBrowsingUtils = {
   enterTemporaryAutoStartMode: function pbu_enterTemporaryAutoStartMode() {
     gTemporaryAutoStartMode = true;
   },
   get isInTemporaryAutoStartMode() {
     return gTemporaryAutoStartMode;
   },
 
   whenHiddenPrivateWindowReady: function pbu_whenHiddenPrivateWindowReady(cb) {
-    Cu.import("resource://gre/modules/Timer.jsm");
+    Components.utils.import("resource://gre/modules/Timer.jsm");
 
     let win = Services.appShell.hiddenPrivateDOMWindow;
     function isNotLoaded() {
       return ["complete", "interactive"].indexOf(win.document.readyState) == -1;
     }
     if (isNotLoaded()) {
       setTimeout(function poll() {
         if (isNotLoaded()) {