Bug 1408339 - add a preference to drive the devtools onboarding experiment;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Sun, 05 Nov 2017 16:34:26 +0100
changeset 697838 22372a8f8fb59c47ad7f75e7fb55e937d721a884
parent 697096 fc194660762d1b92e1679d860a8bf41116d0f54f
child 697839 6cd721dca7e2bfc6e5cbf1938c47d3851ecfb6fc
push id89114
push userjdescottes@mozilla.com
push dateTue, 14 Nov 2017 19:28:24 +0000
reviewersochameau
bugs1408339
milestone59.0a1
Bug 1408339 - add a preference to drive the devtools onboarding experiment;r=ochameau MozReview-Commit-ID: I4uGf1MFbI9
devtools/shim/devtools-startup-prefs.js
devtools/shim/devtools-startup.js
--- a/devtools/shim/devtools-startup-prefs.js
+++ b/devtools/shim/devtools-startup-prefs.js
@@ -15,8 +15,12 @@ pref("devtools.jsonview.enabled", true);
 #ifdef MOZ_DEV_EDITION
 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);
+
+// Flag to drive the devtools onboarding flow experiment. Forces devtools.enabled to true
+// when false.
+pref("devtools.onboarding.experiment", false);
--- a/devtools/shim/devtools-startup.js
+++ b/devtools/shim/devtools-startup.js
@@ -447,16 +447,22 @@ DevToolsStartup.prototype = {
    *        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;
     }
 
+    if (!Services.prefs.getBoolPref("devtools.onboarding.experiment")) {
+      // Force devtools.enabled to true for users that are not part of the experiment.
+      Services.prefs.setBoolPref(DEVTOOLS_ENABLED_PREF, true);
+      return;
+    }
+
     let hasToolbarPref = Services.prefs.getBoolPref(TOOLBAR_VISIBLE_PREF, false);
 
     if (hasDevToolsFlag || hasToolbarPref || this.isDevToolsUser()) {
       Services.prefs.setBoolPref(DEVTOOLS_ENABLED_PREF, true);
     }
   },
 
   hookKeyShortcuts(window) {