Bug 661831 - In about:permissions, make Ctrl+f focus the filter box instead of invoking the find bar. r=jaws

This commit is contained in:
Steffen Wilberg 2015-08-25 10:35:31 +02:00
parent 3d4e87487c
commit 998753eea5
3 changed files with 23 additions and 2 deletions

View File

@ -355,6 +355,14 @@ let AboutPermissions = {
*/
_sites: {},
/**
* Using a getter for sitesFilter to avoid races with tests.
*/
get sitesFilter () {
delete this.sitesFilter;
return this.sitesFilter = document.getElementById("sites-filter");
},
sitesList: null,
_selectedSite: null,
@ -620,7 +628,7 @@ let AboutPermissions = {
aSite.listitem = item;
// Make sure to only display relevant items when list is filtered
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
let filterValue = this.sitesFilter.value.toLowerCase();
item.collapsed = aSite.principal.origin.toLowerCase().indexOf(filterValue) == -1;
(this._listFragment || this.sitesList).appendChild(item);
@ -643,7 +651,7 @@ let AboutPermissions = {
*/
filterSitesList: function() {
let siteItems = this.sitesList.children;
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
let filterValue = this.sitesFilter.value.toLowerCase();
if (filterValue == "") {
for (let i = 0; i < siteItems.length; i++) {
@ -880,6 +888,13 @@ let AboutPermissions = {
window.openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies", "", {filterString : selectedHost});
}
},
/**
* Focusses the filter box.
*/
focusFilterBox: function() {
this.sitesFilter.focus();
}
}

View File

@ -25,6 +25,10 @@
<script type="application/javascript"
src="chrome://browser/content/preferences/aboutPermissions.js"/>
<keyset>
<key key="&focusSearch.key;" modifiers="accel" oncommand="AboutPermissions.focusFilterBox();"/>
</keyset>
<hbox flex="1" id="permissions-content" class="main-content">
<vbox id="sites-box">

View File

@ -44,3 +44,5 @@
<!ENTITY push.label "Receive Push Notifications">
<!ENTITY camera.label "Use the Camera">
<!ENTITY microphone.label "Use the Microphone">
<!ENTITY focusSearch.key "f">