Bug 1824725 - [devtools] Avoid focusing the webconsole when enabling the JS Tracer. r=nchevobbe,devtools-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D174873
This commit is contained in:
Alexandre Poirot 2023-04-12 14:54:54 +00:00
parent c75338571f
commit 1cb5a67ab2
2 changed files with 9 additions and 3 deletions

View File

@ -23,7 +23,7 @@ export function toggleTracing(logMethod) {
// Automatically open the split console when enabling tracing to the console
if (!isTracingEnabled && logMethod == "console") {
await panel.toolbox.openSplitConsole();
await panel.toolbox.openSplitConsole({ focusConsoleInput: false });
}
return dispatch({

View File

@ -2971,10 +2971,14 @@ Toolbox.prototype = {
/**
* Opens the split console.
*
* @param {boolean} focusConsoleInput
* By default, the console input will be focused.
* Pass false in order to prevent this.
*
* @returns {Promise} a promise that resolves once the tool has been
* loaded and focused.
*/
openSplitConsole() {
openSplitConsole({ focusConsoleInput = true } = {}) {
this._splitConsole = true;
Services.prefs.setBoolPref(SPLITCONSOLE_ENABLED_PREF, true);
this._refreshConsoleDisplay();
@ -2992,7 +2996,9 @@ Toolbox.prototype = {
width: Math.ceil(this.win.outerWidth / 50) * 50,
});
this.emit("split-console");
this.focusConsoleInput();
if (focusConsoleInput) {
this.focusConsoleInput();
}
});
},