Bug 1342051 - clear css grid pattern cache when destroying highlighter;r=zer0
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 27 Feb 2017 18:59:49 +0100
changeset 345258 f32a30e626416f963ac3bd6a08d4a71d8ea084ea
parent 345257 a3859b017684597459fccd2648f4be46f72513d7
child 345259 a88a6717a2b7830c24f1d14970309224a8db4f80
push id87555
push usercbook@mozilla.com
push dateWed, 01 Mar 2017 15:40:32 +0000
treeherdermozilla-inbound@33c9d4c02376 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszer0
bugs1342051
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 1342051 - clear css grid pattern cache when destroying highlighter;r=zer0 MozReview-Commit-ID: 5LpjjzjZfs3
devtools/client/inspector/rules/test/browser_rules_grid-highlighter-on-reload.js
devtools/server/actors/highlighters/css-grid.js
--- a/devtools/client/inspector/rules/test/browser_rules_grid-highlighter-on-reload.js
+++ b/devtools/client/inspector/rules/test/browser_rules_grid-highlighter-on-reload.js
@@ -25,17 +25,17 @@ add_task(function* () {
 
   info("Check that the grid highlighter can be displayed");
   yield checkGridHighlighter();
 
   info("Close the toolbox before reloading the tab");
   let target = TargetFactory.forTab(gBrowser.selectedTab);
   yield gDevTools.closeToolbox(target);
 
-  refreshTab(gBrowser.selectedTab);
+  yield refreshTab(gBrowser.selectedTab);
 
   info("Check that the grid highlighter can be displayed after reloading the page");
   yield checkGridHighlighter();
 });
 
 function* checkGridHighlighter() {
   let {inspector, view} = yield openRuleView();
   let {highlighters} = view;
--- 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() {