Dan Ballard pushed to branch tor-browser-153.2.0esr-16.0-1 at The Tor Project / Applications / Tor Browser Commits: c76b89e2 by Tom Schuster at 2026-09-03T14:34:52-07:00 Bug 2052011 - Remove inline JS from about:config in GeckoView. r=geckoview-reviewers,nalexander Differential Revision: https://phabricator.services.mozilla.com/D310051 - - - - - 2 changed files: - mobile/shared/chrome/geckoview/config.js - mobile/shared/chrome/geckoview/config.xhtml Changes: ===================================== mobile/shared/chrome/geckoview/config.js ===================================== @@ -73,6 +73,28 @@ var NewPrefDialog = { this._intValue = document.getElementById("new-pref-value-int"); this._positiveButton = document.getElementById("positive-button"); + + document + .getElementById("new-pref-toggle-button") + .addEventListener("click", () => this.toggleShowHide()); + document + .getElementById("pref-toggle-button") + .addEventListener("click", () => this.toggleBoolValue()); + document + .getElementById("negative-button") + .addEventListener("click", () => this.hide()); + this._positiveButton.addEventListener("click", () => this.create()); + + this._prefNameInputElt.addEventListener("focus", event => + this.focusName(event) + ); + this._prefNameInputElt.addEventListener("input", event => + this.updateName(event) + ); + + this._prefTypeSelectElt.addEventListener("change", event => { + this.type = event.target.value; + }); }, // Called to update positive button to display text ("Create"/"Change), and enabled/disabled status @@ -235,6 +257,21 @@ var AboutConfig = { // Setup the prefs observers Services.prefs.addObserver("", this); + + this.filterInput.addEventListener("input", () => + AboutConfig.bufferFilterInput() + ); + + document.getElementById("content").addEventListener("touchstart", () => { + this.filterInput.blur(); + }); + + document + .getElementById("copy-pref-name") + .addEventListener("click", () => this.clipboardCopy("name")); + document + .getElementById("copy-pref-value") + .addEventListener("click", () => this.clipboardCopy("value")); }, // Uninit the main AboutConfig dialog @@ -711,3 +748,12 @@ Pref.prototype = { } }, }; + +window.addEventListener("load", () => { + NewPrefDialog.init(); + AboutConfig.init(); +}); + +window.addEventListener("unload", () => { + AboutConfig.uninit(); +}); ===================================== mobile/shared/chrome/geckoview/config.xhtml ===================================== @@ -24,19 +24,10 @@ ></script> </head> - <body - onload=" - NewPrefDialog.init(); - AboutConfig.init(); - " - onunload="AboutConfig.uninit()" - > + <body> <div class="toolbar"> <div class="toolbar-container"> - <div - id="new-pref-toggle-button" - onclick="NewPrefDialog.toggleShowHide()" - /> + <div id="new-pref-toggle-button" /> <div class="toolbar-item" id="filter-container"> <div id="filter-search-button" /> @@ -45,13 +36,12 @@ type="search" data-l10n-id="config-toolbar-search" value="" - oninput="AboutConfig.bufferFilterInput()" /> </div> </div> </div> - <div id="content" ontouchstart="AboutConfig.filterInput.blur();"> + <div id="content"> <div id="new-pref-container"> <li class="pref-item" id="new-pref-item"> <div class="pref-item-line"> @@ -60,13 +50,8 @@ id="new-pref-name" type="text" data-l10n-id="config-new-pref-name" - onfocus="NewPrefDialog.focusName(event)" - oninput="NewPrefDialog.updateName(event)" /> - <select - id="new-pref-type" - onchange="NewPrefDialog.type = event.target.value" - > + <select id="new-pref-type"> <option value="boolean" data-l10n-id="config-new-pref-value-boolean" @@ -90,7 +75,7 @@ /> <div class="pref-button toggle" - onclick="NewPrefDialog.toggleBoolValue()" + id="pref-toggle-button" data-l10n-id="config-pref-toggle-button" ></div> </div> @@ -113,13 +98,11 @@ <div class="pref-button cancel" id="negative-button" - onclick="NewPrefDialog.hide()" data-l10n-id="config-new-pref-cancel-button" ></div> <div class="pref-button create" id="positive-button" - onclick="NewPrefDialog.create(event)" data-l10n-id="config-new-pref-create-button" ></div> </div> @@ -135,12 +118,12 @@ <menu type="context" id="prefs-context-menu"> <menuitem + id="copy-pref-name" data-l10n-id="config-context-menu-copy-pref-name" - onclick="AboutConfig.clipboardCopy('name')" ></menuitem> <menuitem + id="copy-pref-value" data-l10n-id="config-context-menu-copy-pref-value" - onclick="AboutConfig.clipboardCopy('value')" ></menuitem> </menu> </body> View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/c76b89e2... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/c76b89e2... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Dan Ballard (@dan)