Bug 1345997 - Add a check for the inspector toolbox when checking if the grid inspector or box model is visible. r?jdescottes draft
authorGabriel Luong <gabriel.luong@gmail.com>
Thu, 09 Mar 2017 16:48:14 -0500
changeset 496177 d24d50656226c5110569902ba88d7669aef47b08
parent 496169 664bbd7ad4d5a1980dc892ae4c65a670cfb78400
child 548566 ec469ce64b30e1e028b61f58ef01985cf008491a
push id48546
push userbmo:gl@mozilla.com
push dateThu, 09 Mar 2017 22:10:28 +0000
reviewersjdescottes
bugs1345997
milestone55.0a1
Bug 1345997 - Add a check for the inspector toolbox when checking if the grid inspector or box model is visible. r?jdescottes MozReview-Commit-ID: 5Ve2COO5Vkc
devtools/client/inspector/boxmodel/box-model.js
devtools/client/inspector/grids/grid-inspector.js
--- a/devtools/client/inspector/boxmodel/box-model.js
+++ b/devtools/client/inspector/boxmodel/box-model.js
@@ -73,18 +73,18 @@ BoxModel.prototype = {
       onShowBoxModelHighlighter: this.onShowBoxModelHighlighter,
     };
   },
 
   /**
    * Returns true if the computed or layout panel is visible, and false otherwise.
    */
   isPanelVisible() {
-    return this.inspector.toolbox.currentToolId === "inspector" &&
-           this.inspector.sidebar &&
+    return this.inspector.toolbox && this.inspector.sidebar &&
+           this.inspector.toolbox.currentToolId === "inspector" &&
            (this.inspector.sidebar.getCurrentTabID() === "layoutview" ||
             this.inspector.sidebar.getCurrentTabID() === "computedview");
   },
 
   /**
    * Returns true if the layout panel is visible and the current node is valid to
    * be displayed in the view.
    */
--- a/devtools/client/inspector/grids/grid-inspector.js
+++ b/devtools/client/inspector/grids/grid-inspector.js
@@ -169,18 +169,18 @@ GridInspector.prototype = {
   getSwatchColorPickerTooltip() {
     return this.swatchColorPickerTooltip;
   },
 
   /**
    * Returns true if the layout panel is visible, and false otherwise.
    */
   isPanelVisible() {
-    return this.inspector.toolbox.currentToolId === "inspector" &&
-           this.inspector.sidebar &&
+    return this.inspector.toolbox && this.inspector.sidebar &&
+           this.inspector.toolbox.currentToolId === "inspector" &&
            this.inspector.sidebar.getCurrentTabID() === "layoutview";
   },
 
   /**
    * Load the grid highligher display settings into the store from the stored preferences.
    */
   loadHighlighterSettings() {
     let { dispatch } = this.store;