Bug 1330822 - Remove CPOWs from customizableui/head.js. r=Gijs
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 12 Jan 2017 15:33:43 -0800
changeset 374993 79079769f4c9f345a8f7fdc6f878247135280e2c
parent 374992 46b7136b8790630322141034c03deb5bc51a1867
child 374994 21fd0eb4fa62eab86314598734eb2e2bff08c939
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1330822
milestone53.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 1330822 - Remove CPOWs from customizableui/head.js. r=Gijs MozReview-Commit-ID: eycB4S9ANq
browser/components/customizableui/test/head.js
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -358,39 +358,21 @@ function waitFor(aTimeout = 100) {
 /**
  * Starts a load in an existing tab and waits for it to finish (via some event).
  *
  * @param aTab       The tab to load into.
  * @param aUrl       The url to load.
  * @param aEventType The load event type to wait for.  Defaults to "load".
  * @return {Promise} resolved when the event is handled.
  */
-function promiseTabLoadEvent(aTab, aURL, aEventType = "load") {
-  let deferred = Promise.defer();
-  info("Wait for tab event: " + aEventType);
-
-  let timeoutId = setTimeout(() => {
-    aTab.linkedBrowser.removeEventListener(aEventType, onTabLoad, true);
-    deferred.reject("TabSelect did not happen within " + kTabEventFailureTimeoutInMs + "ms");
-  }, kTabEventFailureTimeoutInMs);
+function promiseTabLoadEvent(aTab, aURL) {
+  let browser = aTab.linkedBrowser;
 
-  function onTabLoad(event) {
-    if (event.originalTarget != aTab.linkedBrowser.contentDocument ||
-        event.target.location.href == "about:blank") {
-      info("skipping spurious load event");
-      return;
-    }
-    clearTimeout(timeoutId);
-    aTab.linkedBrowser.removeEventListener(aEventType, onTabLoad, true);
-    info("Tab event received: " + aEventType);
-    deferred.resolve();
-  }
-  aTab.linkedBrowser.addEventListener(aEventType, onTabLoad, true, true);
-  aTab.linkedBrowser.loadURI(aURL);
-  return deferred.promise;
+  BrowserTestUtils.loadURI(browser, aURL);
+  return BrowserTestUtils.browserLoaded(browser);
 }
 
 /**
  * Navigate back or forward in tab history and wait for it to finish.
  *
  * @param aDirection   Number to indicate to move backward or forward in history.
  * @param aConditionFn Function that returns the result of an evaluated condition
  *                     that needs to be `true` to resolve the promise.