Bug 1278625 - remove some lazy loading from devtools; r?jlongster
MozReview-Commit-ID: HwV7DFVJhAF
--- a/devtools/client/shared/widgets/FilterWidget.js
+++ b/devtools/client/shared/widgets/FilterWidget.js
@@ -14,18 +14,17 @@ const { Cc, Ci } = require("chrome");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const { LocalizationHelper } = require("devtools/client/shared/l10n");
const STRINGS_URI = "chrome://devtools/locale/filterwidget.properties";
const L10N = new LocalizationHelper(STRINGS_URI);
const {cssTokenizer} = require("devtools/shared/css-parsing-utils");
-loader.lazyGetter(this, "asyncStorage",
- () => require("devtools/shared/async-storage"));
+const asyncStorage = require("devtools/shared/async-storage");
loader.lazyGetter(this, "DOMUtils", () => {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
});
const DEFAULT_FILTER_TYPE = "length";
const UNIT_MAPPING = {
percentage: "%",
--- a/devtools/client/shared/widgets/Tooltip.js
+++ b/devtools/client/shared/widgets/Tooltip.js
@@ -13,21 +13,16 @@ const {CSSFilterEditorWidget} = require(
const {TooltipToggle} = require("devtools/client/shared/widgets/tooltip/TooltipToggle");
const EventEmitter = require("devtools/shared/event-emitter");
const {colorUtils} = require("devtools/shared/css-color");
const Heritage = require("sdk/core/heritage");
const {HTMLTooltip} = require("devtools/client/shared/widgets/HTMLTooltip");
const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
const {Task} = require("devtools/shared/task");
-loader.lazyRequireGetter(this, "beautify", "devtools/shared/jsbeautify/beautify");
-loader.lazyRequireGetter(this, "setNamedTimeout", "devtools/client/shared/widgets/view-helpers", true);
-loader.lazyRequireGetter(this, "clearNamedTimeout", "devtools/client/shared/widgets/view-helpers", true);
-loader.lazyRequireGetter(this, "setNamedTimeout", "devtools/client/shared/widgets/view-helpers", true);
-
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const ESCAPE_KEYCODE = Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE;
const POPUP_EVENTS = ["shown", "hidden", "showing", "hiding"];
/**
* Tooltip widget.
*
* This widget is intended at any tool that may need to show rich content in the
--- a/devtools/client/shared/widgets/tooltip/CssDocsTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/CssDocsTooltip.js
@@ -1,21 +1,19 @@
/* 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 {HTMLTooltip} = require("devtools/client/shared/widgets/HTMLTooltip");
const {MdnDocsWidget} = require("devtools/client/shared/widgets/MdnDocsWidget");
+const {KeyShortcuts} = require("devtools/client/shared/key-shortcuts");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
-loader.lazyRequireGetter(this, "KeyShortcuts",
- "devtools/client/shared/key-shortcuts", true);
-
const TOOLTIP_WIDTH = 418;
const TOOLTIP_HEIGHT = 308;
/**
* Tooltip for displaying docs for CSS properties from MDN.
*
* @param {Toolbox} toolbox
* Toolbox used to create the tooltip.
--- a/devtools/client/shared/widgets/tooltip/EventTooltipHelper.js
+++ b/devtools/client/shared/widgets/tooltip/EventTooltipHelper.js
@@ -10,18 +10,18 @@ const Services = require("Services");
loader.lazyGetter(this, "GetStringFromName", () => {
let bundle = Services.strings.createBundle(
"chrome://devtools/locale/inspector.properties");
return key => {
return bundle.GetStringFromName(key);
};
});
-loader.lazyRequireGetter(this, "Editor", "devtools/client/sourceeditor/editor");
-loader.lazyRequireGetter(this, "beautify", "devtools/shared/jsbeautify/beautify");
+const Editor = require("devtools/client/sourceeditor/editor");
+const beautify = require("devtools/shared/jsbeautify/beautify");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const CONTAINER_WIDTH = 500;
/**
* Set the content of a provided HTMLTooltip instance to display a list of event
* listeners, with their event type, capturing argument and a link to the code
* of the event handler.
--- a/devtools/client/shared/widgets/view-helpers.js
+++ b/devtools/client/shared/widgets/view-helpers.js
@@ -4,16 +4,18 @@
* 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 PANE_APPEARANCE_DELAY = 50;
const PAGE_SIZE_ITEM_COUNT_RATIO = 5;
const WIDGET_FOCUSABLE_NODES = new Set(["vbox", "hbox"]);
+var namedTimeoutsStore = new Map();
+
/**
* Inheritance helpers from the addon SDK's core/heritage.
* Remove these when all devtools are loadered.
*/
exports.Heritage = {
/**
* @see extend in sdk/core/heritage.
*/
@@ -101,18 +103,16 @@ exports.setConditionalTimeout = setCondi
* @param string id
* A string identifier for the conditional timeout.
*/
const clearConditionalTimeout = function clearConditionalTimeout(id) {
clearNamedTimeout(id);
};
exports.clearConditionalTimeout = clearConditionalTimeout;
-loader.lazyGetter(this, "namedTimeoutsStore", () => new Map());
-
/**
* Helpers for creating and messaging between UI components.
*/
const ViewHelpers = exports.ViewHelpers = {
/**
* Convenience method, dispatching a custom event.
*
* @param nsIDOMNode target
--- a/devtools/shared/fronts/styles.js
+++ b/devtools/shared/fronts/styles.js
@@ -12,20 +12,17 @@ const {
} = require("devtools/shared/protocol");
const {
pageStyleSpec,
styleRuleSpec
} = require("devtools/shared/specs/styles");
const promise = require("promise");
const { Task } = require("devtools/shared/task");
const { Class } = require("sdk/core/heritage");
-
-loader.lazyGetter(this, "RuleRewriter", () => {
- return require("devtools/shared/css-parsing-utils").RuleRewriter;
-});
+const { RuleRewriter } = require("devtools/shared/css-parsing-utils");
/**
* PageStyleFront, the front object for the PageStyleActor
*/
const PageStyleFront = FrontClass(pageStyleSpec, {
initialize: function (conn, form, ctx, detail) {
Front.prototype.initialize.call(this, conn, form, ctx, detail);
this.inspector = this.parent();
--- a/devtools/shared/inspector/css-logic.js
+++ b/devtools/shared/inspector/css-logic.js
@@ -36,18 +36,17 @@
* styling information in the page, and present this to the user in a way that
* helps them understand:
* - why their expectations may not have been fulfilled
* - how browsers process CSS
* @constructor
*/
const Services = require("Services");
-
-loader.lazyRequireGetter(this, "CSSLexer", "devtools/shared/css-lexer");
+const CSSLexer = require("devtools/shared/css-lexer");
/**
* Special values for filter, in addition to an href these values can be used
*/
exports.FILTER = {
// show properties for all user style sheets.
USER: "user",
// USER, plus user-agent (i.e. browser) style sheets