Bug 1397343 - Lazy load dependencies from inspector front modules. r=pbro draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 06 Sep 2017 14:35:13 +0200
changeset 660614 1c0d6c16269712a3fe169c443ccf440ae89f2b15
parent 660181 91f96f589ef75e47c88744d393d90c26acf4420a
child 730302 748a09dbe9e1881d4ed790bb01648e011776f912
push id78472
push userbmo:poirot.alex@gmail.com
push dateThu, 07 Sep 2017 08:35:23 +0000
reviewerspbro
bugs1397343
milestone57.0a1
Bug 1397343 - Lazy load dependencies from inspector front modules. r=pbro MozReview-Commit-ID: JSabaxRYaeE
devtools/shared/fronts/css-properties.js
devtools/shared/fronts/inspector.js
devtools/shared/fronts/styles.js
devtools/shared/fronts/stylesheets.js
devtools/shared/fronts/webaudio.js
--- a/devtools/shared/fronts/css-properties.js
+++ b/devtools/shared/fronts/css-properties.js
@@ -1,20 +1,22 @@
 /* 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/. */
 "use strict";
 
 loader.lazyRequireGetter(this, "CSS_PROPERTIES_DB",
   "devtools/shared/css/properties-db", true);
 
+loader.lazyRequireGetter(this, "cssColors",
+  "devtools/shared/css/color-db", true);
+
 const { FrontClassWithSpec, Front } = require("devtools/shared/protocol");
 const { cssPropertiesSpec } = require("devtools/shared/specs/css-properties");
 const { Task } = require("devtools/shared/task");
-const { cssColors } = require("devtools/shared/css/color-db");
 
 /**
  * Build up a regular expression that matches a CSS variable token. This is an
  * ident token that starts with two dashes "--".
  *
  * https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  */
 var NON_ASCII = "[^\\x00-\\x7F]";
--- a/devtools/shared/fronts/inspector.js
+++ b/devtools/shared/fronts/inspector.js
@@ -18,17 +18,18 @@ const {
   inspectorSpec,
   nodeSpec,
   nodeListSpec,
   walkerSpec
 } = require("devtools/shared/specs/inspector");
 const promise = require("promise");
 const defer = require("devtools/shared/defer");
 const { Task } = require("devtools/shared/task");
-const nodeConstants = require("devtools/shared/dom-node-constants.js");
+loader.lazyRequireGetter(this, "nodeConstants",
+  "devtools/shared/dom-node-constants");
 loader.lazyRequireGetter(this, "CommandUtils",
   "devtools/client/shared/developer-toolbar", true);
 
 const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__";
 
 /**
  * Convenience API for building a list of attribute modifications
  * for the `modifyAttributes` request.
--- a/devtools/shared/fronts/styles.js
+++ b/devtools/shared/fronts/styles.js
@@ -11,17 +11,19 @@ const {
   preEvent
 } = require("devtools/shared/protocol");
 const {
   pageStyleSpec,
   styleRuleSpec
 } = require("devtools/shared/specs/styles");
 const promise = require("promise");
 const { Task } = require("devtools/shared/task");
-const { RuleRewriter } = require("devtools/shared/css/parsing-utils");
+
+loader.lazyRequireGetter(this, "RuleRewriter",
+  "devtools/shared/css/parsing-utils", true);
 
 /**
  * PageStyleFront, the front object for the PageStyleActor
  */
 const PageStyleFront = FrontClassWithSpec(pageStyleSpec, {
   initialize: function (conn, form, ctx, detail) {
     Front.prototype.initialize.call(this, conn, form, ctx, detail);
     this.inspector = this.parent();
--- a/devtools/shared/fronts/stylesheets.js
+++ b/devtools/shared/fronts/stylesheets.js
@@ -1,27 +1,28 @@
 /* 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/. */
 "use strict";
 
 const { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
 const {
-  getIndentationFromPrefs,
-  getIndentationFromString
-} = require("devtools/shared/indentation");
-const {
   originalSourceSpec,
   mediaRuleSpec,
   styleSheetSpec,
   styleSheetsSpec
 } = require("devtools/shared/specs/stylesheets");
 const promise = require("promise");
 const { Task } = require("devtools/shared/task");
 
+loader.lazyRequireGetter(this, "getIndentationFromPrefs",
+  "devtools/shared/indentation", true);
+loader.lazyRequireGetter(this, "getIndentationFromString",
+  "devtools/shared/indentation", true);
+
 /**
  * The client-side counterpart for an OriginalSourceActor.
  */
 const OriginalSourceFront = FrontClassWithSpec(originalSourceSpec, {
   initialize: function (client, form) {
     Front.prototype.initialize.call(this, client, form);
 
     this.isOriginalSource = true;
--- a/devtools/shared/fronts/webaudio.js
+++ b/devtools/shared/fronts/webaudio.js
@@ -6,17 +6,18 @@
 const {
   audionodeSpec,
   webAudioSpec,
   AUTOMATION_METHODS,
   NODE_CREATION_METHODS,
   NODE_ROUTING_METHODS,
 } = require("devtools/shared/specs/webaudio");
 const protocol = require("devtools/shared/protocol");
-const AUDIO_NODE_DEFINITION = require("devtools/server/actors/utils/audionodes.json");
+loader.lazyRequireGetter(this, "AUDIO_NODE_DEFINITION",
+  "devtools/server/actors/utils/audionodes.json");
 
 /**
  * The corresponding Front object for the AudioNodeActor.
  *
  * @attribute {String} type
  *            The type of audio node, like "OscillatorNode", "MediaElementAudioSourceNode"
  * @attribute {Boolean} source
  *            Boolean indicating if the node is a source node, like BufferSourceNode,