Bug 1369801 - dt-addon-prefs: move jsonview enabled pref outside of devtools addon;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 21 Jul 2017 12:27:35 +0200
changeset 422267 d0ed0997f4e08e56d3e43d861987555ba7eae678
parent 422266 ad2a532a50f023a28490bf19659e9635abb99ffd
child 422268 a31f0c8450a8bf86f6f2f62ff5242ebbfa7c1c8e
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1369801
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369801 - 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
@@ -625,16 +625,17 @@
 @RESPATH@/browser/chrome/icons/default/default32.png
 @RESPATH@/browser/chrome/icons/default/default48.png
 #endif
 @RESPATH@/browser/features/*
 
 ; [DevTools Shim Files]
 @RESPATH@/browser/chrome/devtools-shim@JAREXT@
 @RESPATH@/browser/chrome/devtools-shim.manifest
+@RESPATH@/browser/@PREF_DIR@/devtools-startup-prefs.js
 
 ; shell icons
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 ; shell icons
 @RESPATH@/browser/icons/*.png
 #ifdef MOZ_UPDATER
 ; updater icon
--- a/devtools/client/preferences/devtools.js
+++ b/devtools/client/preferences/devtools.js
@@ -347,13 +347,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',
     ]
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']