Backed out changeset ba253783b432 (bug 1335801) for browser_referrer_simple_click.js failures a=backout CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Mon, 06 Mar 2017 15:30:03 -0800
changeset 346126 a1529d84ad24f8bae2849044b2ea7b88ba11c620
parent 346125 25f5d0648983899de6f0bed21f3c3c72e09e4867
child 346127 1465a237d393fe74b7268d5c5f546b178a3d6642
push id38422
push userkwierso@gmail.com
push dateMon, 06 Mar 2017 23:30:37 +0000
treeherderautoland@a1529d84ad24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1335801
milestone54.0a1
backs outba253783b4324a7c294f09539e1e1fad443d9f3e
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
Backed out changeset ba253783b432 (bug 1335801) for browser_referrer_simple_click.js failures a=backout CLOSED TREE MozReview-Commit-ID: 5jn0Okch3jt
browser/base/content/test/referrer/browser_referrer_open_link_in_private.js
browser/base/content/test/referrer/browser_referrer_open_link_in_window.js
browser/base/content/test/referrer/browser_referrer_open_link_in_window_in_container.js
browser/base/content/test/referrer/head.js
testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
--- a/browser/base/content/test/referrer/browser_referrer_open_link_in_private.js
+++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_private.js
@@ -1,17 +1,17 @@
 // Tests referrer on context menu navigation - open link in new private window.
 // Selects "open link in new private window" from the context menu.
 
 function startNewPrivateWindowTestCase(aTestNumber) {
   info("browser_referrer_open_link_in_private: " +
        getReferrerTestDescription(aTestNumber));
   contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
     newWindowOpened().then(function(aNewWindow) {
-      BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
+      someTabLoaded(aNewWindow).then(function() {
         checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
                                       startNewPrivateWindowTestCase);
       });
     });
 
     doContextMenuCommand(gTestWindow, aContextMenu, "context-openlinkprivate");
   });
 }
--- a/browser/base/content/test/referrer/browser_referrer_open_link_in_window.js
+++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_window.js
@@ -1,17 +1,17 @@
 // Tests referrer on context menu navigation - open link in new window.
 // Selects "open link in new window" from the context menu.
 
 function startNewWindowTestCase(aTestNumber) {
   info("browser_referrer_open_link_in_window: " +
        getReferrerTestDescription(aTestNumber));
   contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
     newWindowOpened().then(function(aNewWindow) {
-      BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
+      someTabLoaded(aNewWindow).then(function() {
         checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
                                       startNewWindowTestCase);
       });
     });
 
     doContextMenuCommand(gTestWindow, aContextMenu, "context-openlink");
   });
 }
--- a/browser/base/content/test/referrer/browser_referrer_open_link_in_window_in_container.js
+++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_window_in_container.js
@@ -4,17 +4,17 @@
 // This test runs from a container tab. The new tab/window will be loaded in
 // the same container.
 
 function startNewWindowTestCase(aTestNumber) {
   info("browser_referrer_open_link_in_window: " +
        getReferrerTestDescription(aTestNumber));
   contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
     newWindowOpened().then(function(aNewWindow) {
-      BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function() {
+      someTabLoaded(aNewWindow).then(function() {
         checkReferrerAndStartNextTest(aTestNumber, aNewWindow, null,
                                       startNewWindowTestCase,
                                       { userContextId: 1 });
       });
     });
 
     doContextMenuCommand(gTestWindow, aContextMenu, "context-openlink");
   });
--- a/browser/base/content/test/referrer/head.js
+++ b/browser/base/content/test/referrer/head.js
@@ -135,18 +135,28 @@ function delayedStartupFinished(aWindow)
 
 /**
  * Waits for some (any) tab to load. The caller triggers the load.
  * @param aWindow The window where to wait for a tab to load.
  * @return {Promise}
  * @resolves With the tab once it's loaded.
  */
 function someTabLoaded(aWindow) {
-  return BrowserTestUtils.waitForNewTab(gTestWindow.gBrowser).then((tab) => {
-    return BrowserTestUtils.browserStopped(tab.linkedBrowser).then(() => tab);
+  return new Promise(function(resolve) {
+    aWindow.gBrowser.addEventListener("load", function onLoad(aEvent) {
+      if (aWindow.location.href === "about:blank") {
+        return;
+      }
+      let tab = aWindow.gBrowser._getTabForContentWindow(
+          aEvent.target.defaultView.top);
+      if (tab) {
+        aWindow.gBrowser.removeEventListener("load", onLoad, true);
+        resolve(tab);
+      }
+    }, true);
   });
 }
 
 /**
  * Waits for a new window to open and load. The caller triggers the open.
  * @return {Promise}
  * @resolves With the new window once it's open and loaded.
  */
@@ -194,17 +204,17 @@ function referrerTestCaseLoaded(aTestNum
                              REFERRER_POLICYSERVER_URL_ATTRIBUTE;
   let url = test.fromScheme + server +
             "?scheme=" + escape(test.toScheme) +
             "&policy=" + escape(test.policy || "") +
             "&rel=" + escape(test.rel || "");
   let browser = gTestWindow.gBrowser;
   return BrowserTestUtils.openNewForegroundTab(browser, () => {
     browser.selectedTab = browser.addTab(url, aParams);
-  }, false, true);
+  });
 }
 
 /**
  * Checks the result of the referrer test, and moves on to the next test.
  * @param aTestNumber The test number - 0, 1, 2, ...
  * @param aNewWindow The new window where the referrer target opened, or null.
  * @param aNewTab The new tab where the referrer target opened, or null.
  * @param aStartTestCase The callback to start the next test, aTestNumber + 1.
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -221,22 +221,21 @@ this.BrowserTestUtils = {
    *
    * @param {win}
    *        A newly opened window for which we're waiting for the
    *        first browser load.
    *
    * @return {Promise}
    * @resolves Once the selected browser fires its load event.
    */
-  firstBrowserLoaded(win, aboutBlank = true) {
+  firstBrowserLoaded(win) {
     let mm = win.messageManager;
     return this.waitForMessage(mm, "browser-test-utils:loadEvent", (msg) => {
       let selectedBrowser = win.gBrowser.selectedBrowser;
-      return msg.target == selectedBrowser &&
-             (aboutBlank || selectedBrowser.currentURI.spec != "about:blank")
+      return msg.target == selectedBrowser;
     });
   },
 
   /**
    * Waits for the web progress listener associated with this tab to fire a
    * STATE_STOP for the toplevel document.
    *
    * @param {xul:browser} browser