gh-14651: Change event listeners to not be inlined (gh-14700)

This commit is contained in:
mr. m
2026-07-24 19:36:10 +02:00
committed by mr. m
parent 797ff70b25
commit ddad0cdc77
7 changed files with 50 additions and 32 deletions

View File

@@ -138,6 +138,18 @@ export class nsZenBoostEditor {
.getElementById("zen-boost-css-inspector")
.addEventListener("click", this.onInspectorButtonPressed.bind(this));
const commandActions = {
cmd_zenBoostEditName: () => this.editBoostName(),
cmd_zenBoostShuffle: () => this.shuffleBoost(),
cmd_zenBoostReset: () => this.resetBoost(),
cmd_zenBoostLoad: () => this.onLoadBoostClick(),
cmd_zenBoostSave: () => this.onSaveBoostClick(),
cmd_zenBoostDelete: () => this.deleteBoost(),
};
for (const [id, action] of Object.entries(commandActions)) {
this.doc.getElementById(id).addEventListener("command", action);
}
this.doc.addEventListener("keydown", event => {
if (
event.key === "Escape" ||

View File

@@ -9,6 +9,7 @@
# Windows
* content/browser/zen-components/windows/zen-boost-editor.xhtml (../../zen/boosts/zen-boost-editor.inc.xhtml)
content/browser/zen-components/windows/zen-boost-editor.js (../../zen/boosts/zen-boost-editor.js)
# Images
content/browser/zen-images/boost-indicator.svg (../../zen/images/boost-indicator.svg)

View File

@@ -138,28 +138,14 @@
</popupset>
<commandset id="zenBoostCommandSet">
<command id="cmd_zenBoostEditName"
oncommand="window.boostEditor.editBoostName();" />
<command id="cmd_zenBoostShuffle"
oncommand="window.boostEditor.shuffleBoost();" />
<command id="cmd_zenBoostReset"
oncommand="window.boostEditor.resetBoost();" />
<command id="cmd_zenBoostLoad"
oncommand="window.boostEditor.onLoadBoostClick();" />
<command id="cmd_zenBoostSave"
oncommand="window.boostEditor.onSaveBoostClick();" />
<command id="cmd_zenBoostDelete"
oncommand="window.boostEditor.deleteBoost();" />
<command id="cmd_zenBoostEditName" />
<command id="cmd_zenBoostShuffle" />
<command id="cmd_zenBoostReset" />
<command id="cmd_zenBoostLoad" />
<command id="cmd_zenBoostSave" />
<command id="cmd_zenBoostDelete" />
</commandset>
<script>
const { nsZenBoostEditor } = ChromeUtils.importESModule( "resource:///modules/zen/boosts/ZenBoostsEditor.mjs" );
window.boostEditor = new nsZenBoostEditor(document, window.domain, window, window.openerWindow);
</script>
<script src="chrome://browser/content/zen-components/windows/zen-boost-editor.js"></script>
</html:body>
</html>

View File

@@ -0,0 +1,14 @@
/* 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/. */
const { nsZenBoostEditor } = ChromeUtils.importESModule(
"resource:///modules/zen/boosts/ZenBoostsEditor.mjs"
);
window.boostEditor = new nsZenBoostEditor(
document,
window.domain,
window,
window.openerWindow
);

View File

@@ -7,3 +7,4 @@
# Windows
* content/browser/zen-components/windows/zen-space-routing.xhtml (../../zen/space-routing/zen-space-routing.inc.xhtml)
content/browser/zen-components/windows/zen-space-routing.js (../../zen/space-routing/zen-space-routing.js)

View File

@@ -82,15 +82,5 @@
</hbox>
</vbox>
<script>
const { nsZenSpaceRoutingDialog } = ChromeUtils.importESModule(
"resource:///modules/zen/spacerouting/ZenSpaceRoutingDialog.mjs",
);
const args = window.arguments?.[0] || {};
window.spaceroutingDialog = new nsZenSpaceRoutingDialog(
document,
window,
args.parentWindow,
);
</script>
<script src="chrome://browser/content/zen-components/windows/zen-space-routing.js"></script>
</window>

View File

@@ -0,0 +1,14 @@
/* 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/. */
const { nsZenSpaceRoutingDialog } = ChromeUtils.importESModule(
"resource:///modules/zen/spacerouting/ZenSpaceRoutingDialog.mjs"
);
const args = window.arguments?.[0] || {};
window.spaceroutingDialog = new nsZenSpaceRoutingDialog(
document,
window,
args.parentWindow
);