Bug 1196104 - Fix browser_UITour_heartbeat.js timeouts. a=test-only
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 31 Aug 2015 12:27:52 -0400
changeset 289043 5920e490543e2f085f154452f384b33afc72aeea
parent 289042 214492ce42671d8f698836d8d4f499e105d7d2b0
child 289044 0f8540c2a9d9ce0058e2107746e697c5f04bdd71
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only
bugs1196104
milestone42.0a2
Bug 1196104 - Fix browser_UITour_heartbeat.js timeouts. a=test-only
testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -156,30 +156,31 @@ this.BrowserTestUtils = {
   /**
    * Waits for the next tab to open and load a given URL.
    *
    * The method doesn't wait for the tab contents to load.
    *
    * @param {tabbrowser} tabbrowser
    *        The tabbrowser to look for the next new tab in.
    * @param {string} url
-   *        A string URL to look for in the new tab.
+   *        A string URL to look for in the new tab. If null, allows any non-blank URL.
    *
    * @return {Promise}
    * @resolves With the {xul:tab} when a tab is opened and its location changes to the given URL.
    */
   waitForNewTab(tabbrowser, url) {
     return new Promise((resolve, reject) => {
       tabbrowser.tabContainer.addEventListener("TabOpen", function onTabOpen(openEvent) {
         tabbrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
 
         let progressListener = {
           onLocationChange(aBrowser) {
             if (aBrowser != openEvent.target.linkedBrowser ||
-                aBrowser.currentURI.spec != url) {
+                (url && aBrowser.currentURI.spec != url) ||
+                (!url && aBrowser.currentURI.spec == "about:blank")) {
               return;
             }
 
             tabbrowser.removeTabsProgressListener(progressListener);
             resolve(openEvent.target);
           },
         };
         tabbrowser.addTabsProgressListener(progressListener);