Bug 1320939 - Lazy load tooltip event helpers. r=jdescottes
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 06 Dec 2016 03:50:57 -0800
changeset 403284 c44d096d361a7bb520569e0a5e005fc5e093dcea
parent 403283 d7c310377bdf86be5104a6cee0a99dac8cd6693b
child 403285 35a4c18b0b75614e9af385da5911f6314c32d830
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1320939
milestone55.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 1320939 - Lazy load tooltip event helpers. r=jdescottes MozReview-Commit-ID: 1FXSUprpCN7
devtools/client/inspector/markup/views/element-container.js
--- a/devtools/client/inspector/markup/views/element-container.js
+++ b/devtools/client/inspector/markup/views/element-container.js
@@ -9,20 +9,23 @@ const PREVIEW_MAX_DIM_PREF = "devtools.i
 const promise = require("promise");
 const Services = require("Services");
 const Heritage = require("sdk/core/heritage");
 const {Task} = require("devtools/shared/task");
 const nodeConstants = require("devtools/shared/dom-node-constants");
 const clipboardHelper = require("devtools/shared/platform/clipboard");
 const {setImageTooltip, setBrokenImageTooltip} =
       require("devtools/client/shared/widgets/tooltip/ImageTooltipHelper");
-const {setEventTooltip} = require("devtools/client/shared/widgets/tooltip/EventTooltipHelper");
 const MarkupContainer = require("devtools/client/inspector/markup/views/markup-container");
 const ElementEditor = require("devtools/client/inspector/markup/views/element-editor");
 
+// Lazy load this module as _buildEventTooltipContent is only called on click
+loader.lazyRequireGetter(this, "setEventTooltip",
+  "devtools/client/shared/widgets/tooltip/EventTooltipHelper", true);
+
 /**
  * An implementation of MarkupContainer for Elements that can contain
  * child nodes.
  * Allows editing of tag name, attributes, expanding / collapsing.
  *
  * @param  {MarkupView} markupView
  *         The markup view that owns this container.
  * @param  {NodeFront} node
@@ -44,16 +47,17 @@ function MarkupElementContainer(markupVi
 MarkupElementContainer.prototype = Heritage.extend(MarkupContainer.prototype, {
   _buildEventTooltipContent: Task.async(function* (target, tooltip) {
     if (target.hasAttribute("data-event")) {
       yield tooltip.hide();
 
       let listenerInfo = yield this.node.getEventListenerInfo();
 
       let toolbox = this.markup.toolbox;
+
       setEventTooltip(tooltip, listenerInfo, toolbox);
       // Disable the image preview tooltip while we display the event details
       this.markup._disableImagePreviewTooltip();
       tooltip.once("hidden", () => {
         // Enable the image preview tooltip after closing the event details
         this.markup._enableImagePreviewTooltip();
       });
       tooltip.show(target);