diff --git a/devtools/client/inspector/boxmodel/box-model.js b/devtools/client/inspector/boxmodel/box-model.js index d1fb7a217044..785cb5b96f76 100644 --- a/devtools/client/inspector/boxmodel/box-model.js +++ b/devtools/client/inspector/boxmodel/box-model.js @@ -233,6 +233,11 @@ BoxModel.prototype = { * Hides the box-model highlighter on the currently selected element. */ onHideBoxModelHighlighter() { + // As React components aren't destroyed when the panel closes, + // this function may still be called and throw because of destroyed fronts. + if (!this.inspector) { + return; + } this.inspector.highlighters.hideHighlighterType( this.inspector.highlighters.TYPES.BOXMODEL ); diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js index 9e81c81bfffe..8dbed0e2b8e1 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector.js @@ -1927,6 +1927,11 @@ Inspector.prototype = { * Options passed to the highlighter actor. */ onShowBoxModelHighlighterForNode(nodeFront, options) { + // As React components aren't destroyed when the panel closes, + // this function may still be called and throw because of destroyed fronts. + if (this._destroyed) { + return; + } this.highlighters.showHighlighterTypeForNode( this.highlighters.TYPES.BOXMODEL, nodeFront,