Bug 1342472 - It is no longer possible to use backspace on Mac to delete a site permission (AppConstants is undefined). r=jaws
authorMark Banner <standard8@mozilla.com>
Fri, 24 Feb 2017 17:24:06 +0000
changeset 345035 18bf0db7a24577aac088ee3a395f7ee852e3abd4
parent 345034 fa0e8a07bd1e49ebbb13d75d4dd527815b67dde3
child 345036 fc69ac0dc73da171c0135ad3e3578ec02d1a08d9
push id31428
push userkwierso@gmail.com
push dateMon, 27 Feb 2017 21:12:30 +0000
treeherdermozilla-central@08992bd2558c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1342472
milestone54.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 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());
   },