Bug 1342472 - It is no longer possible to use backspace on Mac to delete a site permission (AppConstants is undefined). r?jaws draft
authorMark Banner <standard8@mozilla.com>
Fri, 24 Feb 2017 17:24:06 +0000
changeset 490053 cf1f6dbed8c5ff887f43450d82296e90fd3a4432
parent 489857 7ef1e9abd296a8edc39b7efc8d637767ba2f77ed
child 547155 41fc20dba7624b2b805b2f5b652dfb105bd7e8a8
push id46984
push userbmo:standard8@mozilla.com
push dateMon, 27 Feb 2017 16:16:19 +0000
reviewersjaws
bugs1342472
milestone54.0a1
Bug 1342472 - It is no longer possible to use backspace on Mac to delete a site permission (AppConstants is undefined). r?jaws MozReview-Commit-ID: EqZ5EELLMpT
browser/components/preferences/permissions.js
--- a/browser/components/preferences/permissions.js
+++ b/browser/components/preferences/permissions.js
@@ -1,16 +1,17 @@
 /* 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/. */
 
 // Imported via permissions.xul.
 /* import-globals-from ../../../toolkit/content/treeUtils.js */
 
 Components.utils.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://gre/modules/AppConstants.jsm");
 
 const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
 const nsICookiePermission = Components.interfaces.nsICookiePermission;
 
 const NOTIFICATION_FLUSH_PERMISSIONS = "flush-pending-permissions";
 
 function Permission(principal, type, capability) {
   this.principal = principal;
@@ -329,16 +330,17 @@ var gPermissionManager = {
   },
 
   onPermissionKeyPress(aEvent) {
     if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE) {
       this.onPermissionDeleted();
     } else if (AppConstants.platform == "macosx" &&
                aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE) {
       this.onPermissionDeleted();
+      aEvent.preventDefault();
     }
   },
 
   _lastPermissionSortColumn: "",
   _lastPermissionSortAscending: false,
   _permissionsComparator(a, b) {
     return a.toLowerCase().localeCompare(b.toLowerCase());
   },