Bug 1458758 - Lazy load Menu, MenuItem and clipboardHelper in StyleInspectorMenu. r=ochameau draft
authorGabriel Luong <gabriel.luong@gmail.com>
Wed, 02 May 2018 21:45:23 -0400
changeset 790906 e788749d697965ca5c29ff2d1f856f0ea7cbece7
parent 790900 cb245b9a8b2ce1dbe877f85566cf16613d8d9b44
push id108631
push userbmo:gl@mozilla.com
push dateThu, 03 May 2018 01:46:23 +0000
reviewersochameau
bugs1458758
milestone61.0a1
Bug 1458758 - Lazy load Menu, MenuItem and clipboardHelper in StyleInspectorMenu. r=ochameau MozReview-Commit-ID: B4hmFinE7Dy
devtools/client/inspector/shared/style-inspector-menu.js
--- a/devtools/client/inspector/shared/style-inspector-menu.js
+++ b/devtools/client/inspector/shared/style-inspector-menu.js
@@ -2,28 +2,27 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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 Services = require("Services");
-
-const Menu = require("devtools/client/framework/menu");
-const MenuItem = require("devtools/client/framework/menu-item");
-
 const {
   VIEW_NODE_SELECTOR_TYPE,
   VIEW_NODE_PROPERTY_TYPE,
   VIEW_NODE_VALUE_TYPE,
   VIEW_NODE_IMAGE_URL_TYPE,
   VIEW_NODE_LOCATION_TYPE,
 } = require("devtools/client/inspector/shared/node-types");
-const clipboardHelper = require("devtools/shared/platform/clipboard");
+
+loader.lazyRequireGetter(this, "Menu", "devtools/client/framework/menu");
+loader.lazyRequireGetter(this, "MenuItem", "devtools/client/framework/menu-item");
+loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clipboard");
 
 const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
 const {LocalizationHelper} = require("devtools/shared/l10n");
 const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
 
 const PREF_ORIG_SOURCES = "devtools.source-map.client-service.enabled";
 
 /**