diff --git a/front_end/sources/DebuggerPlugin.js b/front_end/sources/DebuggerPlugin.js index 0388dc0955..9beb51a294 100644 --- a/front_end/sources/DebuggerPlugin.js +++ b/front_end/sources/DebuggerPlugin.js @@ -1781,7 +1781,7 @@ export class DebuggerPlugin extends Plugin { if (!editorAction.isCurrentUISourceCodeFormatable()) { return; } - formatterCallback = () => editorAction.toggleFormatScriptSource.bind(editorAction); + formatterCallback = editorAction.toggleFormatScriptSource.bind(editorAction); break; } } diff --git a/front_end/sources/ScriptFormatterEditorAction.js b/front_end/sources/ScriptFormatterEditorAction.js index a9b95d6e7a..6f1fb193c4 100644 --- a/front_end/sources/ScriptFormatterEditorAction.js +++ b/front_end/sources/ScriptFormatterEditorAction.js @@ -88,7 +88,7 @@ export class ScriptFormatterEditorAction { }); this._button = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Pretty print'), 'largeicon-pretty-print'); - this._button.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.toggleFormatScriptSource, this); + this._button.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._onFormatScriptButtonClicked, this); this._updateButton(sourcesView.currentUISourceCode()); return this._button; @@ -125,7 +125,11 @@ export class ScriptFormatterEditorAction { /** * @param {!Common.EventTarget.EventTargetEvent} event */ - toggleFormatScriptSource(event) { + _onFormatScriptButtonClicked(event) { + this.toggleFormatScriptSource(); + } + + toggleFormatScriptSource() { const uiSourceCode = this._sourcesView.currentUISourceCode(); if (!uiSourceCode || !this._isFormatableScript(uiSourceCode)) { return;