Bug 1408337 - set devtools.enabled to true if toolbox was recently opened;r=bgrins
MozReview-Commit-ID: RKprmycu6b
--- a/devtools/shim/devtools-startup.js
+++ b/devtools/shim/devtools-startup.js
@@ -430,30 +430,42 @@ DevToolsStartup.prototype = {
let window = enumerator.getNext();
if (window.gBrowserInit && window.gBrowserInit.delayedStartupFinished) {
this.updateDevToolsMenuItems(window);
}
}
},
/**
+ * Check if the user is a DevTools user by looking at our selfxss pref.
+ * This preference is incremented everytime the console is used (up to 5).
+ *
+ * @return {Boolean} true if the user can be considered as a devtools user.
+ */
+ isDevToolsUser() {
+ let selfXssCount = Services.prefs.getIntPref("devtools.selfxss.count", 0);
+ return selfXssCount > 0;
+ },
+
+ /**
* Depending on some runtime parameters (command line arguments as well as existing
* preferences), the DEVTOOLS_ENABLED_PREF might be forced to true.
*
* @param {Boolean} hasDevToolsFlag
* true if any DevTools command line argument was passed when starting Firefox.
*/
setupEnabledPref(hasDevToolsFlag) {
if (Services.prefs.getBoolPref(DEVTOOLS_ENABLED_PREF)) {
// Nothing to do if DevTools are already enabled.
return;
}
let hasToolbarPref = Services.prefs.getBoolPref(TOOLBAR_VISIBLE_PREF, false);
- if (hasDevToolsFlag || hasToolbarPref) {
+
+ if (hasDevToolsFlag || hasToolbarPref || this.isDevToolsUser()) {
Services.prefs.setBoolPref(DEVTOOLS_ENABLED_PREF, true);
}
},
hookKeyShortcuts(window) {
let doc = window.document;
let keyset = doc.createElement("keyset");
keyset.setAttribute("id", "devtoolsKeyset");