Bug 1342472 - It is no longer possible to use backspace on Mac to delete a site permission (AppConstants is undefined). r=jaws a=gchang
authorMark Banner <standard8@mozilla.com>
Fri, 24 Feb 2017 17:24:06 +0000
changeset 378860 8de9c4ef0fd944d1eb78f870cdc1a0d2721b041c
parent 378859 5b0acf90608b98543f31b06b3f145ba49e39d50e
child 378861 a219509df28e8274bed048aec27d358f3e251a0c
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, gchang
bugs1342472
milestone53.0a2
Bug 1342472 - It is no longer possible to use backspace on Mac to delete a site permission (AppConstants is undefined). r=jaws a=gchang 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());
   },