Bug 1383207 - Using the keyboard shortcut to select-all in the Cookies dialog should select all the visible cookies. r?evanxd draft
authorJared Wein <jwein@mozilla.com>
Tue, 24 Oct 2017 14:59:34 -0400
changeset 686076 f400f13e1609c4d0649c230f0e3a44340b32e68d
parent 681681 7b75416fb54c6733b7403e340457007658c42c14
child 737291 c271cdb551af3ebffea4eeb60bcd17c47b104d39
push id86086
push userbmo:jaws@mozilla.com
push dateWed, 25 Oct 2017 11:42:54 +0000
reviewersevanxd
bugs1383207
milestone58.0a1
Bug 1383207 - Using the keyboard shortcut to select-all in the Cookies dialog should select all the visible cookies. r?evanxd MozReview-Commit-ID: KmIapWrr0Zm
browser/components/preferences/cookies.js
browser/components/preferences/cookies.xul
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -729,16 +729,24 @@ var gCookiesWindow = {
   },
 
   onCookieKeyPress(aEvent) {
     if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE ||
         (AppConstants.platform == "macosx" &&
         aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE)) {
       this.deleteCookie();
       aEvent.preventDefault();
+    } else if (aEvent.getModifierState("Accel") &&
+               document.getElementById("key_selectAll")
+                       .getAttribute("key")
+                       .toLocaleLowerCase()
+                       .charCodeAt(0) == aEvent.charCode) {
+      let view = gCookiesWindow._view;
+      view.selection.selectAll();
+      aEvent.preventDefault();
     }
   },
 
   _lastSortProperty: "",
   _lastSortAscending: false,
   sort(aProperty) {
     var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
     // Sort the Non-Filtered Host Collections
--- a/browser/components/preferences/cookies.xul
+++ b/browser/components/preferences/cookies.xul
@@ -3,17 +3,22 @@
 # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 # 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/.
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/cookies.dtd" >
+<!DOCTYPE dialog [
+<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
+%browserDTD;
+<!ENTITY % cookiesDTD SYSTEM "chrome://browser/locale/preferences/cookies.dtd">
+%cookiesDTD;
+]>
 
 <window id="CookiesDialog" windowtype="Browser:Cookies"
         class="windowDialog" title="&window.title;"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         style="width: &window.width;;"
         onload="gCookiesWindow.init();"
         onunload="gCookiesWindow.uninit();"
         persist="screenX screenY width height"
@@ -22,16 +27,17 @@
   <script src="chrome://browser/content/preferences/cookies.js"/>
 
   <stringbundle id="bundlePreferences"
                 src="chrome://browser/locale/preferences/preferences.properties"/>
 
   <keyset>
     <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
     <key key="&focusSearch1.key;" modifiers="accel" oncommand="gCookiesWindow.focusFilterBox();"/>
+    <key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
   </keyset>
 
   <vbox flex="1" class="contentPane largeDialogContainer">
     <hbox align="center">
       <textbox type="search" id="filter" flex="1"
                aria-controls="cookiesList"
                oncommand="gCookiesWindow.filter();"
                placeholder="&searchFilter.label;"