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
--- 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());
},