Bug 989137 - Part 13: Rename functions for associating with Add-on Manager; r=gfritzsche

The previous experiment feature expands the scope of these functions. A
rename was in order.

--HG--
extra : rebase_source : 054d7a440e3e15436ff7fbcbc4f91b28dd4fc9fd
This commit is contained in:
Gregory Szorc 2014-04-10 13:27:36 -07:00
parent 2526b290b7
commit bfb1f73953
2 changed files with 10 additions and 8 deletions

View File

@ -376,7 +376,7 @@ Experiments.Experiments.prototype = {
AsyncShutdown.profileBeforeChange.addBlocker("Experiments.jsm shutdown",
this.uninit.bind(this));
this._startWatchingAddons();
this._registerWithAddonManager();
this._loadTask = Task.spawn(this._loadFromCache.bind(this));
this._loadTask.then(
@ -406,7 +406,7 @@ Experiments.Experiments.prototype = {
yield this._loadTask;
if (!this._shutdown) {
this._stopWatchingAddons();
this._unregisterWithAddonManager();
gPrefs.ignore(PREF_LOGGING, configureLogging);
gPrefs.ignore(PREF_MANIFEST_URI, this.updateManifest, this);
@ -427,12 +427,14 @@ Experiments.Experiments.prototype = {
this._log.info("Completed uninitialization.");
}),
_startWatchingAddons: function () {
_registerWithAddonManager: function () {
this._log.trace("Registering instance with Addon Manager.");
AddonManager.addAddonListener(this);
AddonManager.addInstallListener(this);
},
_stopWatchingAddons: function () {
_unregisterWithAddonManager: function () {
AddonManager.removeInstallListener(this);
AddonManager.removeAddonListener(this);
},

View File

@ -1366,9 +1366,9 @@ add_task(function* testUnknownExperimentsUninstalled() {
Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are present.");
// Simulate us not listening.
experiments._stopWatchingAddons();
experiments._unregisterWithAddonManager();
yield AddonTestUtils.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
experiments._startWatchingAddons();
experiments._registerWithAddonManager();
addons = yield getExperimentAddons();
Assert.equal(addons.length, 1, "Experiment 1 installed via AddonManager");
@ -1452,9 +1452,9 @@ add_task(function* testEnabledAfterRestart() {
Assert.ok(addons[0].isActive, "That experiment is active.");
dump("Restarting Addon Manager\n");
experiments._stopWatchingAddons();
experiments._unregisterWithAddonManager();
restartManager();
experiments._startWatchingAddons();
experiments._registerWithAddonManager();
addons = yield getExperimentAddons();
Assert.equal(addons.length, 1, "The experiment is still there after restart.");