From 6de8dfdd332c0fe7a0b6827569d3116e15c611e3 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 27 Aug 2013 23:40:16 -0400 Subject: [PATCH] Bug 836547 - Remove obsolete AITC integration in Webapps.jsm. r=fabrice --- browser/modules/webappsUI.jsm | 2 +- dom/apps/src/Webapps.jsm | 106 ++--------------------- mobile/android/chrome/content/browser.js | 2 +- webapprt/WebappsHandler.jsm | 2 +- 4 files changed, 10 insertions(+), 102 deletions(-) diff --git a/browser/modules/webappsUI.jsm b/browser/modules/webappsUI.jsm index e4623304e876..4962685f8404 100644 --- a/browser/modules/webappsUI.jsm +++ b/browser/modules/webappsUI.jsm @@ -135,7 +135,7 @@ this.webappsUI = { localDir = app.appProfile.localDir; } - DOMApplicationRegistry.confirmInstall(aData, false, localDir, null, + DOMApplicationRegistry.confirmInstall(aData, localDir, null, (aManifest) => { Task.spawn(function() { try { diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index c4804646b74e..30c6c4c6e85b 100644 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -1987,8 +1987,7 @@ this.DOMApplicationRegistry = { } }, - confirmInstall: function(aData, aFromSync, aProfileDir, - aOfflineCacheObserver, + confirmInstall: function(aData, aProfileDir, aOfflineCacheObserver, aInstallSuccessCallback) { let isReinstall = false; let app = aData.app; @@ -1997,7 +1996,7 @@ this.DOMApplicationRegistry = { let origin = Services.io.newURI(app.origin, null, null); let manifestURL = origin.resolve(app.manifestURL); - let id = app.syncId || this._appId(app.origin); + let id = this._appId(app.origin); let localId = this.getAppLocalIdByManifestURL(manifestURL); // For packaged apps, we need to get the id from the manifestURL. @@ -2105,13 +2104,11 @@ this.DOMApplicationRegistry = { // We notify about the successful installation via mgmt.oninstall and the // corresponging DOMRequest.onsuccess event as soon as the app is properly // saved in the registry. - if (!aFromSync) { - this._saveApps((function() { - this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject }); - this.broadcastMessage("Webapps:Install:Return:OK", aData); - Services.obs.notifyObservers(this, "webapps-sync-install", appNote); - }).bind(this)); - } + this._saveApps((function() { + this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject }); + this.broadcastMessage("Webapps:Install:Return:OK", aData); + Services.obs.notifyObservers(this, "webapps-sync-install", appNote); + }).bind(this)); if (!aData.isPackage) { this.updateAppHandlers(null, app.manifest, app); @@ -2955,19 +2952,6 @@ this.DOMApplicationRegistry = { }); }, - /** Added to support AITC and classic sync */ - itemExists: function(aId) { - return !!this.webapps[aId]; - }, - - getAppById: function(aId) { - if (!this.webapps[aId]) - return null; - - let app = AppsUtils.cloneAppObject(this.webapps[aId]); - return app; - }, - getAppByManifestURL: function(aManifestURL) { return AppsUtils.getAppByManifestURL(this.webapps, aManifestURL); }, @@ -3002,82 +2986,6 @@ this.DOMApplicationRegistry = { return FileUtils.getDir(DIRECTORY_NAME, ["webapps"], false).path; }, - getAllWithoutManifests: function(aCallback) { - let result = {}; - for (let id in this.webapps) { - let app = AppsUtils.cloneAppObject(this.webapps[id]); - result[id] = app; - } - aCallback(result); - }, - - updateApps: function(aRecords, aCallback) { - for (let i = 0; i < aRecords.length; i++) { - let record = aRecords[i]; - if (record.hidden) { - if (!this.webapps[record.id] || !this.webapps[record.id].removable) - continue; - - // Clean up the deprecated manifest cache if needed. - if (record.id in this._manifestCache) { - delete this._manifestCache[record.id]; - } - - let origin = this.webapps[record.id].origin; - let manifestURL = this.webapps[record.id].manifestURL; - delete this.webapps[record.id]; - let dir = this._getAppDir(record.id); - try { - dir.remove(true); - } catch (e) { - } - this.broadcastMessage("Webapps:Uninstall:Broadcast:Return:OK", - { origin: origin, manifestURL: manifestURL }); - } else { - if (this.webapps[record.id]) { - this.webapps[record.id] = record.value; - delete this.webapps[record.id].manifest; - } else { - let data = { app: record.value }; - this.confirmInstall(data, true); - this.broadcastMessage("Webapps:Install:Return:OK", data); - } - } - } - this._saveApps(aCallback); - }, - - getAllIDs: function() { - let apps = {}; - for (let id in this.webapps) { - // only sync http and https apps - if (this.webapps[id].origin.indexOf("http") == 0) - apps[id] = true; - } - return apps; - }, - - wipe: function(aCallback) { - let ids = this.getAllIDs(); - for (let id in ids) { - if (!this.webapps[id].removable) { - continue; - } - - delete this.webapps[id]; - let dir = this._getAppDir(id); - try { - dir.remove(true); - } catch (e) { - } - } - - // Clear the manifest cache. - this._manifestCache = { }; - - this._saveApps(aCallback); - }, - _isLaunchable: function(aApp) { if (this.allAppsLaunchable) return true; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index eb6291447ef4..ca82fdddeb39 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -6829,7 +6829,7 @@ var WebappsUI = { file.initWithPath(profilePath); let self = this; - DOMApplicationRegistry.confirmInstall(aData, false, file, null, + DOMApplicationRegistry.confirmInstall(aData, file, null, function (aManifest) { let localeManifest = new ManifestHelper(aManifest, aData.app.origin); diff --git a/webapprt/WebappsHandler.jsm b/webapprt/WebappsHandler.jsm index b9d2c300383d..f633f87d53a3 100644 --- a/webapprt/WebappsHandler.jsm +++ b/webapprt/WebappsHandler.jsm @@ -67,7 +67,7 @@ this.WebappsHandler = { localDir = shell.appProfile.localDir; } - DOMApplicationRegistry.confirmInstall(data, false, localDir, null, + DOMApplicationRegistry.confirmInstall(data, localDir, null, function (aManifest) { WebappsInstaller.install(data, aManifest); }