Bug 1341680 - wait for layoutInspector to be initialized before attaching events;r=gl draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 22 Feb 2017 18:14:32 +0100
changeset 488133 4ffa62d7bae8894009e327051cd9da1c368595f8
parent 487583 c7b015c488cfb2afbcff295a9639acd85df332f8
child 546654 b48bcea6727d10a647a127bca5608d8addecebf2
push id46439
push userjdescottes@mozilla.com
push dateWed, 22 Feb 2017 17:15:19 +0000
reviewersgl
bugs1341680
milestone54.0a1
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
@@ -47,21 +47,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.
    */
@@ -69,16 +64,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);
+
     let app = App({
       /**
        * Shows the box model properties under the box model if true, otherwise, hidden by
        * default.
        */
       showBoxModelProperties: true,
 
       /**