Bug 1456725 - Tabs.jsm: Update documentURI in waitForCondition to handle not yet loaded tabs. r=Gijs
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 16 May 2019 00:29:14 +0000
changeset 535908 b8de4598780a6e000e3cd3b8fbde5ba3b972c492
parent 535907 317b7da2d8053c65bb905ab79f8226563b6538ca
child 535909 506667a67e0495fe6613e7e2404deb06f7bb6d4f
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1456725
milestone68.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 1456725 - Tabs.jsm: Update documentURI in waitForCondition to handle not yet loaded tabs. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D31340
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
@@ -144,26 +144,27 @@ async function allTabTitlesDisplayed(bro
     "about:privatebrowsing": "about:privatebrowsing",
   };
   specToTitleMap[PREFS_TAB] = "browser/skin/settings.svg";
   specToTitleMap[CUST_TAB] = "browser/skin/customize.svg";
   specToTitleMap[DEFAULT_FAVICON_TAB] = "No favicon";
 
   let tabTitlePromises = [];
   for (let tab of browserWindow.gBrowser.tabs) {
-    function tabTitleLoaded(spec) {
-      return () => {
-        return spec ? tab.label == specToTitleMap[spec] : false;
-      };
+    function getSpec() {
+      return tab.linkedBrowser &&
+             tab.linkedBrowser.documentURI &&
+             tab.linkedBrowser.documentURI.spec;
     }
-    let spec = tab.linkedBrowser &&
-               tab.linkedBrowser.documentURI &&
-               tab.linkedBrowser.documentURI.spec;
+    function tabTitleLoaded() {
+      let spec = getSpec();
+      return spec ? tab.label == specToTitleMap[spec] : false;
+    }
     let promise =
-      TestUtils.waitForCondition(tabTitleLoaded(spec), `Tab (${spec}) should be showing "${specToTitleMap[spec]}". Got "${tab.label}"`);
+      TestUtils.waitForCondition(tabTitleLoaded, `Tab (${getSpec()}) should be showing "${specToTitleMap[getSpec()]}". Got "${tab.label}"`);
     tabTitlePromises.push(promise);
   }
 
   return Promise.all(tabTitlePromises);
 }
 
 function fiveTabsHelper() {
   // some with no favicon and some with. Selected tab in middle.