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

This commit is contained in:
Georg Fritzsche 2014-04-17 15:47:37 +02:00
Родитель fc857b817b
Коммит 473a9cbc89
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -384,7 +384,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(
@ -414,7 +414,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);
@ -435,12 +435,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);
},

Просмотреть файл

@ -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.");