Bug 1486824 - review comment follow-up: change params for openNewBrowserWindow to explicitly check for URL, r=nhnt11
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 03 Sep 2018 15:16:55 +0100
changeset 434478 c995c3a15034b631ccc7981b765f640f984a8209
parent 434477 c4b7704689846fb3684454872ea111d0a34eb1b8
child 434479 99e8a7cd7726e8611830e1051151ad94854a0f60
push id107389
push usergijskruitbosch@gmail.com
push dateMon, 03 Sep 2018 14:26:02 +0000
treeherdermozilla-inbound@c995c3a15034 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11
bugs1486824
milestone63.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 1486824 - review comment follow-up: change params for openNewBrowserWindow to explicitly check for URL, r=nhnt11
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
@@ -7,17 +7,17 @@ const CB_ENABLED_PREF = "browser.content
 const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled";
 
 /**
  * Opens a new private window and loads "about:privatebrowsing" there.
  */
 async function openAboutPrivateBrowsing() {
   let win = await BrowserTestUtils.openNewBrowserWindow({
     private: true,
-    waitForNonAboutBlankLoad: true,
+    waitForTabURL: "about:privatebrowsing",
   });
   let tab = win.gBrowser.selectedBrowser;
   return { win, tab };
 }
 
 /**
  * Clicks the given link and checks this opens a new tab with the given URI.
  */
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -705,19 +705,19 @@ var BrowserTestUtils = {
 
   /**
    * Open a new browser window from an existing one.
    * This relies on OpenBrowserWindow in browser.js, and waits for the window
    * to be completely loaded before resolving.
    *
    * @param {Object}
    *        Options to pass to OpenBrowserWindow. Additionally, supports:
-   *        - waitForNonAboutBlankLoad
+   *        - waitForTabURL
    *          Forces the initial browserLoaded check to wait for the tab to
-   *          load something other than about:blank.
+   *          load the given URL (instead of about:blank)
    *
    * @return {Promise}
    *         Resolves with the new window once it is loaded.
    */
   async openNewBrowserWindow(options = {}) {
     let currentWin = BrowserWindowTracker.getTopWindow({private: false});
     if (!currentWin) {
       throw new Error("Can't open a new browser window from this helper if no non-private window is open.");
@@ -726,17 +726,19 @@ var BrowserTestUtils = {
 
     // Wait for browser-delayed-startup-finished notification, it indicates
     // that the window has loaded completely and is ready to be used for
     // testing.
     let startupPromise =
       TestUtils.topicObserved("browser-delayed-startup-finished",
                               subject => subject == win).then(() => win);
 
-    let loadPromise = this.firstBrowserLoaded(win, !options.waitForNonAboutBlankLoad);
+    let loadPromise = this.firstBrowserLoaded(win, !options.waitForTabURL, browser => {
+      return !options.waitForTabURL || options.waitForTabURL == browser.currentURI.spec;
+    });
 
     await startupPromise;
     await loadPromise;
 
     return win;
   },
 
   /**