Bug 1667781 - Refactored ETP blocklist dialog to use dialog element. r=Gijs,fluent-reviewers,preferences-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D92269
This commit is contained in:
pbz 2020-10-07 18:46:22 +00:00
parent 5a1511dfb0
commit e7019d518b
5 changed files with 21 additions and 26 deletions

View File

@ -60,16 +60,9 @@ var gBlocklistManager = {
},
},
onWindowKeyPress(event) {
if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
window.close();
} else if (event.keyCode == KeyEvent.DOM_VK_RETURN) {
gBlocklistManager.onApplyChanges();
}
},
onLoad() {
this.init();
document.addEventListener("dialogaccept", () => this.onApplyChanges());
},
init() {
@ -124,8 +117,6 @@ var gBlocklistManager = {
listmanager.forceUpdates(trackingTable);
}
}
window.close();
},
async _loadBlockLists() {

View File

@ -15,8 +15,12 @@
xmlns:html="http://www.w3.org/1999/xhtml"
onload="gBlocklistManager.onLoad();"
onunload="gBlocklistManager.uninit();"
persist="screenX screenY width height"
onkeypress="gBlocklistManager.onWindowKeyPress(event);">
persist="screenX screenY width height">
<dialog
buttons="accept,cancel"
data-l10n-id="blocklist-dialog"
data-l10n-attrs="buttonlabelaccept, buttonaccesskeyaccept">
<linkset>
<html:link rel="localization" href="branding/brand.ftl"/>
@ -46,11 +50,5 @@
<treechildren/>
</tree>
</vbox>
<hbox class="actionButtons" pack="end">
<button oncommand="window.close();"
data-l10n-id="blocklist-button-cancel"/>
<button id="btnApplyChanges" oncommand="gBlocklistManager.onApplyChanges();"
data-l10n-id="blocklist-button-ok"/>
</hbox>
</dialog>
</window>

View File

@ -267,7 +267,7 @@
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
is="text-link"
search-l10n-ids="blocklist-window.title, blocklist-description, blocklist-button-cancel.label, blocklist-button-ok.label"/>
search-l10n-ids="blocklist-window.title, blocklist-description, blocklist-dialog.buttonlabelaccept"/>
<hbox class="custom-option" id="contentBlockingCryptominersOption">
<checkbox id="contentBlockingCryptominersCheckbox"

View File

@ -13,13 +13,10 @@ blocklist-close-key =
blocklist-treehead-list =
.label = List
blocklist-button-cancel =
.label = Cancel
.accesskey = C
blocklist-dialog=
.buttonlabelaccept = Save Changes
.buttonaccesskeyaccept = S
blocklist-button-ok =
.label = Save Changes
.accesskey = S
# This template constructs the name of the block list in the block lists dialog.
# It combines the list name and description.

View File

@ -63,3 +63,12 @@ translation-dialog =
.buttonlabelaccept = { COPY_PATTERN(from_path, "translation-button-close.label") }
.buttonaccesskeyaccept = { COPY_PATTERN(from_path, "translation-button-close.accesskey") }
""", from_path="browser/browser/preferences/translation.ftl"))
ctx.add_transforms(
"browser/browser/preferences/blocklists.ftl",
"browser/browser/preferences/blocklists.ftl",
transforms_from("""
blocklist-dialog =
.buttonlabelaccept = { COPY_PATTERN(from_path, "blocklist-button-ok.label") }
.buttonaccesskeyaccept = { COPY_PATTERN(from_path, "blocklist-button-ok.accesskey") }
""", from_path="browser/browser/preferences/blocklists.ftl"))