Bug 1386620 - dt-addon-prefs: move jsonview enabled pref outside of devtools addon;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 21 Jul 2017 12:27:35 +0200
changeset 619748 bb85aa12ec92db7d11abdb002f0429123b173afd
parent 619747 32fda4768488b517399d6864c15aa5cbc2639fb6
child 619749 72952b2f7373ac19144711e53342c37dfb2d050d
push id71793
push userjdescottes@mozilla.com
push dateWed, 02 Aug 2017 14:03:50 +0000
reviewersochameau
bugs1386620
milestone57.0a1
Bug 1386620 - dt-addon-prefs: move jsonview enabled pref outside of devtools addon;r=ochameau DevTools preferences are loaded dynamically by calling DevtoolsPreferences.loadPrefs(). We can not preload them when the addon starts, otherwise this will slow down the startup of Firefox. But jsonview's converter-observer needs to check preferences to check if jsonview is enabled very early. Moving devtools.jsonview.enabled to a separate preferences file that is still processed by firefox fixes the issue. The downside is that this pref will keep following m-c's release cycle and not the addon's. But it is so generic it should not be a big issue. MozReview-Commit-ID: HrD5IVe54Ks
.eslintignore
browser/installer/package-manifest.in
devtools/client/preferences/devtools.js
devtools/shim/devtools-startup-prefs.js
devtools/shim/moz.build
--- a/.eslintignore
+++ b/.eslintignore
@@ -133,18 +133,19 @@ devtools/server/tests/browser/storage-*.
 !devtools/server/tests/browser/storage-unsecured-iframe.html
 devtools/server/tests/browser/stylesheets-nested-iframes.html
 devtools/server/tests/unit/xpcshell_debugging_script.js
 devtools/shared/platform/content/test/test_clipboard.html
 devtools/shared/qrcode/tests/mochitest/test_decode.html
 devtools/shared/tests/mochitest/*.html
 devtools/shared/webconsole/test/test_*.html
 
-# Ignore devtools pre-processed files
+# Ignore devtools preferences files
 devtools/client/preferences/**
+devtools/shim/devtools-startup-prefs.js
 
 # Ignore devtools third-party libs
 devtools/shared/jsbeautify/*
 devtools/shared/acorn/*
 devtools/shared/gcli/source/*
 devtools/shared/node-properties/*
 devtools/shared/pretty-fast/*
 devtools/shared/sourcemap/*
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -630,16 +630,17 @@
 ; [Webide Files]
 @RESPATH@/browser/chrome/webide@JAREXT@
 @RESPATH@/browser/chrome/webide.manifest
 @RESPATH@/browser/@PREF_DIR@/webide-prefs.js
 
 ; [DevTools Shim Files]
 @RESPATH@/browser/chrome/devtools-shim@JAREXT@
 @RESPATH@/browser/chrome/devtools-shim.manifest
+@RESPATH@/browser/@PREF_DIR@/devtools-startup-prefs.js
 
 ; DevTools
 @RESPATH@/browser/chrome/devtools@JAREXT@
 @RESPATH@/browser/chrome/devtools.manifest
 @RESPATH@/browser/@PREF_DIR@/devtools.js
 @RESPATH@/browser/@PREF_DIR@/debugger.js
 
 ; shell icons
--- a/devtools/client/preferences/devtools.js
+++ b/devtools/client/preferences/devtools.js
@@ -348,13 +348,10 @@ pref("devtools.editor.detectindentation"
 pref("devtools.editor.enableCodeFolding", true);
 pref("devtools.editor.autocomplete", true);
 
 // Pref to store the browser version at the time of a telemetry ping for an
 // opened developer tool. This allows us to ping telemetry just once per browser
 // version for each user.
 pref("devtools.telemetry.tools.opened.version", "{}");
 
-// Enable the JSON View tool (an inspector for application/json documents).
-pref("devtools.jsonview.enabled", true);
-
 // Enable the HTML responsive design mode for all channels.
 pref("devtools.responsive.html.enabled", true);
new file mode 100644
--- /dev/null
+++ b/devtools/shim/devtools-startup-prefs.js
@@ -0,0 +1,12 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This Devtools preferences file will be loaded as a usual Firefox preferences file.
+// Most DevTools prefs are included with the addon and loaded dynamically during the addon
+// startup. For preferences that are required before the addon is loaded or that we can't
+// process in JS, they can be defined in this file.
+// Note that this preference file follows Firefox release cycle.
+
+// Enable the JSON View tool (an inspector for application/json documents).
+pref("devtools.jsonview.enabled", true);
--- a/devtools/shim/moz.build
+++ b/devtools/shim/moz.build
@@ -1,16 +1,20 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 JAR_MANIFESTS += ['jar.mn']
 
+JS_PREFERENCE_FILES += [
+    'devtools-startup-prefs.js',
+]
+
 # Register the about:debugging page only for 'addon' and 'all' builds.
 if CONFIG['MOZ_DEVTOOLS'] != 'server':
     EXTRA_COMPONENTS += [
         'aboutdebugging-registration.js',
         'aboutdebugging.manifest',
         'devtools-startup.js',
         'devtools-startup.manifest',
     ]