Bug 1369801 - DevTools as system add-on draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 30 May 2017 17:34:38 +0200
changeset 606790 64446ebd1779f0d9e0ffc61145d63b19ff748f5b
parent 606789 fa42a722566c1a45379e727dc0e90a98736ccbb3
child 606791 4063c0cef78921e782e6bf918a6eac5827d0895c
child 606889 5905ad8c5d9b1cf9212a7a4931991ae6b4969097
push id67804
push userjdescottes@mozilla.com
push dateTue, 11 Jul 2017 12:55:28 +0000
bugs1369801
milestone56.0a1
Bug 1369801 - DevTools as system add-on MozReview-Commit-ID: EUjkQtEUy4V
browser/installer/allowed-dupes.mn
browser/installer/package-manifest.in
devtools/bootstrap.js
devtools/client/jar.mn
devtools/client/locales/jar.mn
devtools/client/moz.build
devtools/client/preferences/moz.build
devtools/client/webide/moz.build
devtools/moz.build
devtools/server/shims/moz.build
devtools/shared/jar.mn
devtools/shared/shims/fronts/moz.build
devtools/templates.mozbuild
--- a/browser/installer/allowed-dupes.mn
+++ b/browser/installer/allowed-dupes.mn
@@ -78,67 +78,23 @@ browser/chrome/browser/content/browser/d
 browser/chrome/browser/content/browser/extension.svg
 browser/chrome/browser/content/browser/places/bookmarkProperties.xul
 browser/chrome/browser/content/browser/places/bookmarkProperties2.xul
 browser/chrome/browser/skin/classic/browser/addons/addon-install-confirm.svg
 browser/chrome/browser/skin/classic/browser/connection-secure.svg
 browser/chrome/browser/skin/classic/browser/controlcenter/warning-gray.svg
 browser/chrome/browser/skin/classic/browser/newtab/close.png
 # devtools reduction is bug 1311178
-browser/chrome/devtools/content/dom/content/dom-view.css
-browser/chrome/devtools/content/dom/dom.html
-browser/chrome/devtools/content/dom/main.js
-browser/chrome/devtools/content/framework/toolbox-options.js
-browser/chrome/devtools/content/inspector/fonts/fonts.js
-browser/chrome/devtools/content/inspector/inspector.xhtml
-browser/chrome/devtools/content/memory/initializer.js
-browser/chrome/devtools/content/projecteditor/lib/helpers/readdir.js
-browser/chrome/devtools/content/shared/frame-script-utils.js
-browser/chrome/devtools/content/shared/theme-switching.js
-browser/chrome/devtools/modules/devtools/client/dom/content/dom-view.css
-browser/chrome/devtools/modules/devtools/client/dom/dom.html
-browser/chrome/devtools/modules/devtools/client/dom/main.js
-browser/chrome/devtools/modules/devtools/client/framework/toolbox-options.js
-browser/chrome/devtools/modules/devtools/client/inspector/fonts/fonts.js
-browser/chrome/devtools/modules/devtools/client/inspector/inspector.xhtml
-browser/chrome/devtools/modules/devtools/client/jsonview/css/controls.png
-browser/chrome/devtools/modules/devtools/client/jsonview/css/controls@2x.png
-browser/chrome/devtools/modules/devtools/client/memory/initializer.js
-browser/chrome/devtools/modules/devtools/client/projecteditor/lib/helpers/readdir.js
-browser/chrome/devtools/modules/devtools/client/shared/frame-script-utils.js
-browser/chrome/devtools/modules/devtools/client/shared/theme-switching.js
-browser/chrome/devtools/modules/devtools/client/themes/common.css
-browser/chrome/devtools/modules/devtools/client/themes/toolbars.css
-browser/chrome/devtools/modules/devtools/client/themes/variables.css
-browser/chrome/devtools/skin/common.css
-browser/chrome/devtools/skin/toolbars.css
-browser/chrome/devtools/skin/images/command-scratchpad.svg
-browser/chrome/devtools/skin/images/controls.png
-browser/chrome/devtools/skin/images/controls@2x.png
-browser/chrome/devtools/skin/images/debugger-blackbox.svg
-browser/chrome/devtools/skin/images/debugger-prettyprint.svg
-browser/chrome/devtools/skin/images/filetypes/store.svg
-browser/chrome/devtools/skin/images/itemToggle.svg
-browser/chrome/devtools/skin/images/security-state-broken.svg
-browser/chrome/devtools/skin/images/security-state-local.svg
-browser/chrome/devtools/skin/images/security-state-secure.svg
-browser/chrome/devtools/skin/images/tabs-icon.svg
-browser/chrome/devtools/skin/images/tool-scratchpad.svg
-browser/chrome/devtools/skin/images/tool-storage.svg
-browser/chrome/devtools/skin/images/tool-styleeditor.svg
-browser/chrome/devtools/skin/promisedebugger.css
-browser/chrome/devtools/skin/variables.css
-modules/devtools/Console.jsm
+browser/features/devtools@mozilla.org/chrome/skin/images/security-state-broken.svg
+browser/features/devtools@mozilla.org/chrome/skin/images/security-state-secure.svg
+browser/features/devtools@mozilla.org/chrome/skin/toolbars.css
+browser/features/devtools@mozilla.org/chrome/modules/client/themes/toolbars.css
 modules/devtools/Loader.jsm
-modules/devtools/Simulator.jsm
-modules/devtools/shared/Console.jsm
 modules/devtools/shared/Loader.jsm
-modules/devtools/shared/apps/Simulator.jsm
-browser/modules/devtools/client/framework/gDevTools.jsm
-browser/modules/devtools/gDevTools.jsm
+
 browser/chrome/icons/default/default16.png
 browser/chrome/icons/default/default32.png
 browser/chrome/icons/default/default48.png
 browser/chrome/pdfjs/content/web/images/findbarButton-next-rtl.png
 browser/chrome/pdfjs/content/web/images/findbarButton-next-rtl@2x.png
 browser/chrome/pdfjs/content/web/images/findbarButton-next.png
 browser/chrome/pdfjs/content/web/images/findbarButton-next@2x.png
 browser/chrome/pdfjs/content/web/images/findbarButton-previous-rtl.png
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -374,18 +374,16 @@
 @RESPATH@/browser/components/FeedConverter.js
 @RESPATH@/browser/components/FeedWriter.js
 @RESPATH@/browser/components/WebContentConverter.js
 @RESPATH@/browser/components/BrowserComponents.manifest
 @RESPATH@/browser/components/nsBrowserContentHandler.js
 @RESPATH@/browser/components/nsBrowserGlue.js
 @RESPATH@/browser/components/nsSetDefaultBrowser.manifest
 @RESPATH@/browser/components/nsSetDefaultBrowser.js
-@RESPATH@/browser/components/devtools-startup.manifest
-@RESPATH@/browser/components/devtools-startup.js
 @RESPATH@/browser/components/aboutdebugging-registration.js
 @RESPATH@/browser/components/aboutdebugging.manifest
 @RESPATH@/browser/components/Experiments.manifest
 @RESPATH@/browser/components/ExperimentsService.js
 @RESPATH@/browser/components/browser-newtab.xpt
 @RESPATH@/browser/components/aboutNewTabService.js
 @RESPATH@/browser/components/NewTabComponents.manifest
 @RESPATH@/components/Downloads.manifest
@@ -562,16 +560,20 @@
 @RESPATH@/components/TestInterfaceJSMaplike.js
 #endif
 
 #if defined(MOZ_DEBUG) || defined(NIGHTLY_BUILD)
 @RESPATH@/browser/components/testComponents.manifest
 @RESPATH@/browser/components/startupRecorder.js
 #endif
 
+; [DevTools Shim Files]
+@RESPATH@/browser/chrome/devtools-shim@JAREXT@
+@RESPATH@/browser/chrome/devtools-shim.manifest
+
 ; [Extensions]
 @RESPATH@/components/extensions-toolkit.manifest
 @RESPATH@/components/extension-process-script.js
 @RESPATH@/browser/components/extensions-browser.manifest
 
 ; Modules
 @RESPATH@/browser/modules/*
 @RESPATH@/modules/*
@@ -616,31 +618,16 @@
 @RESPATH@/chrome/recording/*
 #ifdef MOZ_GTK
 @RESPATH@/browser/chrome/icons/default/default16.png
 @RESPATH@/browser/chrome/icons/default/default32.png
 @RESPATH@/browser/chrome/icons/default/default48.png
 #endif
 @RESPATH@/browser/features/*
 
-; [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
-
-; 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
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 ; shell icons
 @RESPATH@/browser/icons/*.png
 #ifdef MOZ_UPDATER
 ; updater icon
 @RESPATH@/icons/updater.png
--- a/devtools/bootstrap.js
+++ b/devtools/bootstrap.js
@@ -10,18 +10,16 @@
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
 const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
 const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm", {});
 
 // MultiWindowKeyListener instance for Ctrl+Alt+R key
 let listener;
-// nsIURI to the addon root folder
-let resourceURI;
 
 function actionOccurred(id) {
   let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
   let Telemetry = require("devtools/client/shared/telemetry");
   let telemetry = new Telemetry();
   telemetry.actionOccurred(id);
 }
 
@@ -114,19 +112,19 @@ function processPrefFile(url) {
       defaultBranch.setBoolPref(name, val == "true");
     } else {
       console.log("Unable to match preference type for value:", val);
     }
   });
 }
 
 function setPrefs() {
-  processPrefFile(resourceURI.spec + "./client/preferences/devtools.js");
-  processPrefFile(resourceURI.spec + "./client/preferences/debugger.js");
-  processPrefFile(resourceURI.spec + "./client/webide/webide-prefs.js");
+  processPrefFile("chrome://devtools/content/preferences/devtools.js");
+  processPrefFile("chrome://devtools/content/preferences/debugger.js");
+  processPrefFile("chrome://devtools/content/webide/webide-prefs.js");
 }
 
 // Helper to listen to a key on all windows
 function MultiWindowKeyListener({ keyCode, ctrlKey, altKey, callback }) {
   let keyListener = function (event) {
     if (event.ctrlKey == !!ctrlKey &&
         event.altKey == !!altKey &&
         event.keyCode === keyCode) {
@@ -309,18 +307,16 @@ function reload(event) {
   }
 
   actionOccurred("reloadAddonReload");
 }
 
 function startup(data) {
   dump("DevTools addon started.\n");
 
-  resourceURI = data.resourceURI;
-
   listener = new MultiWindowKeyListener({
     keyCode: Ci.nsIDOMKeyEvent.DOM_VK_R, ctrlKey: true, altKey: true,
     callback: reload
   });
   listener.start();
 
   reload();
 }
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -1,14 +1,17 @@
 # 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/.
 
-devtools.jar:
+[features/devtools@mozilla.org] chrome.jar:
 %   content devtools %content/
+    content/preferences/debugger.js (preferences/debugger.js)
+    content/preferences/devtools.js (preferences/devtools.js)
+    content/webide/webide-prefs.js (webide/webide-prefs.js)
     content/shared/vendor/d3.js (shared/vendor/d3.js)
     content/shared/vendor/dagre-d3.js (shared/vendor/dagre-d3.js)
     content/shared/widgets/widgets.css (shared/widgets/widgets.css)
     content/netmonitor/src/assets/styles/netmonitor.css (netmonitor/src/assets/styles/netmonitor.css)
     content/shared/widgets/VariablesView.xul (shared/widgets/VariablesView.xul)
     content/netmonitor/index.html (netmonitor/index.html)
     content/webconsole/webconsole.xul (webconsole/webconsole.xul)
     content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul)
@@ -307,8 +310,11 @@ devtools.jar:
     skin/images/firebug/command-frames.svg (themes/images/firebug/command-frames.svg)
     skin/images/firebug/command-paintflashing.svg (themes/images/firebug/command-paintflashing.svg)
     skin/images/firebug/command-responsivemode.svg (themes/images/firebug/command-responsivemode.svg)
     skin/images/firebug/command-scratchpad.svg (themes/images/firebug/command-scratchpad.svg)
     skin/images/firebug/command-screenshot.svg (themes/images/firebug/command-screenshot.svg)
     skin/images/firebug/command-measure.svg (themes/images/firebug/command-measure.svg)
     skin/images/firebug/command-rulers.svg (themes/images/firebug/command-rulers.svg)
     skin/images/firebug/command-noautohide.svg (themes/images/firebug/command-noautohide.svg)
+
+% manifest devtools-startup.manifest
+% manifest webideComponents.manifest
--- a/devtools/client/locales/jar.mn
+++ b/devtools/client/locales/jar.mn
@@ -1,8 +1,8 @@
 #filter substitution
 # 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/.
 
-@AB_CD@.jar:
-%   locale devtools @AB_CD@ %locale/@AB_CD@/devtools/client/
-    locale/@AB_CD@/devtools/client/ (%*)
+[features/devtools@mozilla.org] chrome.jar:
+% locale devtools @AB_CD@ %locale/@AB_CD@/
+  locale/@AB_CD@/ (en-US/*)
--- a/devtools/client/moz.build
+++ b/devtools/client/moz.build
@@ -15,17 +15,16 @@ DIRS += [
     'dom',
     'framework',
     'inspector',
     'jsonview',
     'locales',
     'memory',
     'netmonitor',
     'performance',
-    'preferences',
     'responsive.html',
     'responsivedesign',
     'scratchpad',
     'shadereditor',
     'shared',
     'shims',
     'sourceeditor',
     'storage',
@@ -35,17 +34,17 @@ DIRS += [
     'webconsole',
     'webide',
 ]
 
 # Shim old theme paths used by DevTools add-ons
 if CONFIG['MOZ_BUILD_APP'] == 'browser':
     DIRS += ['themes/shims']
 
-EXTRA_COMPONENTS += [
+FINAL_TARGET_FILES.features['devtools@mozilla.org'] += [
     'devtools-startup.js',
     'devtools-startup.manifest',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
 DevToolsModules(
     'definitions.js',
deleted file mode 100644
--- a/devtools/client/preferences/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- 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/.
-
-JS_PREFERENCE_PP_FILES += [
-    'debugger.js',
-    'devtools.js'
-]
--- a/devtools/client/webide/moz.build
+++ b/devtools/client/webide/moz.build
@@ -12,14 +12,10 @@ DIRS += [
 
 BROWSER_CHROME_MANIFESTS += [
     'test/browser.ini'
 ]
 MOCHITEST_CHROME_MANIFESTS += [
     'test/chrome.ini'
 ]
 
-JS_PREFERENCE_FILES += [
-    'webide-prefs.js',
-]
-
 with Files('**'):
     BUG_COMPONENT = ('Firefox', 'Developer Tools: WebIDE')
--- a/devtools/moz.build
+++ b/devtools/moz.build
@@ -21,16 +21,20 @@ DIRS += [
     'platform',
 ]
 
 if CONFIG['MOZ_DEVTOOLS'] != 'addon':
     DIRS += [
         'server',
         'shared',
     ]
+    FINAL_TARGET_FILES.features['devtools@mozilla.org'] += [
+        'bootstrap.js',
+        'install.rdf',
+    ]
 
 # /browser uses DIST_SUBDIR.  We opt-in to this treatment when building
 # DevTools for the browser to keep the root omni.ja slim for use by external XUL
 # apps.  Mulet also uses this since it includes /browser.
 if CONFIG['MOZ_BUILD_APP'] == 'browser':
     DIST_SUBDIR = 'browser'
     export('DIST_SUBDIR')
 
--- a/devtools/server/shims/moz.build
+++ b/devtools/server/shims/moz.build
@@ -8,11 +8,11 @@ DIRS += [
     'toolkit',
 ]
 
 # Unlike most DevTools build files, this file does not use DevToolsModules
 # because these files are here for add-on compatibility, and so they must be
 # installed to previously defined locations.
 
 # Extra compatibility layer for old path after relocation in bug 1270173
-FINAL_TARGET_FILES.chrome.devtools.modules.devtools.server += [
+FINAL_TARGET_FILES.features['devtools@mozilla.org'].chrome.modules.server += [
     'protocol.js',
 ]
--- a/devtools/shared/jar.mn
+++ b/devtools/shared/jar.mn
@@ -1,10 +1,10 @@
 # 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/.
 
-devtools.jar:
-%   resource devtools %modules/devtools/
+[features/devtools@mozilla.org] chrome.jar:
+%   resource devtools %modules/
 # The typical approach would be to list all the resource files in this manifest
 # for installation.  Instead of doing this, use the DevToolsModules syntax via
 # moz.build files to do the installation so that we can enforce correct paths
 # based on source tree location.
--- a/devtools/shared/shims/fronts/moz.build
+++ b/devtools/shared/shims/fronts/moz.build
@@ -1,9 +1,11 @@
 # -*- 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/.
 
+DIST_SUBDIR = 'browser'
+
 DevToolsModules(
     'timeline.js',
 )
--- a/devtools/templates.mozbuild
+++ b/devtools/templates.mozbuild
@@ -24,12 +24,15 @@ def DevToolsModules(*modules):
         if '/' in m:
             error('DevToolsModules must be used from the same directory as ' +
                   'the files to be installed.')
 
     # jar.mn manifest files are typically used to install files to chrome
     # locations.  Instead of doing this, use this DevToolsModules syntax via
     # moz.build files to do the installation so that we can enforce correct
     # paths based on source tree location.
-    base = FINAL_TARGET_FILES.chrome.devtools.modules
-    for dir in RELATIVEDIR.split('/'):
+    base = FINAL_TARGET_FILES.features['devtools@mozilla.org'].chrome.modules
+    relative = RELATIVEDIR.split('/')
+    # Remove 'devtools' to got straight to client, shared or server folders
+    relative.pop(0)
+    for dir in relative:
         base = base[dir]
     base += [m for m in modules]