Bug 1318207 - Remove Navigator.mozPermissionSettings; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 16 Nov 2016 20:52:27 -0500
changeset 323071 d81df33d18c739d0753fe49d4ddb9ed41465328c
parent 323070 cf4ecf3ac6b8e29267cb2f147b6bafbc9153d772
child 323072 fa88425550714adf2c999aa37da4b21b921c5d11
push id30967
push userphilringnalda@gmail.com
push dateFri, 18 Nov 2016 03:21:38 +0000
treeherdermozilla-central@8e476f8bd52d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1318207
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1318207 - Remove Navigator.mozPermissionSettings; r=baku
b2g/app/b2g.js
b2g/components/ContentPermissionPrompt.js
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/apps/PermissionsInstaller.jsm
dom/apps/moz.build
dom/interfaces/permission/moz.build
dom/interfaces/permission/nsIPermissionPromptService.idl
dom/moz.build
dom/permission/PermissionPromptService.js
dom/permission/PermissionPromptService.manifest
dom/permission/PermissionSettings.js
dom/permission/PermissionSettings.jsm
dom/permission/PermissionSettings.manifest
dom/permission/moz.build
dom/permission/tests/mochitest.ini
dom/permission/tests/test_permissions.html
dom/webidl/PermissionSettings.webidl
dom/webidl/moz.build
mobile/android/installer/package-manifest.in
modules/libpref/init/all.js
tools/lint/eslint/modules.json
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -408,17 +408,16 @@ pref("dom.webapps.firstRunWithSIM", true
 
 #ifdef MOZ_B2G_RIL
 // SingleVariant
 pref("dom.mozApps.single_variant_sourcedir", "/persist/svoperapps");
 #endif
 
 // WebSettings
 pref("dom.mozSettings.enabled", true);
-pref("dom.mozPermissionSettings.enabled", true);
 
 // controls if we want camera support
 pref("device.camera.enabled", true);
 pref("media.realtime_decoder.enabled", true);
 
 // TCPSocket
 pref("dom.mozTCPSocket.enabled", true);
 
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -20,17 +20,16 @@ const PROMPT_FOR_UNKNOWN = ["audio-captu
 // Due to privary issue, permission requests like GetUserMedia should prompt
 // every time instead of providing session persistence.
 const PERMISSION_NO_SESSION = ["audio-capture", "video-capture"];
 const ALLOW_MULTIPLE_REQUESTS = ["audio-capture", "video-capture"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
-Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
 Cu.import("resource://gre/modules/PermissionsTable.jsm");
 
 var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
 var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
 
 var permissionSpecificChecker = {};
 
 XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -173,17 +173,16 @@
 @RESPATH@/components/dom_json.xpt
 @RESPATH@/components/dom_messages.xpt
 @RESPATH@/components/dom_power.xpt
 @RESPATH@/components/dom_push.xpt
 @RESPATH@/components/dom_quota.xpt
 @RESPATH@/components/dom_range.xpt
 @RESPATH@/components/dom_security.xpt
 @RESPATH@/components/dom_settings.xpt
-@RESPATH@/components/dom_permissionsettings.xpt
 @RESPATH@/components/dom_sidebar.xpt
 @RESPATH@/components/dom_cellbroadcast.xpt
 @RESPATH@/components/dom_icc.xpt
 @RESPATH@/components/dom_mobilemessage.xpt
 @RESPATH@/components/dom_storage.xpt
 @RESPATH@/components/dom_stylesheets.xpt
 @RESPATH@/components/dom_threads.xpt
 @RESPATH@/components/dom_traversal.xpt
@@ -330,20 +329,16 @@
 @RESPATH@/components/ConsoleAPI.manifest
 @RESPATH@/components/ConsoleAPIStorage.js
 @RESPATH@/components/BrowserElementParent.manifest
 @RESPATH@/components/BrowserElementParent.js
 @RESPATH@/components/PhoneNumberService.js
 @RESPATH@/components/PhoneNumberService.manifest
 @RESPATH@/components/NotificationStorage.js
 @RESPATH@/components/NotificationStorage.manifest
-@RESPATH@/components/PermissionSettings.js
-@RESPATH@/components/PermissionSettings.manifest
-@RESPATH@/components/PermissionPromptService.js
-@RESPATH@/components/PermissionPromptService.manifest
 @RESPATH@/components/FeedProcessor.manifest
 @RESPATH@/components/FeedProcessor.js
 @RESPATH@/components/BrowserFeeds.manifest
 @RESPATH@/components/FeedConverter.js
 @RESPATH@/components/FeedWriter.js
 @RESPATH@/components/WebContentConverter.js
 @RESPATH@/components/BrowserComponents.manifest
 @RESPATH@/components/nsBrowserContentHandler.js
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -204,17 +204,16 @@
 @RESPATH@/components/dom_offline.xpt
 @RESPATH@/components/dom_json.xpt
 @RESPATH@/components/dom_power.xpt
 @RESPATH@/components/dom_push.xpt
 @RESPATH@/components/dom_quota.xpt
 @RESPATH@/components/dom_range.xpt
 @RESPATH@/components/dom_security.xpt
 @RESPATH@/components/dom_settings.xpt
-@RESPATH@/components/dom_permissionsettings.xpt
 @RESPATH@/components/dom_sidebar.xpt
 @RESPATH@/components/dom_storage.xpt
 @RESPATH@/components/dom_stylesheets.xpt
 @RESPATH@/components/dom_traversal.xpt
 #ifdef MOZ_WEBSPEECH
 @RESPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @RESPATH@/components/dom_workers.xpt
@@ -507,18 +506,16 @@
 @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/PermissionSettings.js
-@RESPATH@/components/PermissionSettings.manifest
 @RESPATH@/components/NotificationStorage.js
 @RESPATH@/components/NotificationStorage.manifest
 @RESPATH@/components/Push.js
 @RESPATH@/components/Push.manifest
 @RESPATH@/components/PushComponents.js
 
 @RESPATH@/components/remotebrowserutils.manifest
 @RESPATH@/components/RemoteWebNavigation.js
deleted file mode 100644
--- a/dom/apps/PermissionsInstaller.jsm
+++ /dev/null
@@ -1,210 +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 Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/AppsUtils.jsm");
-Cu.import("resource://gre/modules/PermissionSettings.jsm");
-Cu.import("resource://gre/modules/PermissionsTable.jsm");
-
-this.EXPORTED_SYMBOLS = ["PermissionsInstaller"];
-const UNKNOWN_ACTION = Ci.nsIPermissionManager.UNKNOWN_ACTION;
-const ALLOW_ACTION = Ci.nsIPermissionManager.ALLOW_ACTION;
-const DENY_ACTION = Ci.nsIPermissionManager.DENY_ACTION;
-const PROMPT_ACTION = Ci.nsIPermissionManager.PROMPT_ACTION;
-
-// Permission access flags
-const READONLY = "readonly";
-const CREATEONLY = "createonly";
-const READCREATE = "readcreate";
-const READWRITE = "readwrite";
-
-const PERM_TO_STRING = ["unknown", "allow", "deny", "prompt"];
-
-function debug(aMsg) {
-  //dump("-*-*- PermissionsInstaller.jsm : " + aMsg + "\n");
-}
-
-this.PermissionsInstaller = {
-  /**
-   * Install permissisions or remove deprecated permissions upon re-install.
-   * @param object aApp
-   *        The just-installed app configuration.
-   *        The properties used are manifestURL, origin and manifest.
-   * @param boolean aIsReinstall
-   *        Indicates the app was just re-installed
-   * @param function aOnError
-   *        A function called if an error occurs
-   * @returns void
-   **/
-  installPermissions: function installPermissions(aApp, aIsReinstall,
-                                                  aOnError) {
-    try {
-      let newManifest =
-        new ManifestHelper(aApp.manifest, aApp.origin, aApp.manifestURL);
-      if (!newManifest.permissions && !aIsReinstall) {
-        return;
-      }
-
-      if (aIsReinstall) {
-        // Compare the original permissions against the new permissions
-        // Remove any deprecated Permissions
-
-        if (newManifest.permissions) {
-          // Expand permission names.
-          let newPermNames = [];
-          for (let permName in newManifest.permissions) {
-            let expandedPermNames =
-              expandPermissions(permName,
-                                newManifest.permissions[permName].access);
-            newPermNames = newPermNames.concat(expandedPermNames);
-          }
-
-          newPermNames.push("indexedDB");
-
-          // Add the appcache related permissions.
-          if (newManifest.appcache_path) {
-            newPermNames = newPermNames.concat(["offline-app", "pin-app"]);
-          }
-
-          for (let idx in AllPossiblePermissions) {
-            let permName = AllPossiblePermissions[idx];
-            let index = newPermNames.indexOf(permName);
-            if (index == -1) {
-              // See if the permission was installed previously.
-              let permValue =
-                PermissionSettingsModule.getPermission(permName,
-                                                       aApp.manifestURL,
-                                                       aApp.origin,
-                                                       false);
-              if (permValue == "unknown" || permValue == "deny") {
-                // All 'deny' permissions should be preserved
-                continue;
-              }
-              // Remove the deprecated permission
-              PermissionSettingsModule.removePermission(permName,
-                                                        aApp.manifestURL,
-                                                        aApp.origin,
-                                                        false);
-            }
-          }
-        }
-      }
-
-      // Check to see if the 'webapp' is app/privileged/certified.
-      let appStatus;
-      switch (AppsUtils.getAppManifestStatus(aApp.manifest)) {
-      case Ci.nsIPrincipal.APP_STATUS_CERTIFIED:
-        appStatus = "certified";
-        break;
-      case Ci.nsIPrincipal.APP_STATUS_PRIVILEGED:
-        appStatus = "privileged";
-        break;
-      case Ci.nsIPrincipal.APP_STATUS_INSTALLED:
-        appStatus = "app";
-        break;
-      default:
-        // Cannot determine app type, abort install by throwing an error.
-        throw new Error("PermissionsInstaller.jsm: " +
-                        "Cannot determine the app's status. Install cancelled.");
-        break;
-      }
-
-      this._setPermission("indexedDB", "allow", aApp);
-
-      // Add the appcache related permissions. We allow it for all kinds of
-      // apps.
-      if (newManifest.appcache_path) {
-        this._setPermission("offline-app", "allow", aApp);
-        this._setPermission("pin-app", "allow", aApp);
-      }
-
-      for (let permName in newManifest.permissions) {
-        if (!PermissionsTable[permName]) {
-          Cu.reportError("PermissionsInstaller.jsm: '" + permName + "'" +
-                         " is not a valid Webapps permission name.");
-          dump("PermissionsInstaller.jsm: '" + permName + "'" +
-               " is not a valid Webapps permission name.");
-          continue;
-        }
-
-        let expandedPermNames =
-          expandPermissions(permName,
-                            newManifest.permissions[permName].access);
-        for (let idx in expandedPermNames) {
-
-          let isPromptPermission =
-            PermissionsTable[permName][appStatus] === PROMPT_ACTION;
-
-          // We silently upgrade the permission to whatever the permission
-          // is for certified apps (ALLOW or PROMPT) only if the
-          // following holds true:
-          // * The app is preinstalled
-          // * The permission that would be granted is PROMPT
-          // * The app is privileged
-          let permission =
-            aApp.isPreinstalled && isPromptPermission &&
-            appStatus === "privileged"
-                ? PermissionsTable[permName]["certified"]
-                : PermissionsTable[permName][appStatus];
-
-          let permValue = PERM_TO_STRING[permission];
-          if (isPromptPermission) {
-            // If the permission is prompt, keep the current value. This will
-            // work even on a system update, with the caveat that if a
-            // ALLOW/DENY permission is changed to PROMPT then the system should
-            // inform the user that he can now change a permission that he could
-            // not change before.
-            permValue =
-              PermissionSettingsModule.getPermission(expandedPermNames[idx],
-                                                     aApp.manifestURL,
-                                                     aApp.origin,
-                                                     false,
-                                                     aApp.isCachedPackage);
-            if (permValue === "unknown") {
-              permValue = PERM_TO_STRING[permission];
-            }
-          }
-
-          this._setPermission(expandedPermNames[idx], permValue, aApp);
-        }
-      }
-    }
-    catch (ex) {
-      dump("Caught webapps install permissions error for " + aApp.origin +
-        " : " + ex + "\n");
-      Cu.reportError(ex);
-      if (aOnError) {
-        aOnError();
-      }
-    }
-  },
-
-  /**
-   * Set a permission value.
-   * @param string aPermName
-   *        The permission name.
-   * @param string aPermValue
-   *        The permission value.
-   * @param object aApp
-   *        The just-installed app configuration.
-   *        The properties used are manifestURL, origin, appId, isCachedPackage.
-   * @returns void
-   **/
-  _setPermission: function setPermission(aPermName, aPermValue, aApp) {
-    PermissionSettingsModule.addPermission({
-      type: aPermName,
-      origin: aApp.origin,
-      manifestURL: aApp.manifestURL,
-      value: aPermValue,
-      browserFlag: false,
-      localId: aApp.localId,
-      isCachedPackage: aApp.isCachedPackage,
-    });
-  }
-};
--- a/dom/apps/moz.build
+++ b/dom/apps/moz.build
@@ -8,15 +8,14 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit
 
 EXTRA_COMPONENTS += [
     'AppsService.js',
     'AppsService.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'AppsServiceChild.jsm',
-    'PermissionsInstaller.jsm',
     'PermissionsTable.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'AppsUtils.jsm',
 ]
deleted file mode 100644
--- a/dom/interfaces/permission/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 += [
-    'nsIPermissionPromptService.idl',
-]
-
-XPIDL_MODULE = 'dom_permissionsettings'
-
deleted file mode 100644
--- a/dom/interfaces/permission/nsIPermissionPromptService.idl
+++ /dev/null
@@ -1,20 +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 "nsISupports.idl"
-
-interface nsIContentPermissionRequest;
-
-/**
- * Generic permission service for access to WebAPIs, hardware, capabilities.
- */
-[scriptable, uuid(e5f953b3-a6ca-444e-a88d-cdc81383741c)]
-interface nsIPermissionPromptService : nsISupports 
-{
-  /**
-   * Checks if the capability requires a permission, fires the corresponding cancel() 
-   * or allow() method in aRequest after consulting PermissionSettings, etc.
-   */
-  void getPermission(in nsIContentPermissionRequest aRequest);
-};
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -22,17 +22,16 @@ interfaces = [
     'xpath',
     'xul',
     'security',
     'storage',
     'json',
     'offline',
     'geolocation',
     'notification',
-    'permission',
     'svg',
     'smil',
     'apps',
     'push',
 ]
 
 DIRS += ['interfaces/' + i for i in interfaces]
 
deleted file mode 100644
--- a/dom/permission/PermissionPromptService.js
+++ /dev/null
@@ -1,95 +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";
-
-/* static functions */
-var DEBUG = 0;
-var debug;
-if (DEBUG) {
-  debug = function (s) { dump("-*- PermissionPromptService: " + s + "\n"); };
-}
-else {
-  debug = function (s) {};
-}
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
-
-const PERMISSIONPROMPTSERVICE_CONTRACTID = "@mozilla.org/permission-prompt-service;1";
-const PERMISSIONPROMPTSERVICE_CID = Components.ID("{e5f953b3-a6ca-444e-a88d-cdc81383741c}");
-const permissionPromptService = Ci.nsIPermissionPromptService;
-
-var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
-var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
-
-function makePrompt()
-{
-  return Cc["@mozilla.org/content-permission/prompt;1"].createInstance(Ci.nsIContentPermissionPrompt);
-}
-
-function PermissionPromptService()
-{
-  debug("Constructor");
-}
-
-PermissionPromptService.prototype = {
-
-  classID : PERMISSIONPROMPTSERVICE_CID,
-
-  QueryInterface : XPCOMUtils.generateQI([permissionPromptService, Ci.nsIObserver]),
-
-  classInfo : XPCOMUtils.generateCI({classID: PERMISSIONPROMPTSERVICE_CID,
-                                     contractID: PERMISSIONPROMPTSERVICE_CONTRACTID,
-                                     classDescription: "PermissionPromptService",
-                                     interfaces: [permissionPromptService]
-                                     }),
-  /**
-   * getPermission
-   *   Ask for permission for an API, device, etc.
-   * @param nsIContentPermissionRequest aRequest
-   * @returns void
-   **/
-  getPermission: function PS_getPermission(aRequest)
-  {
-    if (!(aRequest instanceof Ci.nsIContentPermissionRequest)) {
-      throw new Error("PermissionService.getPermission: "
-                      + "2nd argument must be type 'nsIContentPermissionRequest'");
-    }
-
-    // Only allow exactly one permission request here.
-    let types = aRequest.types.QueryInterface(Ci.nsIArray);
-    if (types.length != 1) {
-      aRequest.cancel();
-      return;
-    }
-    let reqType = types.queryElementAt(0, Ci.nsIContentPermissionType);
-
-    let type = reqType.access !== "unused" ? reqType.type + "-" + reqType.access
-                                           : reqType.type;
-    let perm =
-      permissionManager.testExactPermissionFromPrincipal(aRequest.principal, type);
-
-    switch (perm) {
-      case Ci.nsIPermissionManager.ALLOW_ACTION:
-        aRequest.allow();
-        break;
-      case Ci.nsIPermissionManager.PROMPT_ACTION:
-        makePrompt().prompt(aRequest);
-        break;
-      case Ci.nsIPermissionManager.DENY_ACTION:
-      case Ci.nsIPermissionManager.UNKNOWN_ACTION:
-    default:
-      aRequest.cancel();
-      break;
-    }
-  },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PermissionPromptService]);
deleted file mode 100644
--- a/dom/permission/PermissionPromptService.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {e5f953b3-a6ca-444e-a88d-cdc81383741c} PermissionPromptService.js
-contract @mozilla.org/permission-prompt-service;1 {e5f953b3-a6ca-444e-a88d-cdc81383741c}
deleted file mode 100644
--- a/dom/permission/PermissionSettings.js
+++ /dev/null
@@ -1,136 +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(aMsg) {
-  //dump("-*- PermissionSettings.js: " + aMsg + "\n");
-}
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PermissionsTable.jsm");
-
-var cpm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
-
-// PermissionSettings
-
-const PERMISSIONSETTINGS_CONTRACTID = "@mozilla.org/permissionSettings;1";
-const PERMISSIONSETTINGS_CID        = Components.ID("{cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}");
-
-function PermissionSettings()
-{
-  debug("Constructor");
-}
-
-XPCOMUtils.defineLazyServiceGetter(this,
-                                   "appsService",
-                                   "@mozilla.org/AppsService;1",
-                                   "nsIAppsService");
-
-PermissionSettings.prototype = {
-  get: function get(aPermName, aManifestURL, aOrigin, aBrowserFlag) {
-    // TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
-    debug("Get called with: " + aPermName + ", " + aManifestURL + ", " + aOrigin + ", " + aBrowserFlag);
-    let uri = Services.io.newURI(aOrigin, null, null);
-    let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
-    let principal =
-      Services.scriptSecurityManager.createCodebasePrincipal(uri,
-                                                             {appId: appID,
-                                                              inIsolatedMozBrowser: aBrowserFlag});
-    let result = Services.perms.testExactPermanentPermission(principal, aPermName);
-
-    switch (result)
-    {
-      case Ci.nsIPermissionManager.UNKNOWN_ACTION:
-        return "unknown";
-      case Ci.nsIPermissionManager.ALLOW_ACTION:
-        return "allow";
-      case Ci.nsIPermissionManager.DENY_ACTION:
-        return "deny";
-      case Ci.nsIPermissionManager.PROMPT_ACTION:
-        return "prompt";
-      default:
-        dump("Unsupported PermissionSettings Action!\n");
-        return "unknown";
-    }
-  },
-
-  isExplicit: function isExplicit(aPermName, aManifestURL, aOrigin,
-                                  aBrowserFlag) {
-    // TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
-    debug("isExplicit: " + aPermName + ", " + aManifestURL + ", " + aOrigin);
-    let uri = Services.io.newURI(aOrigin, null, null);
-    let app = appsService.getAppByManifestURL(aManifestURL);
-    let principal = Services.scriptSecurityManager
-      .createCodebasePrincipal(uri, {appId: app.localId, inIsolatedMozBrowser: aBrowserFlag});
-
-    return isExplicitInPermissionsTable(aPermName,
-                                        principal.appStatus);
-  },
-
-  set: function set(aPermName, aPermValue, aManifestURL, aOrigin,
-                    aBrowserFlag) {
-    debug("Set called with: " + aPermName + ", " + aManifestURL + ", " +
-          aOrigin + ", " + aPermValue + ", " + aBrowserFlag);
-    let currentPermValue = this.get(aPermName, aManifestURL, aOrigin,
-                                    aBrowserFlag);
-    let action;
-    // Check for invalid calls so that we throw an exception rather than get
-    // killed by parent process
-    if (currentPermValue === "unknown" ||
-        aPermValue === "unknown" ||
-        !this.isExplicit(aPermName, aManifestURL, aOrigin, aBrowserFlag)) {
-      let errorMsg = "PermissionSettings.js: '" + aPermName + "'" +
-                     " is an implicit permission for '" + aManifestURL +
-                     "' or the permission isn't set";
-      Cu.reportError(errorMsg);
-      throw new Components.Exception(errorMsg);
-    }
-
-    cpm.sendSyncMessage("PermissionSettings:AddPermission", {
-      type: aPermName,
-      origin: aOrigin,
-      manifestURL: aManifestURL,
-      value: aPermValue,
-      browserFlag: aBrowserFlag
-    });
-  },
-
-  remove: function remove(aPermName, aManifestURL, aOrigin) {
-    // TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
-    let uri = Services.io.newURI(aOrigin, null, null);
-    let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
-    let principal =
-      Services.scriptSecurityManager.createCodebasePrincipal(uri,
-                                                             {appId: appID,
-                                                              inIsolatedMozBrowser: true});
-
-    if (principal.appStatus !== Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
-      let errorMsg = "PermissionSettings.js: '" + aOrigin + "'" +
-                     " is installed or permission is implicit, cannot remove '" +
-                     aPermName + "'.";
-      Cu.reportError(errorMsg);
-      throw new Components.Exception(errorMsg);
-    }
-
-    // PermissionSettings.jsm handles delete when value is "unknown"
-    cpm.sendSyncMessage("PermissionSettings:AddPermission", {
-      type: aPermName,
-      origin: aOrigin,
-      manifestURL: aManifestURL,
-      value: "unknown",
-      browserFlag: true
-    });
-  },
-
-  classID : PERMISSIONSETTINGS_CID,
-  QueryInterface : XPCOMUtils.generateQI([])
-}
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PermissionSettings])
deleted file mode 100644
--- a/dom/permission/PermissionSettings.jsm
+++ /dev/null
@@ -1,185 +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("-*- PermissionSettings Module: " + s + "\n");
-}
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-this.EXPORTED_SYMBOLS = ["PermissionSettingsModule"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PermissionsTable.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
-                                   "@mozilla.org/parentprocessmessagemanager;1",
-                                   "nsIMessageListenerManager");
-
-XPCOMUtils.defineLazyServiceGetter(this,
-                                   "appsService",
-                                   "@mozilla.org/AppsService;1",
-                                   "nsIAppsService");
-
-this.PermissionSettingsModule = {
-  init: function init() {
-    debug("Init");
-    ppmm.addMessageListener("PermissionSettings:AddPermission", this);
-    Services.obs.addObserver(this, "profile-before-change", false);
-  },
-
-
-  _isChangeAllowed: function(aPrincipal, aPermName, aAction) {
-    // Bug 812289:
-    // Change is allowed from a child process when all of the following
-    // conditions stand true:
-    //   * the action isn't "unknown" (so the change isn't a delete) if the app
-    //     is installed
-    //   * the permission already exists on the database
-    //   * the permission is marked as explicit on the permissions table
-    // Note that we *have* to check the first two conditions here because
-    // permissionManager doesn't know if it's being called as a result of
-    // a parent process or child process request. We could check
-    // if the permission is actually explicit (and thus modifiable) or not
-    // on permissionManager also but we currently don't.
-    let perm =
-      Services.perms.testExactPermissionFromPrincipal(aPrincipal,aPermName);
-    let isExplicit = isExplicitInPermissionsTable(aPermName, aPrincipal.appStatus);
-
-    return (aAction === "unknown" &&
-            aPrincipal.appStatus === Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) ||
-           (aAction !== "unknown" &&
-            (perm !== Ci.nsIPermissionManager.UNKNOWN_ACTION) &&
-            isExplicit);
-  },
-
-  addPermission: function addPermission(aData, aCallbacks) {
-
-    this._internalAddPermission(aData, true, aCallbacks);
-
-  },
-
-
-  _internalAddPermission: function _internalAddPermission(aData, aAllowAllChanges, aCallbacks) {
-    // TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.jsm.
-    let app;
-    let principal;
-    // Test if app is cached (signed streamable package) or installed via DOMApplicationRegistry
-    if (aData.isCachedPackage) {
-      // If the app is from packaged web app, the origin includes origin attributes already.
-      principal =
-        Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(aData.origin);
-      app = {localId: principal.appId};
-    } else {
-      app = appsService.getAppByManifestURL(aData.manifestURL);
-      let uri = Services.io.newURI(aData.origin, null, null);
-      principal =
-        Services.scriptSecurityManager.createCodebasePrincipal(uri,
-                                                               {appId: app.localId,
-                                                                inIsolatedMozBrowser: aData.browserFlag});
-    }
-
-    let action;
-    switch (aData.value)
-    {
-      case "unknown":
-        action = Ci.nsIPermissionManager.UNKNOWN_ACTION;
-        break;
-      case "allow":
-        action = Ci.nsIPermissionManager.ALLOW_ACTION;
-        break;
-      case "deny":
-        action = Ci.nsIPermissionManager.DENY_ACTION;
-        break;
-      case "prompt":
-        action = Ci.nsIPermissionManager.PROMPT_ACTION;
-        break;
-      default:
-        dump("Unsupported PermisionSettings Action: " + aData.value +"\n");
-        action = Ci.nsIPermissionManager.UNKNOWN_ACTION;
-    }
-
-    if (aAllowAllChanges ||
-        this._isChangeAllowed(principal, aData.type, aData.value)) {
-      debug("add: " + aData.origin + " " + app.localId + " " + action);
-      Services.perms.addFromPrincipal(principal, aData.type, action);
-      return true;
-    } else {
-      debug("add Failure: " + aData.origin + " " + app.localId + " " + action);
-      return false; // This isn't currently used, see comment on setPermission
-    }
-  },
-
-  getPermission: function getPermission(aPermName, aManifestURL, aOrigin, aBrowserFlag, aIsCachedPackage) {
-    // TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.jsm
-    debug("getPermission: " + aPermName + ", " + aManifestURL + ", " + aOrigin);
-    let principal;
-    // Test if app is cached (signed streamable package) or installed via DOMApplicationRegistry
-    if (aIsCachedPackage) {
-      // If the app is from packaged web app, the origin includes origin attributes already.
-      principal =
-        Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(aOrigin);
-    } else {
-      let uri = Services.io.newURI(aOrigin, null, null);
-      let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
-      principal =
-        Services.scriptSecurityManager.createCodebasePrincipal(uri,
-                                                               {appId: appID,
-                                                                inIsolatedMozBrowser: aBrowserFlag});
-    }
-    let result = Services.perms.testExactPermissionFromPrincipal(principal, aPermName);
-    switch (result)
-    {
-      case Ci.nsIPermissionManager.UNKNOWN_ACTION:
-        return "unknown";
-      case Ci.nsIPermissionManager.ALLOW_ACTION:
-        return "allow";
-      case Ci.nsIPermissionManager.DENY_ACTION:
-        return "deny";
-      case Ci.nsIPermissionManager.PROMPT_ACTION:
-        return "prompt";
-      default:
-        dump("Unsupported PermissionSettings Action!\n");
-        return "unknown";
-    }
-  },
-
-  removePermission: function removePermission(aPermName, aManifestURL, aOrigin, aBrowserFlag, aIsCachedPackage) {
-    let data = {
-      type: aPermName,
-      origin: aOrigin,
-      manifestURL: aManifestURL,
-      value: "unknown",
-      browserFlag: aBrowserFlag,
-      isCachedPackage: aIsCachedPackage
-    };
-    this._internalAddPermission(data, true);
-  },
-
-  observe: function observe(aSubject, aTopic, aData) {
-    ppmm.removeMessageListener("PermissionSettings:AddPermission", this);
-    Services.obs.removeObserver(this, "profile-before-change");
-    ppmm = null;
-  },
-
-  receiveMessage: function receiveMessage(aMessage) {
-    debug("PermissionSettings::receiveMessage " + aMessage.name);
-    let mm = aMessage.target;
-    let msg = aMessage.data;
-
-    let result;
-    switch (aMessage.name) {
-      case "PermissionSettings:AddPermission":
-        this._internalAddPermission(msg, false);
-        break;
-    }
-  }
-}
-
-PermissionSettingsModule.init();
deleted file mode 100644
--- a/dom/permission/PermissionSettings.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431} PermissionSettings.js
-contract @mozilla.org/permissionSettings;1 {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}
--- a/dom/permission/moz.build
+++ b/dom/permission/moz.build
@@ -11,27 +11,16 @@ EXPORTS.mozilla.dom += [
 
 UNIFIED_SOURCES += [
     'PermissionObserver.cpp',
     'Permissions.cpp',
     'PermissionStatus.cpp',
     'PermissionUtils.cpp',
 ]
 
-EXTRA_COMPONENTS += [
-    'PermissionPromptService.js',
-    'PermissionPromptService.manifest',
-    'PermissionSettings.js',
-    'PermissionSettings.manifest',
-]
-
-EXTRA_JS_MODULES += [
-    'PermissionSettings.jsm',
-]
-
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 if CONFIG['MOZ_TIME_MANAGER']:
     MOCHITEST_MANIFESTS += ['tests/mochitest-time.ini']
 
 FINAL_LIBRARY = 'xul'
--- a/dom/permission/tests/mochitest.ini
+++ b/dom/permission/tests/mochitest.ini
@@ -4,18 +4,16 @@ support-files =
   file_shim.html
   file_empty.html
 
 [test_browser.html]
 skip-if = true
 [test_idle.html]
 # skip-if = (toolkit == 'gonk' && debug) #debug-only failure
 skip-if = true
-[test_permissions.html]
-skip-if = true
 [test_permissions_api.html]
 [test_power.html]
 skip-if = true
 [test_presentation-device-manage.html]
 skip-if = true
 [test_systemXHR.html]
 [test_tcp-socket.html]
 skip-if = true
deleted file mode 100644
--- a/dom/permission/tests/test_permissions.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=815105
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 815105 </title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script type="application/javascript;version=1.8" src="file_framework.js"></script>
-<script type="application/javascript;version=1.8">
-var gData = [
-  {
-    perm: ["permissions"],
-    obj: "mozPermissionSettings",
-    webidl: "PermissionSettings",
-    settings: [["dom.mozPermissionSettings.enabled", true]],
-  },
-]
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/webidl/PermissionSettings.webidl
+++ /dev/null
@@ -1,20 +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 at http://mozilla.org/MPL/2.0/. */
-
-[JSImplementation="@mozilla.org/permissionSettings;1",
- ChromeOnly,
- Pref="dom.mozPermissionSettings.enabled",
- NavigatorProperty="mozPermissionSettings"]
-interface PermissionSettings
-{
-  DOMString get(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
-
-  void set(DOMString permission, DOMString value, DOMString manifestURI, DOMString origin, boolean browserFlag);
-
-  boolean isExplicit(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
-
-  // Removing a permission is only allowed for pages with a different origin than the app
-  // and pages that have browserFlag=true, so remove() doesn't have a browserFlag parameter.
-  void remove(DOMString permission, DOMString manifestURI, DOMString origin);
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -350,17 +350,16 @@ WEBIDL_FILES = [
     'PerformanceMeasure.webidl',
     'PerformanceNavigation.webidl',
     'PerformanceObserver.webidl',
     'PerformanceObserverEntryList.webidl',
     'PerformanceResourceTiming.webidl',
     'PerformanceTiming.webidl',
     'PeriodicWave.webidl',
     'Permissions.webidl',
-    'PermissionSettings.webidl',
     'PermissionStatus.webidl',
     'Plugin.webidl',
     'PluginArray.webidl',
     'PointerEvent.webidl',
     'PopupBoxObject.webidl',
     'Pose.webidl',
     'Position.webidl',
     'PositionError.webidl',
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -129,17 +129,16 @@
 @BINPATH@/components/dom_power.xpt
 #ifdef MOZ_ANDROID_GCM
 @BINPATH@/components/dom_push.xpt
 #endif
 @BINPATH@/components/dom_quota.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_security.xpt
 @BINPATH@/components/dom_settings.xpt
-@BINPATH@/components/dom_permissionsettings.xpt
 @BINPATH@/components/dom_sidebar.xpt
 @BINPATH@/components/dom_mobilemessage.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_system.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_tv.xpt
 #ifdef MOZ_WEBSPEECH
@@ -276,20 +275,16 @@
 @BINPATH@/components/SettingsManager.js
 @BINPATH@/components/SettingsManager.manifest
 @BINPATH@/components/BrowserElementParent.manifest
 @BINPATH@/components/BrowserElementParent.js
 @BINPATH@/components/FeedProcessor.manifest
 @BINPATH@/components/FeedProcessor.js
 @BINPATH@/components/WellKnownOpportunisticUtils.js
 @BINPATH@/components/WellKnownOpportunisticUtils.manifest
-@BINPATH@/components/PermissionSettings.js
-@BINPATH@/components/PermissionSettings.manifest
-@BINPATH@/components/PermissionPromptService.js
-@BINPATH@/components/PermissionPromptService.manifest
 @BINPATH@/components/nsDNSServiceDiscovery.manifest
 @BINPATH@/components/nsDNSServiceDiscovery.js
 @BINPATH@/components/toolkitsearch.manifest
 @BINPATH@/components/nsSearchService.js
 @BINPATH@/components/nsSidebar.js
 @BINPATH@/components/passwordmgr.manifest
 @BINPATH@/components/nsLoginInfo.js
 @BINPATH@/components/nsLoginManager.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4819,17 +4819,16 @@ pref("dom.push.http2.reset_retry_count_a
 pref("dom.push.http2.maxRetries", 2);
 pref("dom.push.http2.retryInterval", 5000);
 
 // WebNetworkStats
 pref("dom.mozNetworkStats.enabled", false);
 
 // WebSettings
 pref("dom.mozSettings.enabled", false);
-pref("dom.mozPermissionSettings.enabled", false);
 
 // W3C touch events
 // 0 - disabled, 1 - enabled, 2 - autodetect
 // Autodetection is currently only supported on Windows and GTK3
 #if defined(XP_MACOSX)
 pref("dom.w3c_touch_events.enabled", 0);
 #else
 pref("dom.w3c_touch_events.enabled", 2);
--- a/tools/lint/eslint/modules.json
+++ b/tools/lint/eslint/modules.json
@@ -163,17 +163,16 @@
   "OutputGenerator.jsm": ["UtteranceGenerator", "BrailleGenerator"],
   "PageMenu.jsm": ["PageMenuParent", "PageMenuChild"],
   "PageThumbs.jsm": ["PageThumbs", "PageThumbsStorage"],
   "Parser.jsm": ["Parser", "ParserHelpers", "SyntaxTreeVisitor"],
   "parsingTestHelpers.jsm": ["generateURIsFromDirTree"],
   "passwords.js": ["PasswordEngine", "LoginRec", "PasswordValidator"],
   "passwords.jsm": ["Password", "DumpPasswords"],
   "PdfJsNetwork.jsm": ["NetworkManager"],
-  "PermissionSettings.jsm": ["PermissionSettingsModule"],
   "PermissionsTable.jsm": ["PermissionsTable", "PermissionsReverseTable", "expandPermissions", "appendAccessToPermName", "isExplicitInPermissionsTable", "AllPossiblePermissions"],
   "PhoneNumberMetaData.jsm": ["PHONE_NUMBER_META_DATA"],
   "PlacesUtils.jsm": ["PlacesUtils", "PlacesAggregatedTransaction", "PlacesCreateFolderTransaction", "PlacesCreateBookmarkTransaction", "PlacesCreateSeparatorTransaction", "PlacesCreateLivemarkTransaction", "PlacesMoveItemTransaction", "PlacesRemoveItemTransaction", "PlacesEditItemTitleTransaction", "PlacesEditBookmarkURITransaction", "PlacesSetItemAnnotationTransaction", "PlacesSetPageAnnotationTransaction", "PlacesEditBookmarkKeywordTransaction", "PlacesEditBookmarkPostDataTransaction", "PlacesEditItemDateAddedTransaction", "PlacesEditItemLastModifiedTransaction", "PlacesSortFolderByNameTransaction", "PlacesTagURITransaction", "PlacesUntagURITransaction"],
   "PluginProvider.jsm": [],
   "PointerAdapter.jsm": ["PointerRelay", "PointerAdapter"],
   "policies.js": ["ErrorHandler", "SyncScheduler"],
   "prefs.js": ["PrefsEngine", "PrefRec"],
   "prefs.jsm": ["Preference"],