diff --git a/devtools/client/preferences/devtools.js b/devtools/client/preferences/devtools.js index 2dda7772d2eb..d15185b18c2b 100644 --- a/devtools/client/preferences/devtools.js +++ b/devtools/client/preferences/devtools.js @@ -18,7 +18,6 @@ pref("devtools.loader.hotreload", false); // Developer toolbar preferences pref("devtools.toolbar.enabled", true); -pref("devtools.toolbar.visible", false); // Enable DevTools WebIDE by default pref("devtools.webide.enabled", true); diff --git a/devtools/shim/devtools-startup-prefs.js b/devtools/shim/devtools-startup-prefs.js index 44bd23fd6e80..295747df1eb2 100644 --- a/devtools/shim/devtools-startup-prefs.js +++ b/devtools/shim/devtools-startup-prefs.js @@ -17,3 +17,6 @@ sticky_pref("devtools.theme", "dark"); #else sticky_pref("devtools.theme", "light"); #endif + +// Should the devtools toolbar be opened on startup +pref("devtools.toolbar.visible", false); diff --git a/devtools/shim/devtools-startup.js b/devtools/shim/devtools-startup.js index 3d0b8198f486..a60afc47f16e 100644 --- a/devtools/shim/devtools-startup.js +++ b/devtools/shim/devtools-startup.js @@ -26,6 +26,11 @@ const kDebuggerPrefs = [ "devtools.debugger.remote-enabled", "devtools.chrome.enabled" ]; + +// If devtools.toolbar.visible is set to true, the developer toolbar should appear on +// startup. +const TOOLBAR_VISIBLE_PREF = "devtools.toolbar.visible"; + const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); @@ -193,6 +198,12 @@ DevToolsStartup.prototype = { let onWindowReady = window => { this.hookWindow(window); + if (Services.prefs.getBoolPref(TOOLBAR_VISIBLE_PREF, false)) { + // Loading devtools-browser will open the developer toolbar by also checking this + // pref. + this.initDevTools(); + } + if (devtoolsFlag) { this.handleDevToolsFlag(window); // This listener is called for all Firefox windows, but we want to execute @@ -366,7 +377,7 @@ DevToolsStartup.prototype = { initialized: false, initDevTools: function (reason) { - if (!this.initialized) { + if (reason && !this.initialized) { // Only save the first call for each firefox run as next call // won't necessarely start the tool. For example key shortcuts may // only change the currently selected tool.