Bug 1341680 - wait for layoutInspector to be initialized before attaching events;r=gl
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 22 Feb 2017 18:14:32 +0100
changeset 344354 882622ce817e588080b8be1db0bf0bdc572a2826
parent 344353 5ddf5a0b85ae860b8c9616f516980e545ac358cc
child 344355 9d35d61ac2ac342b4236e2ec2fb66efc93c31542
push id87336
push usergabriel.luong@gmail.com
push dateWed, 22 Feb 2017 23:36:53 +0000
treeherdermozilla-inbound@882622ce817e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1341680
milestone54.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 1341680 - wait for layoutInspector to be initialized before attaching events;r=gl MozReview-Commit-ID: IPC0VFOBPOx
devtools/client/inspector/layout/layout.js
--- a/devtools/client/inspector/layout/layout.js
+++ b/devtools/client/inspector/layout/layout.js
@@ -62,21 +62,16 @@ function LayoutView(inspector, window) {
   this.updateBoxModel = this.updateBoxModel.bind(this);
 
   this.onGridLayoutChange = this.onGridLayoutChange.bind(this);
   this.onHighlighterChange = this.onHighlighterChange.bind(this);
   this.onNewSelection = this.onNewSelection.bind(this);
   this.onSidebarSelect = this.onSidebarSelect.bind(this);
 
   this.init();
-
-  this.highlighters.on("grid-highlighter-hidden", this.onHighlighterChange);
-  this.highlighters.on("grid-highlighter-shown", this.onHighlighterChange);
-  this.inspector.selection.on("new-node-front", this.onNewSelection);
-  this.inspector.sidebar.on("select", this.onSidebarSelect);
 }
 
 LayoutView.prototype = {
 
   /**
    * Initializes the layout view by fetching the LayoutFront from the walker, creating
    * the redux store and adding the view into the inspector sidebar.
    */
@@ -84,16 +79,21 @@ LayoutView.prototype = {
     if (!this.inspector) {
       return;
     }
 
     this.layoutInspector = yield this.inspector.walker.getLayoutInspector();
 
     this.loadHighlighterSettings();
 
+    this.highlighters.on("grid-highlighter-hidden", this.onHighlighterChange);
+    this.highlighters.on("grid-highlighter-shown", this.onHighlighterChange);
+    this.inspector.selection.on("new-node-front", this.onNewSelection);
+    this.inspector.sidebar.on("select", this.onSidebarSelect);
+
     // Create a shared SwatchColorPicker instance to be reused by all GridItem components.
     this.swatchColorPickerTooltip = new SwatchColorPickerTooltip(
       this.inspector.toolbox.doc,
       this.inspector,
       {
         supportsCssColor4ColorFunction: () => false
       }
     );