Bug 1455888 - Added a check to Policies.jsm addAllowDenyPermissions to throw an error when the user tries to add built-in sites to the permission manager r=Felipe
authorkanika <kanika16047@iiitd.ac.in>
Wed, 16 May 2018 21:36:25 +0530
changeset 418706 7cb5b98fa05a94e63e7de941603d05db36257781
parent 418705 ad016230e0bdb2e6b069387abac1b3be5fcb1459
child 418707 f4a56903882a4b6a9c8fa96b80228573cc2a67ab
push id34010
push userbtara@mozilla.com
push dateThu, 17 May 2018 22:02:46 +0000
treeherdermozilla-central@fdd6d3850e7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1455888
milestone62.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 1455888 - Added a check to Policies.jsm addAllowDenyPermissions to throw an error when the user tries to add built-in sites to the permission manager r=Felipe MozReview-Commit-ID: JIRr6BtK3x8
browser/components/enterprisepolicies/Policies.jsm
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -774,20 +774,25 @@ function setDefaultPref(prefName, prefVa
  * @param {array} blockList
  *        The list of URLs to be set as DENY_ACTION for the chosen permission.
  */
 function addAllowDenyPermissions(permissionName, allowList, blockList) {
   allowList = allowList || [];
   blockList = blockList || [];
 
   for (let origin of allowList) {
-    Services.perms.add(origin,
-                       permissionName,
-                       Ci.nsIPermissionManager.ALLOW_ACTION,
-                       Ci.nsIPermissionManager.EXPIRE_POLICY);
+    try {
+      Services.perms.add(origin,
+                         permissionName,
+                         Ci.nsIPermissionManager.ALLOW_ACTION,
+                         Ci.nsIPermissionManager.EXPIRE_POLICY);
+    } catch (ex) {
+      log.error(`Added by default for ${permissionName} permission in the permission
+      manager - ${origin.spec}`);
+    }
   }
 
   for (let origin of blockList) {
     Services.perms.add(origin,
                        permissionName,
                        Ci.nsIPermissionManager.DENY_ACTION,
                        Ci.nsIPermissionManager.EXPIRE_POLICY);
   }