Bug 1318210 - Remove nsIAppsService; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 16 Nov 2016 21:19:43 -0500
changeset 323139 1fdb5a1b0d86d274c23f5d4232432c13dc42df79
parent 323138 1e14d92676fb3d75fe5302b20c3df6a934b4a253
child 323140 8e476f8bd52d13cc1648e15ea2b72641c2d7bd8a
child 323182 960112fbae7844edd5d329b3cbb28bec8c1c34c3
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersbaku
bugs1318210
milestone53.0a1
Bug 1318210 - Remove nsIAppsService; r=baku
b2g/components/AlertsHelper.jsm
b2g/components/B2GAppMigrator.js
b2g/components/B2GComponents.manifest
b2g/components/moz.build
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
caps/nsPrincipal.cpp
caps/nsScriptSecurityManager.cpp
docshell/base/nsDocShell.cpp
dom/apps/AppsService.js
dom/apps/AppsService.manifest
dom/apps/AppsServiceChild.jsm
dom/apps/AppsUtils.jsm
dom/apps/moz.build
dom/base/Navigator.cpp
dom/base/nsFrameLoader.cpp
dom/downloads/DownloadsAPI.js
dom/html/nsBrowserElement.cpp
dom/indexedDB/ActorsParent.cpp
dom/inputmethod/Keyboard.jsm
dom/interfaces/apps/moz.build
dom/interfaces/apps/nsIAppsService.idl
dom/ipc/ContentParent.cpp
dom/ipc/TabChild.cpp
dom/moz.build
dom/network/NetworkStatsDB.jsm
dom/network/NetworkStatsManager.js
dom/network/NetworkStatsService.jsm
extensions/cookie/nsPermissionManager.cpp
ipc/glue/BackgroundParentImpl.cpp
mobile/android/installer/package-manifest.in
netwerk/cookie/nsCookieService.cpp
netwerk/ipc/NeckoParent.cpp
tools/lint/eslint/modules.json
--- a/b2g/components/AlertsHelper.jsm
+++ b/b2g/components/AlertsHelper.jsm
@@ -13,20 +13,16 @@ const Cc = Components.classes;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 
 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");
 
 XPCOMUtils.defineLazyServiceGetter(this, "notificationStorage",
                                    "@mozilla.org/notificationStorage;1",
                                    "nsINotificationStorage");
 
 XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
deleted file mode 100644
--- 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]);
--- a/b2g/components/B2GComponents.manifest
+++ b/b2g/components/B2GComponents.manifest
@@ -86,20 +86,16 @@ contract @mozilla.org/commandlinehandler
 category command-line-handler m-b2gcmds @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds
 #endif
 
 # BootstrapCommandLine.js
 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}
 
 # PresentationRequestUIGlue.js
 component {ccc8a839-0b64-422b-8a60-fb2af0e376d0} PresentationRequestUIGlue.js
 contract @mozilla.org/presentation/requestuiglue;1 {ccc8a839-0b64-422b-8a60-fb2af0e376d0}
 
--- a/b2g/components/moz.build
+++ b/b2g/components/moz.build
@@ -4,17 +4,16 @@
 # 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/.
 
 DIRS += ['test']
 
 EXTRA_COMPONENTS += [
     'AlertsService.js',
     'B2GAboutRedirector.js',
-    'B2GAppMigrator.js',
     'B2GPresentationDevicePrompt.js',
     'BootstrapCommandLine.js',
     'ContentPermissionPrompt.js',
     'FilePicker.js',
     'FxAccountsUIGlue.js',
     'HelperAppDialog.js',
     'MailtoProtocolHandler.js',
     'OMAContentHandler.js',
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -143,17 +143,16 @@
 @RESPATH@/components/content_html.xpt
 @RESPATH@/components/content_xslt.xpt
 @RESPATH@/components/cookie.xpt
 @RESPATH@/components/directory.xpt
 @RESPATH@/components/diskspacewatcher.xpt
 @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
 @RESPATH@/components/dom_workers.xpt
 #ifdef MOZ_WIDGET_GONK
 @RESPATH@/components/dom_wifi.xpt
 @RESPATH@/components/dom_system_gonk.xpt
 #endif
@@ -528,18 +527,16 @@
 @RESPATH@/components/servicesComponents.manifest
 @RESPATH@/components/cryptoComponents.manifest
 @RESPATH@/components/CaptivePortalDetectComponents.manifest
 @RESPATH@/components/captivedetect.js
 @RESPATH@/components/TelemetryStartup.js
 @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
 
 @RESPATH@/components/nsDOMIdentity.js
 @RESPATH@/components/nsIDService.js
 @RESPATH@/components/Identity.manifest
 
@@ -792,17 +789,16 @@ bin/libfreebl_32int64_3.so
 @RESPATH@/components/MailtoProtocolHandler.js
 @RESPATH@/components/SmsProtocolHandler.js
 @RESPATH@/components/TelProtocolHandler.js
 @RESPATH@/components/B2GAboutRedirector.js
 @RESPATH@/components/FilePicker.js
 @RESPATH@/components/HelperAppDialog.js
 @RESPATH@/components/DownloadsUI.js
 @RESPATH@/components/SystemMessageGlue.js
-@RESPATH@/components/B2GAppMigrator.js
 @RESPATH@/components/B2GPresentationDevicePrompt.js
 @RESPATH@/components/PresentationRequestUIGlue.js
 
 #ifndef MOZ_WIDGET_GONK
 @RESPATH@/components/SimulatorScreen.js
 #endif
 
 @RESPATH@/components/FxAccountsUIGlue.js
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -184,17 +184,16 @@
 #ifdef MOZ_WEBRTC
 @RESPATH@/components/content_webrtc.xpt
 #endif
 @RESPATH@/components/content_xslt.xpt
 @RESPATH@/components/cookie.xpt
 @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
 @RESPATH@/components/dom_core.xpt
 @RESPATH@/components/dom_css.xpt
 @RESPATH@/components/dom_events.xpt
 @RESPATH@/components/dom_geolocation.xpt
 @RESPATH@/components/dom_media.xpt
@@ -499,18 +498,16 @@
 @RESPATH@/components/TelemetryStartup.js
 @RESPATH@/components/TelemetryStartup.manifest
 @RESPATH@/components/XULStore.js
 @RESPATH@/components/XULStore.manifest
 @RESPATH@/components/messageWakeupService.js
 @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
 @RESPATH@/components/htmlMenuBuilder.manifest
 
 @RESPATH@/components/NotificationStorage.js
 @RESPATH@/components/NotificationStorage.manifest
 @RESPATH@/components/Push.js
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -25,18 +25,16 @@
 #include "nsNetCID.h"
 #include "jswrapper.h"
 
 #include "mozilla/dom/nsCSPContext.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/HashFunctions.h"
 
-#include "nsIAppsService.h"
-
 using namespace mozilla;
 
 static bool gIsWhitelistingTestDomains = false;
 static bool gCodeBasePrincipalSupport = false;
 
 static bool URIIsImmutable(nsIURI* aURI)
 {
   nsCOMPtr<nsIMutable> mutableObj(do_QueryInterface(aURI));
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsScriptSecurityManager.h"
 
 #include "mozilla/ArrayUtils.h"
 
 #include "xpcpublic.h"
 #include "XPCWrapper.h"
-#include "nsIAppsService.h"
 #include "nsIInputStreamChannel.h"
 #include "nsILoadContext.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptContext.h"
 #include "nsIURL.h"
 #include "nsINestedURI.h"
 #include "nspr.h"
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -187,17 +187,16 @@
 
 #include "nsContentUtils.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsILoadInfo.h"
 #include "nsSandboxFlags.h"
 #include "nsXULAppAPI.h"
 #include "nsDOMNavigationTiming.h"
 #include "nsISecurityUITelemetry.h"
-#include "nsIAppsService.h"
 #include "nsDSURIContentListener.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsDocShellTransferableHooks.h"
 #include "nsICommandManager.h"
 #include "nsIDOMNode.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIHttpChannel.h"
 #include "nsIIDNService.h"
deleted file mode 100644
--- 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])
deleted file mode 100644
--- 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}
deleted file mode 100644
--- 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();
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -14,21 +14,17 @@ Cu.import("resource://gre/modules/XPCOMU
 Cu.import("resource://gre/modules/Promise.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
   "resource://gre/modules/FileUtils.jsm");
 
 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"];
 
 function debug(s) {
   //dump("-*- AppsUtils.jsm: " + s + "\n");
 }
 
@@ -630,25 +626,16 @@ this.AppsUtils = {
     // Convert the binary hash data to a hex string.
     return Array.from(hash, (c, i) => toHexString(hash.charCodeAt(i))).join("");
   },
 
   // Returns the hash for a JS object.
   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);
-  },
 }
 
 /**
  * Helper object to access manifest information with locale support
  */
 this.ManifestHelper = function(aManifest, aOrigin, aManifestURL, aLang) {
   // If the app is packaged, we resolve uris against the origin.
   // If it's not, against the manifest url.
--- a/dom/apps/moz.build
+++ b/dom/apps/moz.build
@@ -1,21 +1,15 @@
 # -*- 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/.
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
-EXTRA_COMPONENTS += [
-    'AppsService.js',
-    'AppsService.manifest',
-]
-
 EXTRA_JS_MODULES += [
-    'AppsServiceChild.jsm',
     'PermissionsTable.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'AppsUtils.jsm',
 ]
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -62,17 +62,16 @@
 #include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIStringStream.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "TimeManager.h"
 #include "DeviceStorage.h"
 #include "nsStreamUtils.h"
-#include "nsIAppsService.h"
 #include "WidgetUtils.h"
 #include "nsIPresentationService.h"
 
 #include "mozilla/dom/MediaDevices.h"
 #include "MediaManager.h"
 
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
 #include "AudioChannelManager.h"
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -9,17 +9,16 @@
  * handling of loads in it, recursion-checking).
  */
 
 #include "base/basictypes.h"
 
 #include "prenv.h"
 
 #include "nsDocShell.h"
-#include "nsIAppsService.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMMozBrowserFrame.h"
 #include "nsIDOMWindow.h"
 #include "nsIPresShell.h"
 #include "nsIContentInlines.h"
 #include "nsIContentViewer.h"
 #include "nsIDocument.h"
--- a/dom/downloads/DownloadsAPI.js
+++ b/dom/downloads/DownloadsAPI.js
@@ -41,25 +41,16 @@ DOMDownloadManagerImpl.prototype = {
   __proto__: DOMRequestIpcHelper.prototype,
 
   // nsIDOMGlobalPropertyInitializer implementation
   init: function(aWindow) {
     debug("DownloadsManager init");
     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() {
     debug("uninit");
     downloadsCache.evict(this._window);
   },
 
   set ondownloadstart(aHandler) {
@@ -159,17 +150,17 @@ DOMDownloadManagerImpl.prototype = {
       // access would actually occur either way.
 
       // Create a DownloadsAPI.jsm 'jsonDownload' style representation.
       let jsonDownload = {
         url: aAdoptDownloadDict.url,
         path: computedPath,
         contentType: aAdoptDownloadDict.contentType,
         startTime: aAdoptDownloadDict.startTime.valueOf() || Date.now(),
-        sourceAppManifestURL: this._manifestURL
+        sourceAppManifestURL: ""
       };
 
       DownloadsIPC.adoptDownload(jsonDownload).then(
         function(aResult) {
           let domDownload = createDOMDownloadObject(this._window, aResult);
           aResolve(this._prepareForContent(domDownload));
         }.bind(this),
         function(aResult) {
--- a/dom/html/nsBrowserElement.cpp
+++ b/dom/html/nsBrowserElement.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/dom/DOMRequest.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ToJSValue.h"
 
 #include "AudioChannelService.h"
 
 #include "nsComponentManagerUtils.h"
 #include "nsFrameLoader.h"
-#include "nsIAppsService.h"
 #include "nsIDOMDOMRequest.h"
 #include "nsIDOMElement.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsINode.h"
 #include "nsIPrincipal.h"
 
 using namespace mozilla::dom;
 
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -65,17 +65,16 @@
 #include "nsCharSeparatedTokenizer.h"
 #include "nsClassHashtable.h"
 #include "nsCOMPtr.h"
 #include "nsDataHashtable.h"
 #include "nsEscape.h"
 #include "nsHashKeys.h"
 #include "nsNetUtil.h"
 #include "nsISimpleEnumerator.h"
-#include "nsIAppsService.h"
 #include "nsIEventTarget.h"
 #include "nsIFile.h"
 #include "nsIFileURL.h"
 #include "nsIFileProtocolHandler.h"
 #include "nsIInputStream.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIOutputStream.h"
--- a/dom/inputmethod/Keyboard.jsm
+++ b/dom/inputmethod/Keyboard.jsm
@@ -14,20 +14,16 @@ Cu.import('resource://gre/modules/Servic
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
   "@mozilla.org/parentprocessmessagemanager;1", "nsIMessageBroadcaster");
 
 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"]
          .getService(Ci.nsIHardwareKeyHandler);
 #else
   return null;
 #endif
 });
@@ -530,58 +526,24 @@ InputRegistryGlue.prototype.receiveMessa
 };
 
 InputRegistryGlue.prototype.addInput = function(msg, mm) {
   let msgId = this._messageId++;
   this._msgMap.set(msgId, {
     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) {
   let msgId = this._messageId++;
   this._msgMap.set(msgId, {
     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) {
   if (!this._msgMap.has(detail.id)) {
     dump('InputRegistryGlue: Ignoring already handled message response. ' +
          'id=' + detail.id + '\n');
     return;
   }
deleted file mode 100644
--- 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'
-
deleted file mode 100644
--- 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);
-};
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -104,17 +104,16 @@
 #include "nsChromeRegistryChrome.h"
 #include "nsConsoleMessage.h"
 #include "nsConsoleService.h"
 #include "nsContentUtils.h"
 #include "nsDebugImpl.h"
 #include "nsFrameMessageManager.h"
 #include "nsHashPropertyBag.h"
 #include "nsIAlertsService.h"
-#include "nsIAppsService.h"
 #include "nsIClipboard.h"
 #include "nsContentPermissionHelper.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocument.h"
 #include "nsIDOMGeoGeolocation.h"
 #include "nsIDOMGeoPositionError.h"
 #include "nsIDragService.h"
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -97,17 +97,16 @@
 #include "UnitTransforms.h"
 #include "ClientLayerManager.h"
 #include "LayersLogging.h"
 #include "nsDOMClassInfoID.h"
 #include "nsColorPickerProxy.h"
 #include "nsDatePickerProxy.h"
 #include "nsContentPermissionHelper.h"
 #include "nsPresShell.h"
-#include "nsIAppsService.h"
 #include "nsNetUtil.h"
 #include "nsIPermissionManager.h"
 #include "nsIURILoader.h"
 #include "nsIScriptError.h"
 #include "mozilla/EventForwards.h"
 #include "nsDeviceContext.h"
 #include "nsSandboxFlags.h"
 #include "FrameLayerBuilder.h"
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -24,17 +24,16 @@ interfaces = [
     'security',
     'storage',
     'json',
     'offline',
     'geolocation',
     'notification',
     'svg',
     'smil',
-    'apps',
     'push',
 ]
 
 DIRS += ['interfaces/' + i for i in interfaces]
 
 DIRS += [
     'animation',
     'apps',
--- a/dom/network/NetworkStatsDB.jsm
+++ b/dom/network/NetworkStatsDB.jsm
@@ -11,20 +11,16 @@ function debug(s) { dump("-*- NetworkSta
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 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 =
   [
     "net_stats_v2",    // existed only in DB version 2
     "net_stats",       // existed in DB version 1 and 3 to 5
     "net_stats_store", // existed in DB version 6 to 8
   ];
@@ -420,27 +416,17 @@ NetworkStatsDB.prototype = {
         objectStore.openCursor().onsuccess = function (event) {
           let cursor = event.target.result;
           if (!cursor) {
             db.deleteObjectStore(deprecatedName);
             // upgrade8to9 completed now.
             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();
         };
       }
     ];
 
     let index = aOldVersion;
     let outer = this;
--- a/dom/network/NetworkStatsManager.js
+++ b/dom/network/NetworkStatsManager.js
@@ -176,45 +176,45 @@ NetworkStatsManager.prototype = {
   addAlarm: function addAlarm(aNetwork, aThreshold, aOptions) {
     let request = this.createRequest();
     cpmm.sendAsyncMessage("NetworkStats:SetAlarm",
                           {id: this.getRequestId(request),
                            data: {network: aNetwork.toJSON(),
                                   threshold: aThreshold,
                                   startTime: aOptions.startTime,
                                   data: aOptions.data,
-                                  manifestURL: this.manifestURL,
-                                  pageURL: this.pageURL}});
+                                  manifestURL: "",
+                                  pageURL: ""}});
     return request;
   },
 
   getAllAlarms: function getAllAlarms(aNetwork) {
     let network = null;
     if (aNetwork) {
       network = aNetwork.toJSON();
     }
 
     let request = this.createRequest();
     cpmm.sendAsyncMessage("NetworkStats:GetAlarms",
                           {id: this.getRequestId(request),
                            data: {network: network,
-                                  manifestURL: this.manifestURL}});
+                                  manifestURL: ""}});
     return request;
   },
 
   removeAlarms: function removeAlarms(aAlarmId) {
     if (aAlarmId == 0) {
       aAlarmId = -1;
     }
 
     let request = this.createRequest();
     cpmm.sendAsyncMessage("NetworkStats:RemoveAlarms",
                           {id: this.getRequestId(request),
                            data: {alarmId: aAlarmId,
-                                  manifestURL: this.manifestURL}});
+                                  manifestURL: ""}});
 
     return request;
   },
 
   getAvailableNetworks: function getAvailableNetworks() {
     let request = this.createRequest();
     cpmm.sendAsyncMessage("NetworkStats:GetAvailableNetworks",
                           { id: this.getRequestId(request) });
@@ -348,27 +348,16 @@ NetworkStatsManager.prototype = {
                                         "NetworkStats:GetAvailableNetworks:Return",
                                         "NetworkStats:GetAvailableServiceTypes:Return",
                                         "NetworkStats:Clear:Return",
                                         "NetworkStats:ClearAll:Return",
                                         "NetworkStats:SetAlarm:Return",
                                         "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;
   },
 
   // Called from DOMRequestIpcHelper
   uninit: function uninit() {
     if (DEBUG) {
       debug("uninit call");
     }
--- a/dom/network/NetworkStatsService.jsm
+++ b/dom/network/NetworkStatsService.jsm
@@ -52,20 +52,16 @@ XPCOMUtils.defineLazyServiceGetter(this,
 XPCOMUtils.defineLazyServiceGetter(this, "gRil",
                                    "@mozilla.org/ril;1",
                                    "nsIRadioInterfaceLayer");
 
 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");
 
 XPCOMUtils.defineLazyServiceGetter(this, "messenger",
                                    "@mozilla.org/system-message-internal;1",
                                    "nsISystemMessagesInternal");
 
@@ -398,73 +394,59 @@ this.NetworkStatsService = {
    * and update the database.
    * Then, depending on the request (stats per appId or total stats)
    * it retrieve them from database and return to the manager.
    */
   getSamples: function getSamples(mm, msg) {
     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 || "";
 
     let start = new Date(msg.start);
     let end = new Date(msg.end);
 
     let callback = (function (aError, aResult) {
       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) {
       if (!aNetId) {
         mm.sendAsyncMessage("NetworkStats:Get:Return",
                             { id: msg.id, error: "Invalid connectionType", result: null });
         return;
       }
 
       // If network is currently active we need to update the cached stats first before
       // 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;
         }
 
         this.updateStats(aNetId, function onStatsUpdated(aResult, aMessage) {
           this.updateCachedStats(callback);
         }.bind(this));
         return;
       }
 
       // Network not active, so no need to update
       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));
   },
 
   clearInterfaceStats: function clearInterfaceStats(mm, msg) {
     let self = this;
     let network = msg.network;
 
     debug("clear stats for network " + network.id + " of type " + network.type);
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -24,17 +24,16 @@
 #include "nsDirectoryServiceDefs.h"
 #include "prprf.h"
 #include "mozilla/storage.h"
 #include "mozilla/Attributes.h"
 #include "nsXULAppAPI.h"
 #include "nsIPrincipal.h"
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
-#include "nsIAppsService.h"
 #include "nsIEffectiveTLDService.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocument.h"
 #include "mozilla/net/NeckoMessageUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsReadLine.h"
 #include "mozilla/Telemetry.h"
 #include "nsIConsoleService.h"
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -35,17 +35,16 @@
 #include "mozilla/ipc/BackgroundUtils.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "mozilla/ipc/PBackgroundTestParent.h"
 #include "mozilla/ipc/PSendStreamParent.h"
 #include "mozilla/ipc/SendStreamAlloc.h"
 #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"
 #include "mozilla/RefPtr.h"
 #include "nsThreadUtils.h"
 #include "nsTraceRefcnt.h"
 #include "nsXULAppAPI.h"
 #include "ServiceWorkerManagerParent.h"
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -108,17 +108,16 @@
 @BINPATH@/components/content_geckomediaplugins.xpt
 @BINPATH@/components/content_html.xpt
 @BINPATH@/components/content_webrtc.xpt
 @BINPATH@/components/content_xslt.xpt
 @BINPATH@/components/cookie.xpt
 @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
 @BINPATH@/components/dom_css.xpt
 @BINPATH@/components/dom_events.xpt
 @BINPATH@/components/dom_geolocation.xpt
 @BINPATH@/components/dom_media.xpt
 @BINPATH@/components/dom_network.xpt
@@ -348,18 +347,16 @@
 @BINPATH@/components/messageWakeupService.manifest
 @BINPATH@/components/nsINIProcessor.manifest
 @BINPATH@/components/nsINIProcessor.js
 @BINPATH@/components/servicesComponents.manifest
 @BINPATH@/components/TelemetryStartup.js
 @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
 
 @BINPATH@/components/SystemMessageInternal.js
 @BINPATH@/components/SystemMessageManager.js
 @BINPATH@/components/SystemMessageCache.js
 @BINPATH@/components/SystemMessageManager.manifest
 
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -45,17 +45,16 @@
 #include "nsISimpleEnumerator.h"
 #include "nsIInputStream.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsNetCID.h"
 #include "mozilla/storage.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/Telemetry.h"
-#include "nsIAppsService.h"
 #include "nsIConsoleService.h"
 #include "nsVariant.h"
 
 using namespace mozilla;
 using namespace mozilla::net;
 
 // Create key from baseDomain that will access the default cookie namespace.
 // TODO: When we figure out what the API will look like for nsICookieManager{2}
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -30,17 +30,16 @@
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/network/TCPSocketParent.h"
 #include "mozilla/dom/network/TCPServerSocketParent.h"
 #include "mozilla/dom/network/UDPSocketParent.h"
 #include "mozilla/dom/workers/ServiceWorkerManager.h"
 #include "mozilla/LoadContext.h"
 #include "nsPrintfCString.h"
 #include "nsHTMLDNSPrefetch.h"
-#include "nsIAppsService.h"
 #include "nsEscape.h"
 #include "SerializedLoadContext.h"
 #include "nsAuthInformationHolder.h"
 #include "nsIAuthPromptCallback.h"
 #include "nsPrincipal.h"
 #include "nsINetworkPredictor.h"
 #include "nsINetworkPredictorVerifier.h"
 #include "nsISpeculativeConnect.h"
--- a/tools/lint/eslint/modules.json
+++ b/tools/lint/eslint/modules.json
@@ -6,17 +6,16 @@
   "addons.jsm": ["Addon", "STATE_ENABLED", "STATE_DISABLED"],
   "addonsreconciler.js": ["AddonsReconciler", "CHANGE_INSTALLED", "CHANGE_UNINSTALLED", "CHANGE_ENABLED", "CHANGE_DISABLED"],
   "AddonTestUtils.jsm": ["AddonTestUtils", "MockAsyncShutdown"],
   "addonutils.js": ["AddonUtils"],
   "ajv-4.1.1.js": ["Ajv"],
   "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"],
   "AsyncSpellCheckTestHelper.jsm": ["onSpellCheck"],
   "Battery.jsm": ["GetBattery", "Battery"],
   "blocklist-clients.js": ["AddonBlocklistClient", "GfxBlocklistClient", "OneCRLBlocklistClient", "PluginBlocklistClient", "FILENAME_ADDONS_JSON", "FILENAME_GFX_JSON", "FILENAME_PLUGINS_JSON"],
   "blocklist-updater.js": ["checkVersions", "addTestBlocklistClient"],
   "bogus_element_type.jsm": [],