diff --git a/b2g/components/AlertsHelper.jsm b/b2g/components/AlertsHelper.jsm index a3dd91b170a3b..7f64a3acae6c6 100644 --- a/b2g/components/AlertsHelper.jsm +++ b/b2g/components/AlertsHelper.jsm @@ -18,10 +18,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger", "@mozilla.org/system-message-internal;1", "nsISystemMessagesInternal"); -XPCOMUtils.defineLazyServiceGetter(this, "appsService", - "@mozilla.org/AppsService;1", - "nsIAppsService"); - XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", "resource://gre/modules/SystemAppProxy.jsm"); diff --git a/b2g/components/B2GAppMigrator.js b/b2g/components/B2GAppMigrator.js deleted file mode 100644 index 65671d1513354..0000000000000 --- a/b2g/components/B2GAppMigrator.js +++ /dev/null @@ -1,152 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -'use strict'; - -function debug(s) { - dump("-*- B2GAppMigrator.js: " + s + "\n"); -} -const DEBUG = false; - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -const kMigrationMessageName = "webapps-before-update-merge"; - -const kIDBDirType = "indexedDBPDir"; -const kProfileDirType = "ProfD"; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/FileUtils.jsm"); - -XPCOMUtils.defineLazyServiceGetter(this, "appsService", - "@mozilla.org/AppsService;1", - "nsIAppsService"); - -function B2GAppMigrator() { -} - -B2GAppMigrator.prototype = { - classID: Components.ID('{7211ece0-b458-4635-9afc-f8d7f376ee95}'), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), - executeBrowserMigration: function() { - if (DEBUG) debug("Executing Browser Migration"); - // The browser db file and directory names are hashed the same way - // everywhere, so it should be the same on all systems. We should - // be able to just hardcode it. - let browserDBDirName = "2959517650brreosw"; - let browserDBFileName = browserDBDirName + ".sqlite"; - - // Storage directories need to be prefixed with the local id of - // the app - let browserLocalAppId = appsService.getAppLocalIdByManifestURL("app://browser.gaiamobile.org/manifest.webapp"); - let browserAppStorageDirName = browserLocalAppId + "+f+app+++browser.gaiamobile.org"; - - // On the phone, the browser db will only be in the old IDB - // directory, since it only existed up until v2.0. On desktop, it - // will exist in the profile directory. - // - // Uses getDir with filename appending to make sure we don't - // create extra directories along the way if they don't already - // exist. - let browserDBFile = FileUtils.getDir(kIDBDirType, - ["storage", - "persistent", - browserAppStorageDirName, - "idb"], false, true); - browserDBFile.append(browserDBFileName); - let browserDBDir = FileUtils.getDir(kIDBDirType, - ["storage", - "persistent", - browserAppStorageDirName, - "idb", - browserDBDirName - ], false, true); - - if (!browserDBFile.exists()) { - if (DEBUG) debug("Browser DB " + browserDBFile.path + " does not exist, trying profile location"); - browserDBFile = FileUtils.getDir(kProfileDirType, - ["storage", - "persistent", - browserAppStorageDirName, - "idb"], false, true); - browserDBFile.append(browserDBFileName); - if (!browserDBFile.exists()) { - if (DEBUG) debug("Browser DB " + browserDBFile.path + " does not exist. Cannot copy browser db."); - return; - } - // If we have confirmed we have a DB file, we should also have a - // directory. - browserDBDir = FileUtils.getDir(kProfileDirType, - ["storage", - "persistent", - browserAppStorageDirName, - "idb", - browserDBDirName - ], false, true); - } - - let systemLocalAppId = appsService.getAppLocalIdByManifestURL("app://system.gaiamobile.org/manifest.webapp"); - let systemAppStorageDirName = systemLocalAppId + "+f+app+++system.gaiamobile.org"; - - // This check futureproofs the system DB storage directory. It - // currently exists outside of the profile but will most likely - // move into the profile at some point. - let systemDBDir = FileUtils.getDir(kIDBDirType, - ["storage", - "persistent", - systemAppStorageDirName, - "idb"], false, true); - - if (!systemDBDir.exists()) { - if (DEBUG) debug("System DB directory " + systemDBDir.path + " does not exist, trying profile location"); - systemDBDir = FileUtils.getDir(kProfileDirType, - ["storage", - "persistent", - systemAppStorageDirName, - "idb"], false, true); - if (!systemDBDir.exists()) { - if (DEBUG) debug("System DB directory " + systemDBDir.path + " does not exist. Cannot copy browser db."); - return; - } - } - - if (DEBUG) { - debug("Browser DB file exists, copying"); - debug("Browser local id: " + browserLocalAppId + ""); - debug("System local id: " + systemLocalAppId + ""); - debug("Browser DB file path: " + browserDBFile.path + ""); - debug("Browser DB dir path: " + browserDBDir.path + ""); - debug("System DB directory path: " + systemDBDir.path + ""); - } - - try { - browserDBFile.copyTo(systemDBDir, browserDBFileName); - } catch (e) { - debug("File copy caused error! " + e.name); - } - try { - browserDBDir.copyTo(systemDBDir, browserDBDirName); - } catch (e) { - debug("Dir copy caused error! " + e.name); - } - if (DEBUG) debug("Browser DB copied successfully"); - }, - - observe: function(subject, topic, data) { - switch (topic) { - case kMigrationMessageName: - this.executeBrowserMigration(); - break; - default: - debug("Unhandled topic: " + topic); - break; - } - } -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([B2GAppMigrator]); diff --git a/b2g/components/B2GComponents.manifest b/b2g/components/B2GComponents.manifest index 53d0032f945bc..44848c9423e7b 100644 --- a/b2g/components/B2GComponents.manifest +++ b/b2g/components/B2GComponents.manifest @@ -91,10 +91,6 @@ component {fd663ec8-cf3f-4c2b-aacb-17a6915ccb44} BootstrapCommandLine.js contract @mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap {fd663ec8-cf3f-4c2b-aacb-17a6915ccb44} category command-line-handler m-b2gbootstrap @mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap -# B2GAppMigrator.js -component {7211ece0-b458-4635-9afc-f8d7f376ee95} B2GAppMigrator.js -contract @mozilla.org/app-migrator;1 {7211ece0-b458-4635-9afc-f8d7f376ee95} - # B2GPresentationDevicePrompt.js component {4a300c26-e99b-4018-ab9b-c48cf9bc4de1} B2GPresentationDevicePrompt.js contract @mozilla.org/presentation-device/prompt;1 {4a300c26-e99b-4018-ab9b-c48cf9bc4de1} diff --git a/b2g/components/moz.build b/b2g/components/moz.build index 9290c5e2a04c3..91d25ed0be82b 100644 --- a/b2g/components/moz.build +++ b/b2g/components/moz.build @@ -9,7 +9,6 @@ DIRS += ['test'] EXTRA_COMPONENTS += [ 'AlertsService.js', 'B2GAboutRedirector.js', - 'B2GAppMigrator.js', 'B2GPresentationDevicePrompt.js', 'BootstrapCommandLine.js', 'ContentPermissionPrompt.js', diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index ba7fcaa669a34..f457e9f18de84 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -148,7 +148,6 @@ @RESPATH@/components/docshell.xpt @RESPATH@/components/dom.xpt @RESPATH@/components/dom_activities.xpt -@RESPATH@/components/dom_apps.xpt @RESPATH@/components/dom_audiochannel.xpt @RESPATH@/components/dom_base.xpt @RESPATH@/components/dom_system.xpt @@ -533,8 +532,6 @@ @RESPATH@/components/TelemetryStartup.manifest @RESPATH@/components/XULStore.js @RESPATH@/components/XULStore.manifest -@RESPATH@/components/AppsService.js -@RESPATH@/components/AppsService.manifest @RESPATH@/components/Push.js @RESPATH@/components/Push.manifest @RESPATH@/components/PushComponents.js @@ -797,7 +794,6 @@ bin/libfreebl_32int64_3.so @RESPATH@/components/HelperAppDialog.js @RESPATH@/components/DownloadsUI.js @RESPATH@/components/SystemMessageGlue.js -@RESPATH@/components/B2GAppMigrator.js @RESPATH@/components/B2GPresentationDevicePrompt.js @RESPATH@/components/PresentationRequestUIGlue.js diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index c0d6598619cfd..e4d3df40825e8 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -189,7 +189,6 @@ @RESPATH@/components/directory.xpt @RESPATH@/components/docshell.xpt @RESPATH@/components/dom.xpt -@RESPATH@/components/dom_apps.xpt @RESPATH@/components/dom_base.xpt @RESPATH@/components/dom_system.xpt @RESPATH@/components/dom_canvas.xpt @@ -504,8 +503,6 @@ @RESPATH@/components/messageWakeupService.manifest @RESPATH@/components/SettingsManager.js @RESPATH@/components/SettingsManager.manifest -@RESPATH@/components/AppsService.js -@RESPATH@/components/AppsService.manifest @RESPATH@/components/recording-cmdline.js @RESPATH@/components/recording-cmdline.manifest @RESPATH@/components/htmlMenuBuilder.js diff --git a/caps/nsPrincipal.cpp b/caps/nsPrincipal.cpp index fb41cdda57835..0df2defba3ee3 100644 --- a/caps/nsPrincipal.cpp +++ b/caps/nsPrincipal.cpp @@ -30,8 +30,6 @@ #include "mozilla/Preferences.h" #include "mozilla/HashFunctions.h" -#include "nsIAppsService.h" - using namespace mozilla; static bool gIsWhitelistingTestDomains = false; diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index d604541d0b462..f7fbc50c77e8d 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -10,7 +10,6 @@ #include "xpcpublic.h" #include "XPCWrapper.h" -#include "nsIAppsService.h" #include "nsIInputStreamChannel.h" #include "nsILoadContext.h" #include "nsIServiceManager.h" diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 1bab8c0c7639d..c9c643c1c9995 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -192,7 +192,6 @@ #include "nsXULAppAPI.h" #include "nsDOMNavigationTiming.h" #include "nsISecurityUITelemetry.h" -#include "nsIAppsService.h" #include "nsDSURIContentListener.h" #include "nsDocShellLoadTypes.h" #include "nsDocShellTransferableHooks.h" diff --git a/dom/apps/AppsService.js b/dom/apps/AppsService.js deleted file mode 100644 index 71e94f1e876fb..0000000000000 --- a/dom/apps/AppsService.js +++ /dev/null @@ -1,101 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict" - -function debug(s) { - //dump("-*- AppsService.js: " + s + "\n"); -} - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/Promise.jsm"); - -const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}"); - -function AppsService() -{ - debug("AppsService Constructor"); - this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime) - .processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; - debug("inParent: " + this.inParent); - if (!this.inParent) { - Cu.import("resource://gre/modules/AppsServiceChild.jsm"); - } -} - -AppsService.prototype = { - - isInvalidId: function(localId) { - return (localId == Ci.nsIScriptSecurityManager.NO_APP_ID || - localId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID); - }, - - getManifestFor: function getManifestFor(aManifestURL) { - debug("getManifestFor(" + aManifestURL + ")"); - if (this.inParent) { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - } else { - return Promise.reject( - new Error("Calling getManifestFor() from child is not supported")); - } - }, - - getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) { - debug("getAppLocalIdByManifestURL( " + aManifestURL + " )"); - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getAppLocalIdByStoreId: function getAppLocalIdByStoreId(aStoreId) { - debug("getAppLocalIdByStoreId( " + aStoreId + " )"); - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) { - debug("getManifestURLByLocalId( " + aLocalId + " )"); - if (this.isInvalidId(aLocalId)) { - return null; - } - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getCoreAppsBasePath: function getCoreAppsBasePath() { - debug("getCoreAppsBasePath()"); - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getWebAppsBasePath: function getWebAppsBasePath() { - debug("getWebAppsBasePath()"); - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - areAnyAppsInstalled: function() { - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getAppInfo: function getAppInfo(aAppId) { - debug("getAppInfo()"); - throw Cr.NS_ERROR_NOT_IMPLEMENTED; - }, - - getScopeByLocalId: function(aLocalId) { - debug("getScopeByLocalId( " + aLocalId + " )"); - if (this.isInvalidId(aLocalId)) { - return null; - } - // TODO : implement properly! - // We just return null for now to not break PushService.jsm - return null; - }, - - classID : APPS_SERVICE_CID, - QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService]) -} - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService]) diff --git a/dom/apps/AppsService.manifest b/dom/apps/AppsService.manifest deleted file mode 100644 index 2ed92d4e8ae22..0000000000000 --- a/dom/apps/AppsService.manifest +++ /dev/null @@ -1,2 +0,0 @@ -component {05072afa-92fe-45bf-ae22-39b69c117058} AppsService.js -contract @mozilla.org/AppsService;1 {05072afa-92fe-45bf-ae22-39b69c117058} diff --git a/dom/apps/AppsServiceChild.jsm b/dom/apps/AppsServiceChild.jsm deleted file mode 100644 index 35606f4ffa383..0000000000000 --- a/dom/apps/AppsServiceChild.jsm +++ /dev/null @@ -1,392 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const Cu = Components.utils; -const Cc = Components.classes; -const Ci = Components.interfaces; - -// This module exposes a subset of the functionalities of the parent DOM -// Registry to content processes, to be used from the AppsService component. - -this.EXPORTED_SYMBOLS = ["DOMApplicationRegistry", "WrappedManifestCache"]; - -Cu.import("resource://gre/modules/AppsUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -function debug(s) { - //dump("-*- AppsServiceChild.jsm: " + s + "\n"); -} - -const APPS_IPC_MSG_NAMES = [ - "Webapps:AddApp", - "Webapps:RemoveApp", - "Webapps:UpdateApp", - "Webapps:CheckForUpdate:Return:KO", - "Webapps:FireEvent", - "Webapps:UpdateState" -]; - -// A simple cache for the wrapped manifests. -this.WrappedManifestCache = { - _cache: { }, - - // Gets an entry from the cache, and populates the cache if needed. - get: function mcache_get(aManifestURL, aManifest, aWindow, aInnerWindowID) { - if (!aManifest) { - return; - } - - if (!(aManifestURL in this._cache)) { - this._cache[aManifestURL] = { }; - } - - let winObjs = this._cache[aManifestURL]; - if (!(aInnerWindowID in winObjs)) { - winObjs[aInnerWindowID] = Cu.cloneInto(aManifest, aWindow); - } - - return winObjs[aInnerWindowID]; - }, - - // Invalidates an entry in the cache. - evict: function mcache_evict(aManifestURL, aInnerWindowID) { - debug("Evicting manifest " + aManifestURL + " window ID " + - aInnerWindowID); - if (aManifestURL in this._cache) { - let winObjs = this._cache[aManifestURL]; - if (aInnerWindowID in winObjs) { - delete winObjs[aInnerWindowID]; - } - - if (Object.keys(winObjs).length == 0) { - delete this._cache[aManifestURL]; - } - } - }, - - observe: function(aSubject, aTopic, aData) { - // Clear the cache on memory pressure. - this._cache = { }; - Cu.forceGC(); - }, - - init: function() { - Services.obs.addObserver(this, "memory-pressure", false); - } -}; - -this.WrappedManifestCache.init(); - - -// DOMApplicationRegistry keeps a cache containing a list of apps in the device. -// This information is updated with the data received from the main process and -// it is queried by the DOM objects to set their state. -// This module handle all the messages broadcasted from the parent process, -// including DOM events, which are dispatched to the corresponding DOM objects. - -this.DOMApplicationRegistry = { - // DOMApps will hold a list of arrays of weak references to - // mozIDOMApplication objects indexed by manifest URL. - DOMApps: {}, - - ready: false, - webapps: null, - - init: function init() { - this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] - .getService(Ci.nsISyncMessageSender); - - APPS_IPC_MSG_NAMES.forEach((function(aMsgName) { - this.cpmm.addMessageListener(aMsgName, this); - }).bind(this)); - - this.webapps = { }; - // We need a fast mapping from localId -> app, so we add an index. - // We also add the manifest to the app object. - this.localIdIndex = { }; - for (let id in this.webapps) { - let app = this.webapps[id]; - this.localIdIndex[app.localId] = app; - app.manifest = list.manifests[id]; - } - - Services.obs.addObserver(this, "xpcom-shutdown", false); - }, - - observe: function(aSubject, aTopic, aData) { - // cpmm.addMessageListener causes the DOMApplicationRegistry object to - // live forever if we don't clean up properly. - this.webapps = null; - this.DOMApps = null; - - APPS_IPC_MSG_NAMES.forEach((aMsgName) => { - this.cpmm.removeMessageListener(aMsgName, this); - }); - }, - - receiveMessage: function receiveMessage(aMessage) { - debug("Received " + aMessage.name + " message."); - let msg = aMessage.data; - switch (aMessage.name) { - case "Webapps:AddApp": - this.webapps[msg.id] = msg.app; - this.localIdIndex[msg.app.localId] = msg.app; - if (msg.manifest) { - this.webapps[msg.id].manifest = msg.manifest; - } - break; - case "Webapps:RemoveApp": - delete this.DOMApps[this.webapps[msg.id].manifestURL]; - delete this.localIdIndex[this.webapps[msg.id].localId]; - delete this.webapps[msg.id]; - break; - case "Webapps:UpdateApp": - let app = this.webapps[msg.oldId]; - if (!app) { - return; - } - - if (msg.app) { - for (let prop in msg.app) { - app[prop] = msg.app[prop]; - } - } - - this.webapps[msg.newId] = app; - this.localIdIndex[app.localId] = app; - delete this.webapps[msg.oldId]; - - let apps = this.DOMApps[msg.app.manifestURL]; - if (!apps) { - return; - } - for (let i = 0; i < apps.length; i++) { - let domApp = apps[i].get(); - if (!domApp || domApp._window === null) { - apps.splice(i, 1); - continue; - } - domApp._proxy = new Proxy(domApp, { - get: function(target, prop) { - if (!DOMApplicationRegistry.webapps[msg.newId]) { - return; - } - return DOMApplicationRegistry.webapps[msg.newId][prop]; - }, - set: function(target, prop, val) { - if (!DOMApplicationRegistry.webapps[msg.newId]) { - return; - } - DOMApplicationRegistry.webapps[msg.newId][prop] = val; - return; - }, - }); - } - break; - case "Webapps:FireEvent": - this._fireEvent(aMessage); - break; - case "Webapps:UpdateState": - this._updateState(msg); - break; - case "Webapps:CheckForUpdate:Return:KO": - let DOMApps = this.DOMApps[msg.manifestURL]; - if (!DOMApps || !msg.requestID) { - return; - } - DOMApps.forEach((DOMApp) => { - let domApp = DOMApp.get(); - if (domApp && msg.requestID) { - domApp._fireRequestResult(aMessage, true /* aIsError */); - } - }); - break; - } - }, - - /** - * mozIDOMApplication management - */ - - // Every time a DOM app is created, we save a weak reference to it that will - // be used to dispatch events and fire request results. - addDOMApp: function(aApp, aManifestURL, aId) { - let weakRef = Cu.getWeakReference(aApp); - - if (!this.DOMApps[aManifestURL]) { - this.DOMApps[aManifestURL] = []; - } - - let apps = this.DOMApps[aManifestURL]; - - // Get rid of dead weak references. - for (let i = 0; i < apps.length; i++) { - let app = apps[i].get(); - if (!app || app._window === null) { - apps.splice(i, 1); - } - } - - apps.push(weakRef); - - // Each DOM app contains a proxy object used to build their state. We - // return the handler for this proxy object with traps to get and set - // app properties kept in the DOMApplicationRegistry app cache. - return { - get: function(target, prop) { - if (!DOMApplicationRegistry.webapps[aId]) { - return; - } - - if (prop in DOMApplicationRegistry.webapps[aId]) { - return DOMApplicationRegistry.webapps[aId][prop]; - } - return null; - }, - set: function(target, prop, val) { - if (!DOMApplicationRegistry.webapps[aId]) { - return; - } - DOMApplicationRegistry.webapps[aId][prop] = val; - return; - }, - }; - }, - - _fireEvent: function(aMessage) { - let msg = aMessage.data; - debug("_fireEvent " + JSON.stringify(msg)); - if (!this.DOMApps || !msg.manifestURL || !msg.eventType) { - return; - } - - let DOMApps = this.DOMApps[msg.manifestURL]; - if (!DOMApps) { - return; - } - - // The parent might ask childs to trigger more than one event in one - // shot, so in order to avoid needless IPC we allow an array for the - // 'eventType' IPC message field. - if (!Array.isArray(msg.eventType)) { - msg.eventType = [msg.eventType]; - } - - DOMApps.forEach((DOMApp) => { - let domApp = DOMApp.get(); - if (!domApp) { - return; - } - msg.eventType.forEach((aEventType) => { - if ('on' + aEventType in domApp) { - domApp._fireEvent(aEventType); - } - }); - - if (msg.requestID) { - aMessage.data.result = msg.manifestURL; - domApp._fireRequestResult(aMessage); - } - }); - }, - - _updateState: function(aMessage) { - if (!this.DOMApps || !aMessage.id) { - return; - } - - let app = this.webapps[aMessage.id]; - if (!app) { - return; - } - - if (aMessage.app) { - for (let prop in aMessage.app) { - app[prop] = aMessage.app[prop]; - } - } - - if ("error" in aMessage) { - app.downloadError = aMessage.error; - } - - if (aMessage.manifest) { - app.manifest = aMessage.manifest; - // Evict the wrapped manifest cache for all the affected DOM objects. - let DOMApps = this.DOMApps[app.manifestURL]; - if (!DOMApps) { - return; - } - DOMApps.forEach((DOMApp) => { - let domApp = DOMApp.get(); - if (!domApp) { - return; - } - WrappedManifestCache.evict(app.manifestURL, domApp.innerWindowID); - }); - } - }, - - getAll: function(aCallback) { - debug("getAll()\n"); - if (!aCallback || typeof aCallback !== "function") { - return; - } - - let res = []; - for (let id in this.webapps) { - res.push(this.webapps[id]); - } - aCallback(res); - }, - - getAdditionalLanguages: function(aManifestURL) { - for (let id in this.webapps) { - if (this.webapps[id].manifestURL == aManifestURL) { - return this.webapps[id].additionalLanguages || {}; - } - } - return {}; - }, - - /** - * nsIAppsService API - */ - getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) { - debug("getAppLocalIdByManifestURL " + aManifestURL); - return AppsUtils.getAppLocalIdByManifestURL(this.webapps, aManifestURL); - }, - - getAppLocalIdByStoreId: function(aStoreId) { - debug("getAppLocalIdByStoreId:" + aStoreId); - return AppsUtils.getAppLocalIdByStoreId(this.webapps, aStoreId); - }, - - getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) { - debug("getManifestURLByLocalId " + aLocalId); - return AppsUtils.getManifestURLByLocalId(this.webapps, aLocalId); - }, - - getCoreAppsBasePath: function getCoreAppsBasePath() { - debug("getCoreAppsBasePath() not yet supported on child!"); - return null; - }, - - getWebAppsBasePath: function getWebAppsBasePath() { - debug("getWebAppsBasePath() not yet supported on child!"); - return null; - }, - - areAnyAppsInstalled: function() { - return AppsUtils.areAnyAppsInstalled(this.webapps); - }, - - getAppInfo: function getAppInfo(aAppId) { - return AppsUtils.getAppInfo(this.webapps, aAppId); - } -} - -DOMApplicationRegistry.init(); diff --git a/dom/apps/AppsUtils.jsm b/dom/apps/AppsUtils.jsm index 251c20f2ac76a..16ef5f7d6c1b2 100644 --- a/dom/apps/AppsUtils.jsm +++ b/dom/apps/AppsUtils.jsm @@ -19,11 +19,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); -XPCOMUtils.defineLazyServiceGetter(this, "appsService", - "@mozilla.org/AppsService;1", - "nsIAppsService"); - -// Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js +// Shared code for Webapps.jsm and Webapps.js this.EXPORTED_SYMBOLS = ["AppsUtils", "ManifestHelper", "isAbsoluteURI"]; @@ -635,15 +631,6 @@ this.AppsUtils = { computeObjectHash: function(aObject) { return this.computeHash(JSON.stringify(aObject)); }, - - getAppManifestURLFromWindow: function(aWindow) { - let appId = aWindow.document.nodePrincipal.appId; - if (appId === Ci.nsIScriptSecurityManager.NO_APP_ID) { - return null; - } - - return appsService.getManifestURLByLocalId(appId); - }, } /** diff --git a/dom/apps/moz.build b/dom/apps/moz.build index 43aefe7850515..74c094a7a7011 100644 --- a/dom/apps/moz.build +++ b/dom/apps/moz.build @@ -6,13 +6,7 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] -EXTRA_COMPONENTS += [ - 'AppsService.js', - 'AppsService.manifest', -] - EXTRA_JS_MODULES += [ - 'AppsServiceChild.jsm', 'PermissionsTable.jsm', ] diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 811b17f038657..80c840e4e34b2 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -67,7 +67,6 @@ #include "TimeManager.h" #include "DeviceStorage.h" #include "nsStreamUtils.h" -#include "nsIAppsService.h" #include "WidgetUtils.h" #include "nsIPresentationService.h" diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index f9b0744a47963..5bb76dc89773a 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -14,7 +14,6 @@ #include "prenv.h" #include "nsDocShell.h" -#include "nsIAppsService.h" #include "nsIDOMHTMLIFrameElement.h" #include "nsIDOMHTMLFrameElement.h" #include "nsIDOMMozBrowserFrame.h" diff --git a/dom/downloads/DownloadsAPI.js b/dom/downloads/DownloadsAPI.js index 8294e2a3ea7e7..987af5d864169 100644 --- a/dom/downloads/DownloadsAPI.js +++ b/dom/downloads/DownloadsAPI.js @@ -46,15 +46,6 @@ DOMDownloadManagerImpl.prototype = { this.initDOMRequestHelper(aWindow, ["Downloads:Added", "Downloads:Removed"]); - - // Get the manifest URL if this is an installed app - let appsService = Cc["@mozilla.org/AppsService;1"] - .getService(Ci.nsIAppsService); - let principal = aWindow.document.nodePrincipal; - // This returns the empty string if we're not an installed app. Coerce to - // null. - this._manifestURL = appsService.getManifestURLByLocalId(principal.appId) || - null; }, uninit: function() { @@ -164,7 +155,7 @@ DOMDownloadManagerImpl.prototype = { path: computedPath, contentType: aAdoptDownloadDict.contentType, startTime: aAdoptDownloadDict.startTime.valueOf() || Date.now(), - sourceAppManifestURL: this._manifestURL + sourceAppManifestURL: "" }; DownloadsIPC.adoptDownload(jsonDownload).then( diff --git a/dom/html/nsBrowserElement.cpp b/dom/html/nsBrowserElement.cpp index 4b74ae969620a..9ce6ebc4bf742 100644 --- a/dom/html/nsBrowserElement.cpp +++ b/dom/html/nsBrowserElement.cpp @@ -18,7 +18,6 @@ #include "nsComponentManagerUtils.h" #include "nsFrameLoader.h" -#include "nsIAppsService.h" #include "nsIDOMDOMRequest.h" #include "nsIDOMElement.h" #include "nsIMozBrowserFrame.h" diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 0162870e90e47..70776f11bd925 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -70,7 +70,6 @@ #include "nsHashKeys.h" #include "nsNetUtil.h" #include "nsISimpleEnumerator.h" -#include "nsIAppsService.h" #include "nsIEventTarget.h" #include "nsIFile.h" #include "nsIFileURL.h" diff --git a/dom/inputmethod/Keyboard.jsm b/dom/inputmethod/Keyboard.jsm index 43a932d472ff4..606de2cb615bd 100644 --- a/dom/inputmethod/Keyboard.jsm +++ b/dom/inputmethod/Keyboard.jsm @@ -19,10 +19,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm", XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", "resource://gre/modules/SystemAppProxy.jsm"); -XPCOMUtils.defineLazyGetter(this, "appsService", function() { - return Cc["@mozilla.org/AppsService;1"].getService(Ci.nsIAppsService); -}); - XPCOMUtils.defineLazyGetter(this, "hardwareKeyHandler", function() { #ifdef MOZ_B2G return Cc["@mozilla.org/HardwareKeyHandler;1"] @@ -535,24 +531,6 @@ InputRegistryGlue.prototype.addInput = function(msg, mm) { mm: mm, requestId: msg.data.requestId }); - - let manifestURL = appsService.getManifestURLByLocalId(msg.data.appId); - - Keyboard.sendToSystem('System:InputRegistry:Add', { - id: msgId, - manifestURL: manifestURL, - inputId: msg.data.inputId, - inputManifest: msg.data.inputManifest - }); - - // XXX: To be removed when content migrate away from mozChromeEvents. - SystemAppProxy.dispatchEvent({ - type: 'inputregistry-add', - id: msgId, - manifestURL: manifestURL, - inputId: msg.data.inputId, - inputManifest: msg.data.inputManifest - }); }; InputRegistryGlue.prototype.removeInput = function(msg, mm) { @@ -561,22 +539,6 @@ InputRegistryGlue.prototype.removeInput = function(msg, mm) { mm: mm, requestId: msg.data.requestId }); - - let manifestURL = appsService.getManifestURLByLocalId(msg.data.appId); - - Keyboard.sendToSystem('System:InputRegistry:Remove', { - id: msgId, - manifestURL: manifestURL, - inputId: msg.data.inputId - }); - - // XXX: To be removed when content migrate away from mozChromeEvents. - SystemAppProxy.dispatchEvent({ - type: 'inputregistry-remove', - id: msgId, - manifestURL: manifestURL, - inputId: msg.data.inputId - }); }; InputRegistryGlue.prototype.returnMessage = function(detail) { diff --git a/dom/interfaces/apps/moz.build b/dom/interfaces/apps/moz.build deleted file mode 100644 index 495623afcd4ee..0000000000000 --- a/dom/interfaces/apps/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIAppsService.idl', -] - -XPIDL_MODULE = 'dom_apps' - diff --git a/dom/interfaces/apps/nsIAppsService.idl b/dom/interfaces/apps/nsIAppsService.idl deleted file mode 100644 index 45a5c740ab551..0000000000000 --- a/dom/interfaces/apps/nsIAppsService.idl +++ /dev/null @@ -1,65 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "domstubs.idl" - -%{C++ -#define APPS_SERVICE_CID { 0x05072afa, 0x92fe, 0x45bf, { 0xae, 0x22, 0x39, 0xb6, 0x9c, 0x11, 0x70, 0x58 } } -#define APPS_SERVICE_CONTRACTID "@mozilla.org/AppsService;1" -%} - -/* - * This service allows accessing some DOMApplicationRegistry methods from - * non-javascript code. - */ -[scriptable, uuid(711cfab6-7b72-4aa2-a60c-17952ea05661)] -interface nsIAppsService : nsISupports -{ - /** - * Returns a Promise for the manifest for a given manifestURL. - * This is only supported in the parent process: the promise will be rejected - * in content processes. - */ - jsval getManifestFor(in DOMString manifestURL); - - /** - * Returns the |localId| of the app associated with the |manifestURL| passed - * in parameter. - * Returns nsIScriptSecurityManager::NO_APP_ID if |manifestURL| isn't a valid - * installed manifest URL. - */ - unsigned long getAppLocalIdByManifestURL(in DOMString manifestURL); - - /** - * Returns the manifest URL associated to this localId. - */ - DOMString getManifestURLByLocalId(in unsigned long localId); - - /** - * Returns the basepath for core apps - */ - DOMString getCoreAppsBasePath(); - - /** - * Returns the basepath for regular packaged apps - */ - DOMString getWebAppsBasePath(); - - /** - * Returns true if at least one app is in the registry. - */ - boolean areAnyAppsInstalled(); - - jsval getAppInfo(in DOMString appId); - - /** - * Returns the localId if the app was installed from a store - */ - DOMString getAppLocalIdByStoreId(in DOMString storeID); - - /** - * Returns the scope for app to use with service workers. - */ - DOMString getScopeByLocalId(in unsigned long localId); -}; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 093f4564cff7f..7db7828b67c07 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -109,7 +109,6 @@ #include "nsFrameMessageManager.h" #include "nsHashPropertyBag.h" #include "nsIAlertsService.h" -#include "nsIAppsService.h" #include "nsIClipboard.h" #include "nsContentPermissionHelper.h" #include "nsICycleCollectorListener.h" diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index f5965fca14c65..89cc11be13639 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -102,7 +102,6 @@ #include "nsDatePickerProxy.h" #include "nsContentPermissionHelper.h" #include "nsPresShell.h" -#include "nsIAppsService.h" #include "nsNetUtil.h" #include "nsIPermissionManager.h" #include "nsIURILoader.h" diff --git a/dom/moz.build b/dom/moz.build index 277321eff3b00..4885a12eb5bf1 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -29,7 +29,6 @@ interfaces = [ 'notification', 'svg', 'smil', - 'apps', 'push', ] diff --git a/dom/network/NetworkStatsDB.jsm b/dom/network/NetworkStatsDB.jsm index aa74d40ad988a..ec00a33fa6794 100644 --- a/dom/network/NetworkStatsDB.jsm +++ b/dom/network/NetworkStatsDB.jsm @@ -16,10 +16,6 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/IndexedDBHelper.jsm"); Cu.importGlobalProperties(["indexedDB"]); -XPCOMUtils.defineLazyServiceGetter(this, "appsService", - "@mozilla.org/AppsService;1", - "nsIAppsService"); - const DB_NAME = "net_stats"; const DB_VERSION = 9; const DEPRECATED_STATS_STORE_NAME = @@ -425,17 +421,7 @@ NetworkStatsDB.prototype = { return; } let newStats = cursor.value; - // Augment records by adding the new isInBrowser attribute. - // Notes: - // 1. Key value cannot be boolean type. Use 1/0 instead of true/false. - // 2. Most traffic of system app should come from its browser iframe, - // thus assign isInBrowser as 1 for system app. - let manifestURL = appsService.getManifestURLByLocalId(newStats.appId); - if (manifestURL && manifestURL.search(/app:\/\/system\./) === 0) { - newStats.isInBrowser = 1; - } else { - newStats.isInBrowser = 0; - } + newStats.isInBrowser = 0; newObjectStore.put(newStats); cursor.continue(); }; diff --git a/dom/network/NetworkStatsManager.js b/dom/network/NetworkStatsManager.js index b963aba2b57af..404387fd6de36 100644 --- a/dom/network/NetworkStatsManager.js +++ b/dom/network/NetworkStatsManager.js @@ -181,8 +181,8 @@ NetworkStatsManager.prototype = { threshold: aThreshold, startTime: aOptions.startTime, data: aOptions.data, - manifestURL: this.manifestURL, - pageURL: this.pageURL}}); + manifestURL: "", + pageURL: ""}}); return request; }, @@ -196,7 +196,7 @@ NetworkStatsManager.prototype = { cpmm.sendAsyncMessage("NetworkStats:GetAlarms", {id: this.getRequestId(request), data: {network: network, - manifestURL: this.manifestURL}}); + manifestURL: ""}}); return request; }, @@ -209,7 +209,7 @@ NetworkStatsManager.prototype = { cpmm.sendAsyncMessage("NetworkStats:RemoveAlarms", {id: this.getRequestId(request), data: {alarmId: aAlarmId, - manifestURL: this.manifestURL}}); + manifestURL: ""}}); return request; }, @@ -353,17 +353,6 @@ NetworkStatsManager.prototype = { "NetworkStats:GetAlarms:Return", "NetworkStats:RemoveAlarms:Return"]); - // Init app properties. - let appsService = Cc["@mozilla.org/AppsService;1"] - .getService(Ci.nsIAppsService); - - this.manifestURL = appsService.getManifestURLByLocalId(principal.appId); - - let isApp = !!this.manifestURL.length; - if (isApp) { - this.pageURL = principal.URI.spec; - } - this.window = aWindow; }, diff --git a/dom/network/NetworkStatsService.jsm b/dom/network/NetworkStatsService.jsm index 597f62645f5ac..d507e835b16c9 100644 --- a/dom/network/NetworkStatsService.jsm +++ b/dom/network/NetworkStatsService.jsm @@ -57,10 +57,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "networkService", "@mozilla.org/network/service;1", "nsINetworkService"); -XPCOMUtils.defineLazyServiceGetter(this, "appsService", - "@mozilla.org/AppsService;1", - "nsIAppsService"); - XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService", "@mozilla.org/settingsService;1", "nsISettingsService"); @@ -403,19 +399,6 @@ this.NetworkStatsService = { let network = msg.network; let netId = this.getNetworkId(network.id, network.type); - let appId = 0; - let appManifestURL = msg.appManifestURL; - if (appManifestURL) { - appId = appsService.getAppLocalIdByManifestURL(appManifestURL); - - if (!appId) { - mm.sendAsyncMessage("NetworkStats:Get:Return", - { id: msg.id, - error: "Invalid appManifestURL", result: null }); - return; - } - } - let browsingTrafficOnly = msg.browsingTrafficOnly || false; let serviceType = msg.serviceType || ""; @@ -426,7 +409,7 @@ this.NetworkStatsService = { this._db.find(function onStatsFound(aError, aResult) { mm.sendAsyncMessage("NetworkStats:Get:Return", { id: msg.id, error: aError, result: aResult }); - }, appId, browsingTrafficOnly, serviceType, network, start, end, appManifestURL); + }, 0, browsingTrafficOnly, serviceType, network, start, end, null); }).bind(this); this.validateNetwork(network, function onValidateNetwork(aNetId) { @@ -440,11 +423,10 @@ this.NetworkStatsService = { // retrieving stats from the DB. if (this._networks[aNetId].status == NETWORK_STATUS_READY) { debug("getstats for network " + network.id + " of type " + network.type); - debug("appId: " + appId + " from appManifestURL: " + appManifestURL); debug("browsingTrafficOnly: " + browsingTrafficOnly); debug("serviceType: " + serviceType); - if (appId || serviceType) { + if (serviceType) { this.updateCachedStats(callback); return; } @@ -459,7 +441,7 @@ this.NetworkStatsService = { this._db.find(function onStatsFound(aError, aResult) { mm.sendAsyncMessage("NetworkStats:Get:Return", { id: msg.id, error: aError, result: aResult }); - }, appId, browsingTrafficOnly, serviceType, network, start, end, appManifestURL); + }, 0, browsingTrafficOnly, serviceType, network, start, end, null); }.bind(this)); }, diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 39700b62bf412..1672cf10027e7 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -29,7 +29,6 @@ #include "nsIPrincipal.h" #include "nsContentUtils.h" #include "nsIScriptSecurityManager.h" -#include "nsIAppsService.h" #include "nsIEffectiveTLDService.h" #include "nsPIDOMWindow.h" #include "nsIDocument.h" diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp index f910a90832fb6..9cb2ea0ef266f 100644 --- a/ipc/glue/BackgroundParentImpl.cpp +++ b/ipc/glue/BackgroundParentImpl.cpp @@ -40,7 +40,6 @@ #include "mozilla/layout/VsyncParent.h" #include "mozilla/dom/network/UDPSocketParent.h" #include "mozilla/Preferences.h" -#include "nsIAppsService.h" #include "nsNetUtil.h" #include "nsIScriptSecurityManager.h" #include "nsProxyRelease.h" diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index e2e5edb4e8b6e..954b67a4ada9c 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -113,7 +113,6 @@ @BINPATH@/components/directory.xpt @BINPATH@/components/docshell.xpt @BINPATH@/components/dom.xpt -@BINPATH@/components/dom_apps.xpt @BINPATH@/components/dom_base.xpt @BINPATH@/components/dom_canvas.xpt @BINPATH@/components/dom_core.xpt @@ -353,8 +352,6 @@ @BINPATH@/components/TelemetryStartup.manifest @BINPATH@/components/XULStore.js @BINPATH@/components/XULStore.manifest -@BINPATH@/components/AppsService.js -@BINPATH@/components/AppsService.manifest @BINPATH@/components/htmlMenuBuilder.js @BINPATH@/components/htmlMenuBuilder.manifest diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index cef728e8435aa..d2e84fa05d95e 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -50,7 +50,6 @@ #include "mozilla/AutoRestore.h" #include "mozilla/FileUtils.h" #include "mozilla/Telemetry.h" -#include "nsIAppsService.h" #include "nsIConsoleService.h" #include "nsVariant.h" diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 5453a70f0cd6e..8333aadee7c6d 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -35,7 +35,6 @@ #include "mozilla/LoadContext.h" #include "nsPrintfCString.h" #include "nsHTMLDNSPrefetch.h" -#include "nsIAppsService.h" #include "nsEscape.h" #include "SerializedLoadContext.h" #include "nsAuthInformationHolder.h" diff --git a/tools/lint/eslint/modules.json b/tools/lint/eslint/modules.json index be678dc19ace1..f30caf96ec29a 100644 --- a/tools/lint/eslint/modules.json +++ b/tools/lint/eslint/modules.json @@ -11,7 +11,6 @@ "AlertsHelper.jsm": [], "AppData.jsm": ["makeFakeAppDir"], "AppInfo.jsm": ["newAppInfo", "getAppInfo", "updateAppInfo"], - "AppsServiceChild.jsm": ["DOMApplicationRegistry", "WrappedManifestCache"], "arrays.js": ["inArray", "getSet", "indexOf", "remove", "rindexOf", "compare"], "assertions.js": ["Assert", "Expect"], "async.js": ["Async"],