Bug 1342051 - clear css grid pattern cache when destroying highlighter;r=zer0 draft
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 27 Feb 2017 18:59:49 +0100
changeset 490131 f8e9e341e47cee7db0b662c37f718f95f07fcaed
parent 489212 6b6ca148fc2a5d840b3049b56b55ab09da2c24ed
child 490169 7647f009016ce8314bc331277c08bcdcd63b5d4a
push id47005
push userjdescottes@mozilla.com
push dateMon, 27 Feb 2017 18:00:38 +0000
reviewerszer0
bugs1342051
milestone54.0a1
Bug 1342051 - clear css grid pattern cache when destroying highlighter;r=zer0 MozReview-Commit-ID: 5LpjjzjZfs3
devtools/server/actors/highlighters/css-grid.js
--- a/devtools/server/actors/highlighters/css-grid.js
+++ b/devtools/server/actors/highlighters/css-grid.js
@@ -236,16 +236,19 @@ CssGridHighlighter.prototype = extend(Au
     let { highlighterEnv } = this;
     highlighterEnv.off("navigate", this.onNavigate);
     highlighterEnv.off("will-navigate", this.onWillNavigate);
 
     let { pageListenerTarget } = highlighterEnv;
     pageListenerTarget.removeEventListener("pagehide", this.onPageHide);
 
     this.markup.destroy();
+
+    // Clear the pattern cache to avoid dead object exceptions (Bug 1342051).
+    this._clearCache();
     AutoRefreshHighlighter.prototype.destroy.call(this);
   },
 
   getElement(id) {
     return this.markup.getElement(this.ID_CLASS_PREFIX + id);
   },
 
   get ctx() {