tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 73481247ed635fdcb224f73545b7aab034c69967
parent e5c425754a7b42c4507c9442ef60465e74674b01
Author: Alexandre Poirot <poirot.alex@gmail.com>
Date:   Thu, 16 Oct 2025 12:22:26 +0000

Bug 1994128 - [devtools] Expose a setting to enable automatic pretty printing in the debugger. r=devtools-reviewers,bomsy

Differential Revision: https://phabricator.services.mozilla.com/D268511

Diffstat:
Mdevtools/client/debugger/src/components/SecondaryPanes/CommandBar.js | 11+++++++++++
Mdevtools/client/debugger/test/mochitest/browser_dbg-pretty-print-auto.js | 11++++++-----
Mdevtools/client/locales/en-US/debugger.properties | 8++++++++
3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/devtools/client/debugger/src/components/SecondaryPanes/CommandBar.js b/devtools/client/debugger/src/components/SecondaryPanes/CommandBar.js @@ -319,6 +319,17 @@ class CommandBar extends Component { tooltip: L10N.getStr("settings.showPausedOverlay.tooltip"), onClick: () => this.props.togglePausedOverlay(!prefs.pausedOverlayEnabled), + }), + React.createElement(MenuItem, { + key: "debugger-settings-menu-item-toggle-auto-pretty-print", + className: + "menu-item debugger-settings-menu-item-toggle-auto-pretty-print", + checked: prefs.autoPrettyPrint, + label: L10N.getStr("settings.autoPrettyPrint.label"), + tooltip: L10N.getStr("settings.autoPrettyPrint.tooltip"), + onClick: () => { + prefs.autoPrettyPrint = !prefs.autoPrettyPrint; + }, }) ); } diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-auto.js b/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-auto.js @@ -31,13 +31,14 @@ add_task(async function testAutoPrettyPrintedOff() { }); add_task(async function testAutoPrettyPrintedOn() { - // For now the preference is only read on debugger initialization, so close and re-open - // a debugger to see a change in behavior. - info("Enable auto pretty printing via the preference"); - await pushPref("devtools.debugger.auto-pretty-print", true); - let dbg = await initDebugger("doc-sourcemaps3.html", "bundle.js"); + info("Enable automatic pretty printing"); + await toggleDebuggerSettingsMenuItem(dbg, { + className: ".debugger-settings-menu-item-toggle-auto-pretty-print", + isChecked: false, + }); + // Expand the tree to make the source visible await waitForSourcesInSourceTree(dbg, ["bundle.js"], { noExpand: false, diff --git a/devtools/client/locales/en-US/debugger.properties b/devtools/client/locales/en-US/debugger.properties @@ -610,6 +610,14 @@ settings.showPausedOverlay.label=Show paused overlay # tooltip for showing the paused overlay when enabled. settings.showPausedOverlay.tooltip=Show a translucent overlay in the page when the debugger is paused. +# LOCALIZATION NOTE (settings.autoPrettyPrint.label): Context menu item +# label for enabling automatic pretty printing of all opened sources. +settings.autoPrettyPrint.label=Automatic pretty printing + +# LOCALIZATION NOTE (settings.autoPrettyPrint.tooltip): Context menu item +# tooltip for enabling automatic pretty printing of all opened sources. +settings.autoPrettyPrint.tooltip=All sources in the debugger will be automatically pretty printed + # LOCALIZATION NOTE (sources-settings.button.label): Label for Settings button displayed in the Source Tree sources-settings.button.label=Source Settings