Bug 562803: Add cleanup function to avoid one failing xpinstall test from messing up subsequent tests. r=robstrong

This commit is contained in:
Dave Townsend 2010-06-22 18:59:52 -07:00
Родитель 8dc94f5949
Коммит 11df9d74c5
1 изменённых файлов: 9 добавлений и 10 удалений

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

@ -63,19 +63,18 @@ var Harness = {
AddonManager.addInstallListener(this);
this.installCount = 0;
this.pendingCount = 0;
var self = this;
registerCleanupFunction(function() {
Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
Services.obs.removeObserver(self, "addon-install-blocked");
Services.wm.removeListener(self);
AddonManager.removeInstallListener(self);
});
},
finish: function() {
Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
Services.obs.removeObserver(this, "addon-install-blocked");
Services.wm.removeListener(this);
var win = Services.wm.getMostRecentWindow("Extension:Manager");
if (win)
win.close();
AddonManager.removeInstallListener(this);
AddonManager.getAllInstalls(function(installs) {
is(installs.length, 0, "Should be no active installs at the end of the test");
finish();