Bug 1280079 - Make sure browser_privatebrowsing_newtab_from_popup.js accounts for initial browser remoteness flip when opening popup. r=mossop, a=test-only
authorMike Conley <mconley@mozilla.com>
Thu, 23 Mar 2017 13:49:41 -0400
changeset 379339 f7dd6b79aa87c6e048f0dabc7e3b7cf1fd350186
parent 379338 4ef92ba3208ec1f1265bca98dacc7eb21c3df705
child 379340 8bb9ee1f4d82b15808c0e60c76b8ce53d555c89e
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop, test-only
Bug 1280079 - Make sure browser_privatebrowsing_newtab_from_popup.js accounts for initial browser remoteness flip when opening popup. r=mossop, a=test-only During the test, we open a new window which loads a URL, and have code to wait for that initial browser to complete the load. For the initial browser, there is (when we open a remote-able URL), the remoteness of that initial browser flips from non-remote to remote. Sometimes, due to messaging / timing, the initial browser will send a message saying that a load completed for the initial about:blank before the URL we actually want is loaded. This causes the test to continue, and attempt to click on an element that isn't actually on the page yet. This modification allows us to wait for the initial browser to actually load the page that we care about before proceeding. I also changed some of the assertion messages to actually reflect what's being asserted, as opposed to reflecting what is being revealed if the assertion fails. MozReview-Commit-ID: 608SaA1nCVs
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newtab_from_popup.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newtab_from_popup.js
@@ -21,37 +21,37 @@ const WINDOW_BODY = `data:text/html,
                        First click this.
 add_task(function* test_private_popup_window_opens_private_tabs() {
   let privWin = yield BrowserTestUtils.openNewBrowserWindow({ private: true });
   // Sanity check - this browser better be private.
-     "Could not open a private browsing window.");
+     "Opened a private browsing window.");
   // First, open a private browsing window, and load our
   // testing page.
   let privBrowser = privWin.gBrowser.selectedBrowser;
   yield BrowserTestUtils.loadURI(privBrowser, WINDOW_BODY);
   yield BrowserTestUtils.browserLoaded(privBrowser);
   // Next, click on the link in the testing page, and ensure
   // that a private popup window is opened.
-  let openedPromise = BrowserTestUtils.waitForNewWindow();
+  let openedPromise = BrowserTestUtils.waitForNewWindow(true, POPUP_LINK);
   yield BrowserTestUtils.synthesizeMouseAtCenter("#first", {}, privBrowser);
   let popupWin = yield openedPromise;
-     "Popup window was not private.");
+     "Popup window was private.");
   // Now click on the link in the popup, and ensure that a new
   // tab is opened in the original private browsing window.
   let newTabPromise = BrowserTestUtils.waitForNewTab(privWin.gBrowser);
   let popupBrowser = popupWin.gBrowser.selectedBrowser;
-  yield BrowserTestUtils.browserLoaded(popupBrowser);
   yield BrowserTestUtils.synthesizeMouseAtCenter("#second", {}, popupBrowser);
   let newPrivTab = yield newTabPromise;
   // Ensure that the newly created tab's browser is private.
      "Newly opened tab should be private.");
   // Clean up