Bug 1058180 - Only create app migrator when absolutely needed; r=fabrice

This commit is contained in:
Kyle Machulis 2014-09-22 14:45:39 -07:00
parent a8622d36ab
commit 13cbe85c1e
3 changed files with 5 additions and 11 deletions

View File

@ -27,8 +27,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "appsService",
"nsIAppsService");
function B2GAppMigrator() {
Services.obs.addObserver(this, kMigrationMessageName, false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
}
B2GAppMigrator.prototype = {
@ -119,11 +117,6 @@ B2GAppMigrator.prototype = {
switch (topic) {
case kMigrationMessageName:
this.executeBrowserMigration();
Services.obs.removeObserver(this, kMigrationMessageName);
break;
case "xpcom-shutdown":
Services.obs.removeObserver(this, kMigrationMessageName);
Services.obs.removeObserver(this, "xpcom-shutdown");
break;
default:
debug("Unhandled topic: " + topic);

View File

@ -108,5 +108,5 @@ contract @mozilla.org/services/mobileid-ui-glue;1 {83dbe26a-81f3-4a75-9541-3d0b7
# B2GAppMigrator.js
component {7211ece0-b458-4635-9afc-f8d7f376ee95} B2GAppMigrator.js
contract @mozilla.org/b2g-app-migrator;1 {7211ece0-b458-4635-9afc-f8d7f376ee95}
category profile-after-change B2GAppMigrator @mozilla.org/b2g-app-migrator;1
contract @mozilla.org/app-migrator;1 {7211ece0-b458-4635-9afc-f8d7f376ee95}

View File

@ -661,9 +661,10 @@ this.DOMApplicationRegistry = {
} catch(e) {} // getCharPref will throw on non-b2g platforms. That's ok.
if (runUpdate) {
// Run migration before uninstall of core apps happens.
Services.obs.notifyObservers(null, "webapps-before-update-merge", null);
var appMigrator = Components.classes["@mozilla.org/app-migrator;1"]
.createInstance(Components.interfaces.nsIObserver);
appMigrator.observe(null, "webapps-before-update-merge", null);
#ifdef MOZ_WIDGET_GONK
yield this.installSystemApps();