Bug 989137 - Backout re-ordered patches that conflict with a known-good patch stack: 1ab6bbd62c76, 5c3a195a107e, 73da7e611e92, 2c1a0b0551fb. r=me
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Thu, 17 Apr 2014 15:47:36 +0200
changeset 179055 b960c2026325596fe588bc8ff7666ca588298aab
parent 179054 e73e1719edcbd0a0a66c30d73ce31d4748938d72
child 179056 cb9a5809f6737c3ce4a0f1d63adf93b9f4aaac89
push id26606
push userryanvm@gmail.com
push dateFri, 18 Apr 2014 02:20:00 +0000
treeherdermozilla-central@ec728bfdbb79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs989137
milestone31.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 989137 - Backout re-ordered patches that conflict with a known-good patch stack: 1ab6bbd62c76, 5c3a195a107e, 73da7e611e92, 2c1a0b0551fb. r=me
browser/experiments/Experiments.jsm
browser/experiments/test/xpcshell/test_activate.js
browser/experiments/test/xpcshell/test_api.js
toolkit/mozapps/extensions/test/browser/browser_experiments.js
toolkit/mozapps/extensions/test/browser/head.js
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -247,20 +247,16 @@ let Experiments = {
  * The policy object allows us to inject fake enviroment data from the
  * outside by monkey-patching.
  */
 
 Experiments.Policy = function () {
   this._log = Log.repository.getLoggerWithMessagePrefix(
     "Browser.Experiments.Policy",
     "Policy #" + gPolicyCounter++ + "::");
-
-  // Set to true to ignore hash verification on downloaded XPIs. This should
-  // not be used outside of testing.
-  this.ignoreHashes = false;
 };
 
 Experiments.Policy.prototype = {
   now: function () {
     return new Date();
   },
 
   random: function () {
@@ -371,34 +367,29 @@ Experiments.Experiments.prototype = {
     gPrefs.observe(PREF_MANIFEST_URI, this.updateManifest, this);
     gPrefs.observe(PREF_ENABLED, this._toggleExperimentsEnabled, this);
 
     gPrefsTelemetry.observe(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
 
     AsyncShutdown.profileBeforeChange.addBlocker("Experiments.jsm shutdown",
       this.uninit.bind(this));
 
-    this._registerWithAddonManager();
+    this._startWatchingAddons();
 
-    let deferred = Promise.defer();
-
-    this._loadTask = this._loadFromCache();
+    this._loadTask = Task.spawn(this._loadFromCache.bind(this));
     this._loadTask.then(
       () => {
         this._log.trace("_loadTask finished ok");
         this._loadTask = null;
-        this._run().then(deferred.resolve, deferred.reject);
+        this._run();
       },
       (e) => {
         this._log.error("_loadFromCache caught error: " + e);
-        deferred.reject(e);
       }
     );
-
-    return deferred.promise;
   },
 
   /**
    * Uninitialize this instance.
    *
    * This function is susceptible to race conditions. If it is called multiple
    * times before the previous uninit() has completed or if it is called while
    * an init() operation is being performed, the object may get in bad state
@@ -406,17 +397,17 @@ Experiments.Experiments.prototype = {
    *
    * @return Promise<>
    *         The promise is fulfilled when all pending tasks are finished.
    */
   uninit: Task.async(function* () {
     yield this._loadTask;
 
     if (!this._shutdown) {
-      this._unregisterWithAddonManager();
+      this._stopWatchingAddons();
 
       gPrefs.ignore(PREF_LOGGING, configureLogging);
       gPrefs.ignore(PREF_MANIFEST_URI, this.updateManifest, this);
       gPrefs.ignore(PREF_ENABLED, this._toggleExperimentsEnabled, this);
 
       gPrefsTelemetry.ignore(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
 
       if (this._timer) {
@@ -427,24 +418,22 @@ Experiments.Experiments.prototype = {
     this._shutdown = true;
     if (this._mainTask) {
       yield this._mainTask;
     }
 
     this._log.info("Completed uninitialization.");
   }),
 
-  _registerWithAddonManager: function () {
-    this._log.trace("Registering instance with Addon Manager.");
-
+  _startWatchingAddons: function () {
     AddonManager.addAddonListener(this);
     AddonManager.addInstallListener(this);
   },
 
-  _unregisterWithAddonManager: function () {
+  _stopWatchingAddons: function () {
     AddonManager.removeInstallListener(this);
     AddonManager.removeAddonListener(this);
   },
 
   /**
    * Throws an exception if we've already shut down.
    */
   _checkForShutdown: function() {
@@ -818,27 +807,27 @@ Experiments.Experiments.prototype = {
     yield OS.File.writeAtomic(path, data, options);
     this._dirty = false;
     this._log.debug("_saveToCache saved to " + path);
   },
 
   /*
    * Task function, load the cached experiments manifest file from disk.
    */
-  _loadFromCache: Task.async(function* () {
+  _loadFromCache: function*() {
     this._log.trace("_loadFromCache");
     let path = this._cacheFilePath;
     try {
       let result = yield loadJSONAsync(path, { compression: "lz4" });
       this._populateFromCache(result);
     } catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) {
       // No cached manifest yet.
       this._experiments = new Map();
     }
-  }),
+  },
 
   _populateFromCache: function (data) {
     this._log.trace("populateFromCache() - data: " + JSON.stringify(data));
 
     // If the user has a newer cache version than we can understand, we fail
     // hard; no experiments should be active in this older client.
     if (CACHE_VERSION !== data.version) {
       throw new Error("Experiments::_populateFromCache() - invalid cache version");
@@ -1504,19 +1493,18 @@ Experiments.ExperimentEntry.prototype = 
       gPrefs.set(PREF_ACTIVE_EXPERIMENT, true);
     }.bind(this));
   },
 
   // Async install of the addon for this experiment, part of the start task above.
   _installAddon: function* () {
     let deferred = Promise.defer();
 
-    let hash = this._policy.ignoreHashes ? null : this._manifestData.xpiHash;
-
-    let install = yield addonInstallForURL(this._manifestData.xpiURL, hash);
+    let install = yield addonInstallForURL(this._manifestData.xpiURL,
+                                           this._manifestData.xpiHash);
     gActiveInstallURLs.add(install.sourceURI.spec);
 
     let failureHandler = (install, handler) => {
       let message = "AddonInstall " + handler + " for " + this.id + ", state=" +
                    (install.state || "?") + ", error=" + install.error;
       this._log.error("_installAddon() - " + message);
       this._failedStart = true;
       gActiveInstallURLs.delete(install.sourceURI.spec);
--- a/browser/experiments/test/xpcshell/test_activate.js
+++ b/browser/experiments/test/xpcshell/test_activate.js
@@ -135,28 +135,9 @@ add_task(function* test_startStop() {
   defineNow(gPolicy, futureDate(endDate, MS_IN_ONE_DAY));
   result = yield experiment._shouldStop();
   Assert.equal(result.shouldStop, true, "shouldStop should now be true.");
   maybeStop = yield experiment.maybeStop();
   Assert.equal(maybeStop, true, "Experiment should have been stopped.");
   Assert.equal(experiment.enabled, false, "Experiment should be disabled.");
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 0, "Experiment add-on is uninstalled.");
-
-  // Ensure hash validation works.
-  // We set an incorrect hash and expect the install to fail.
-  experiment._manifestData.xpiHash = "sha1:41014dcc66b4dcedcd973491a1530a32f0517d8a";
-  let errored = false;
-  try {
-    yield experiment.start();
-  } catch (ex) {
-    errored = true;
-  }
-  Assert.ok(experiment._failedStart, "Experiment failed to start.");
-  Assert.ok(errored, "start() threw an exception.");
-
-  // Make sure "ignore hashes" mode works.
-  gPolicy.ignoreHashes = true;
-  let changes = yield experiment.start();
-  Assert.equal(changes, experiment.ADDON_CHANGE_INSTALL);
-  yield experiment.stop();
-  gPolicy.ignoreHashes = false;
 });
--- a/browser/experiments/test/xpcshell/test_api.js
+++ b/browser/experiments/test/xpcshell/test_api.js
@@ -1361,19 +1361,19 @@ add_task(function* test_unexpectedUninst
 // uninstalled.
 add_task(function* testUnknownExperimentsUninstalled() {
   let experiments = new Experiments.Experiments(gPolicy);
 
   let addons = yield getExperimentAddons();
   Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are present.");
 
   // Simulate us not listening.
-  experiments._unregisterWithAddonManager();
+  experiments._stopWatchingAddons();
   yield AddonTestUtils.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
-  experiments._registerWithAddonManager();
+  experiments._startWatchingAddons();
 
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 1, "Experiment 1 installed via AddonManager");
 
   // Simulate no known experiments.
   gManifestObject = {
     "version": 1,
     experiments: [],
@@ -1447,19 +1447,19 @@ add_task(function* testEnabledAfterResta
   let fromManifest = yield experiments.getExperiments();
   Assert.equal(fromManifest.length, 1, "A single experiment is known.");
 
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
   Assert.ok(addons[0].isActive, "That experiment is active.");
 
   dump("Restarting Addon Manager\n");
-  experiments._unregisterWithAddonManager();
+  experiments._stopWatchingAddons();
   restartManager();
-  experiments._registerWithAddonManager();
+  experiments._startWatchingAddons();
 
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 1, "The experiment is still there after restart.");
   Assert.ok(addons[0].userDisabled, "But it is disabled.");
   Assert.equal(addons[0].isActive, false, "And not active.");
 
   yield experiments.updateManifest();
   Assert.ok(addons[0].isActive, "It activates when the manifest is evaluated.");
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
@@ -2,155 +2,174 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 let gManagerWindow;
 let gCategoryUtilities;
 let gInstalledAddons = [];
 let gContext = this;
 
-add_task(function* initializeState() {
-  gManagerWindow = yield open_manager();
-  gCategoryUtilities = new CategoryUtilities(gManagerWindow);
+function test() {
+  waitForExplicitFinish();
+
+  open_manager(null, (win) => {
+    gManagerWindow = win;
+    gCategoryUtilities = new CategoryUtilities(win);
+
+    // The Experiments Manager will interfere with us by preventing installs
+    // of experiments it doesn't know about. We remove it from the equation
+    // because here we are only concerned with core Addon Manager operation,
+    // not the superset Experiments Manager has imposed.
+    if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
+      Components.utils.import("resource:///modules/experiments/Experiments.jsm", gContext);
 
-  // The Experiments Manager will interfere with us by preventing installs
-  // of experiments it doesn't know about. We remove it from the equation
-  // because here we are only concerned with core Addon Manager operation,
-  // not the superset Experiments Manager has imposed.
-  if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
-    Components.utils.import("resource:///modules/experiments/Experiments.jsm", gContext);
+      // There is a race condition between XPCOM service initialization and
+      // this test running. We have to initialize the instance first, then
+      // uninitialize it to prevent this.
+      let instance = gContext.Experiments.instance();
+      instance.uninit().then(run_next_test);
+    } else {
+      run_next_test();
+    }
+  });
+}
 
-    // There is a race condition between XPCOM service initialization and
-    // this test running. We have to initialize the instance first, then
-    // uninitialize it to prevent this.
-    let instance = gContext.Experiments.instance();
-    yield instance.uninit();
+function end_test() {
+  for (let addon of gInstalledAddons) {
+    addon.uninstall();
   }
-});
+
+  close_manager(gManagerWindow, () => {
+    if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
+      gContext.Experiments.instance().init();
+      finish();
+    } else {
+      finish();
+    }
+  });
+}
 
 // On an empty profile with no experiments, the experiment category
 // should be hidden.
-add_task(function* testInitialState() {
+add_test(function testInitialState() {
   Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
 
   Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
+
+  run_next_test();
 });
 
-add_task(function* testExperimentInfoNotVisible() {
-  yield gCategoryUtilities.openType("extension");
-  let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
-  is_element_hidden(el, "Experiment info not visible on other types.");
+add_test(function testExperimentInfoNotVisible() {
+  gCategoryUtilities.openType("extension", () => {
+    let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
+    is_element_hidden(el, "Experiment info not visible on other types.");
+
+    run_next_test();
+  });
 });
 
 // If we have an active experiment, we should see the experiments tab
 // and that tab should have some messages.
-add_task(function* testActiveExperiment() {
-  let addon = yield install_addon("addons/browser_experiment1.xpi");
-  gInstalledAddons.push(addon);
+add_test(function testActiveExperiment() {
+  install_addon("addons/browser_experiment1.xpi", (addon) => {
+    gInstalledAddons.push(addon);
+
+    Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
+    Assert.equal(addon.isActive, false, "Add-on is not active.");
 
-  Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
-  Assert.equal(addon.isActive, false, "Add-on is not active.");
+    Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
 
-  Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
+    gCategoryUtilities.openType("experiment", (win) => {
+      let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
+      is_element_visible(el, "Experiment info is visible on experiment tab.");
 
-  yield gCategoryUtilities.openType("experiment");
-  let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
-  is_element_visible(el, "Experiment info is visible on experiment tab.");
+      run_next_test();
+    });
+  });
 });
 
-add_task(function* testExperimentLearnMore() {
+add_test(function testExperimentLearnMore() {
   // Actual URL is irrelevant.
   Services.prefs.setCharPref("toolkit.telemetry.infoURL",
                              "http://mochi.test:8888/server.js");
 
-  yield gCategoryUtilities.openType("experiment");
-  let btn = gManagerWindow.document.getElementById("experiments-learn-more");
+  gCategoryUtilities.openType("experiment", (win) => {
+    let btn = gManagerWindow.document.getElementById("experiments-learn-more");
 
-  if (!gUseInContentUI) {
-    is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
-    Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
+    if (!gUseInContentUI) {
+      is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
+      Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
 
-    return;
-  }
-
-  is_element_visible(btn, "Learn more button visible.");
+      run_next_test();
+      return;
+    } else {
+      is_element_visible(btn, "Learn more button visible.");
+    }
 
-  let deferred = Promise.defer();
-  window.addEventListener("DOMContentLoaded", function onLoad(event) {
-    info("Telemetry privacy policy window opened.");
-    window.removeEventListener("DOMContentLoaded", onLoad, false);
+    window.addEventListener("DOMContentLoaded", function onLoad(event) {
+      info("Telemetry privacy policy window opened.");
+      window.removeEventListener("DOMContentLoaded", onLoad, false);
 
-    let browser = gBrowser.selectedTab.linkedBrowser;
-    let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
-    Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
-    browser.contentWindow.close();
+      let browser = gBrowser.selectedTab.linkedBrowser;
+      let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
+      Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
+      browser.contentWindow.close();
 
-    Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
-    deferred.resolve();
-  }, false);
+      Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
 
-  info("Opening telemetry privacy policy.");
-  EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
+      run_next_test();
+    }, false);
 
-  yield deferred.promise;
+    info("Opening telemetry privacy policy.");
+    EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
+  });
 });
 
-add_task(function* testOpenPreferences() {
-  yield gCategoryUtilities.openType("experiment");
-  let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
-  if (!gUseInContentUI) {
-    is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
-    info("Skipping preferences open test because not using in-content UI.");
-    return;
-  }
+add_test(function testOpenPreferences() {
+  gCategoryUtilities.openType("experiment", (win) => {
+    let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
+    if (!gUseInContentUI) {
+      is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
+      info("Skipping preferences open test because not using in-content UI.");
+      run_next_test();
+      return;
+    }
 
-  is_element_visible(btn, "Change telemetry button visible in in-content UI.");
+    is_element_visible(btn, "Change telemetry button visible in in-content UI.");
 
-  let deferred = Promise.defer();
-  Services.obs.addObserver(function observer(prefWin, topic, data) {
-    Services.obs.removeObserver(observer, "advanced-pane-loaded");
+    Services.obs.addObserver(function observer(prefWin, topic, data) {
+      Services.obs.removeObserver(observer, "advanced-pane-loaded");
 
-    info("Advanced preference pane opened.");
+      info("Advanced preference pane opened.");
 
-    // We want this test to fail if the preferences pane changes.
-    let el = prefWin.document.getElementById("dataChoicesPanel");
-    is_element_visible(el);
+      // We want this test to fail if the preferences pane changes.
+      let el = prefWin.document.getElementById("dataChoicesPanel");
+      is_element_visible(el);
 
-    prefWin.close();
-    info("Closed preferences pane.");
+      prefWin.close();
+      info("Closed preferences pane.");
 
-    deferred.resolve();
-  }, "advanced-pane-loaded", false);
+      run_next_test();
+    }, "advanced-pane-loaded", false);
 
-  info("Loading preferences pane.");
-  EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
-  yield deferred.promise;
+    info("Loading preferences pane.");
+    EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
+  });
 });
 
-add_task(function* testButtonPresence() {
-  yield gCategoryUtilities.openType("experiment");
-  let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
-  Assert.ok(item, "Got add-on element.");
+add_test(function testButtonPresence() {
+  gCategoryUtilities.openType("experiment", (win) => {
+    let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
+    Assert.ok(item, "Got add-on element.");
 
-  let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
-  // Corresponds to the uninstall permission.
-  is_element_visible(el, "Remove button is visible.");
-  // Corresponds to lack of disable permission.
-  el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
-  is_element_hidden(el, "Disable button not visible.");
-  // Corresponds to lack of enable permission.
-  el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
-  is_element_hidden(el, "Enable button not visible.");
-});
+    let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
+    // Corresponds to the uninstall permission.
+    is_element_visible(el, "Remove button is visible.");
+    // Corresponds to lack of disable permission.
+    el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
+    is_element_hidden(el, "Disable button not visible.");
+    // Corresponds to lack of enable permission.
+    el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
+    is_element_hidden(el, "Enable button not visible.");
 
-add_task(function* testCleanup() {
-  for (let addon of gInstalledAddons) {
-    addon.uninstall();
-  }
-
-  yield close_manager(gManagerWindow);
-
-  if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
-    yield gContext.Experiments.instance().init();
-  }
+    run_next_test();
+  });
 });
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -278,86 +278,73 @@ function wait_for_manager_load(aManagerW
   info("Waiting for initialization");
   aManagerWindow.document.addEventListener("Initialized", function() {
     aManagerWindow.document.removeEventListener("Initialized", arguments.callee, false);
     log_exceptions(aCallback, aManagerWindow);
   }, false);
 }
 
 function open_manager(aView, aCallback, aLoadCallback, aLongerTimeout) {
-  let deferred = Promise.defer();
-
   function setup_manager(aManagerWindow) {
     if (aLoadCallback)
       log_exceptions(aLoadCallback, aManagerWindow);
 
     if (aView)
       aManagerWindow.loadView(aView);
 
     ok(aManagerWindow != null, "Should have an add-ons manager window");
     is(aManagerWindow.location, MANAGER_URI, "Should be displaying the correct UI");
 
     waitForFocus(function() {
       wait_for_manager_load(aManagerWindow, function() {
         wait_for_view_load(aManagerWindow, function() {
           // Some functions like synthesizeMouse don't like to be called during
           // the load event so ensure that has completed
           executeSoon(function() {
-            if (aCallback) {
-              log_exceptions(aCallback, aManagerWindow);
-            }
-            deferred.resolve(aManagerWindow);
+            log_exceptions(aCallback, aManagerWindow);
           });
         }, null, aLongerTimeout);
       });
     }, aManagerWindow);
   }
 
   if (gUseInContentUI) {
     gBrowser.selectedTab = gBrowser.addTab();
     switchToTabHavingURI(MANAGER_URI, true);
-
+    
     // This must be a new load, else the ping/pong would have
     // found the window above.
     Services.obs.addObserver(function (aSubject, aTopic, aData) {
       Services.obs.removeObserver(arguments.callee, aTopic);
       if (aSubject.location.href != MANAGER_URI)
         return;
       setup_manager(aSubject);
     }, "EM-loaded", false);
-    return deferred.promise;
+    return;
   }
 
   openDialog(MANAGER_URI);
   Services.obs.addObserver(function (aSubject, aTopic, aData) {
     Services.obs.removeObserver(arguments.callee, aTopic);
     setup_manager(aSubject);
   }, "EM-loaded", false);
-
-  return deferred.promise;
 }
 
 function close_manager(aManagerWindow, aCallback, aLongerTimeout) {
-  let deferred = Promise.defer();
   requestLongerTimeout(aLongerTimeout ? aLongerTimeout : 2);
 
   ok(aManagerWindow != null, "Should have an add-ons manager window to close");
   is(aManagerWindow.location, MANAGER_URI, "Should be closing window with correct URI");
 
   aManagerWindow.addEventListener("unload", function() {
     this.removeEventListener("unload", arguments.callee, false);
-    if (aCallback) {
-      log_exceptions(aCallback);
-    }
-    deferred.resolve();
+    log_exceptions(aCallback);
   }, false);
 
   aManagerWindow.close();
-
-  return deferred.promise;
 }
 
 function restart_manager(aManagerWindow, aView, aCallback, aLoadCallback) {
   if (!aManagerWindow) {
     open_manager(aView, aCallback, aLoadCallback);
     return;
   }
 
@@ -432,35 +419,27 @@ function is_element_hidden(aElement, aMs
 }
 
 /**
  * Install an add-on and call a callback when complete.
  *
  * The callback will receive the Addon for the installed add-on.
  */
 function install_addon(path, cb, pathPrefix=TESTROOT) {
-  let deferred = Promise.defer();
-
   AddonManager.getInstallForURL(pathPrefix + path, (install) => {
     install.addListener({
       onInstallEnded: () => {
         executeSoon(() => {
-          if (cb) {
-            cb(install.addon);
-          }
-
-          deferred.resolve(install.addon);
+          cb(install.addon);
         });
       },
     });
 
     install.install();
   }, "application/x-xpinstall");
-
-  return deferred.promise;
 }
 
 function CategoryUtilities(aManagerWindow) {
   this.window = aManagerWindow;
 
   var self = this;
   this.window.addEventListener("unload", function() {
     self.window.removeEventListener("unload", arguments.callee, false);
@@ -512,36 +491,27 @@ CategoryUtilities.prototype = {
     return !is_hidden(aCategory);
   },
 
   isTypeVisible: function(aCategoryType) {
     return this.isVisible(this.get(aCategoryType));
   },
 
   open: function(aCategory, aCallback) {
-    let deferred = Promise.defer();
-
     isnot(this.window, null, "Should not open category when manager window is not loaded");
     ok(this.isVisible(aCategory), "Category should be visible if attempting to open it");
 
     EventUtils.synthesizeMouse(aCategory, 2, 2, { }, this.window);
 
-    wait_for_view_load(this.window, (win) => {
-      if (aCallback) {
-        log_exceptions(aCallback, win);
-      }
-
-      deferred.resolve(win);
-    });
-
-    return deferred.promise;
+    if (aCallback)
+      wait_for_view_load(this.window, aCallback);
   },
 
   openType: function(aCategoryType, aCallback) {
-    return this.open(this.get(aCategoryType), aCallback);
+    this.open(this.get(aCategoryType), aCallback);
   }
 }
 
 function CertOverrideListener(host, bits) {
   this.host = host;
   this.bits = bits;
 }