Bug 1346781 - do not attempt to hide highlighters if currentNode is falsy;r=zer0 draft
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 13 Mar 2017 22:15:12 +0100
changeset 498322 acfcb14dc2e4098b035de23b1b09212e418cf2de
parent 498295 08f709c14bf70434c153defd6049b29078acba9f
child 549114 d6d86566bee6e1944fa9a5e0b379729f072c9cab
push id49142
push userjdescottes@mozilla.com
push dateTue, 14 Mar 2017 14:31:32 +0000
reviewerszer0
bugs1346781, 1333714
milestone55.0a1
Bug 1346781 - do not attempt to hide highlighters if currentNode is falsy;r=zer0 This commit updates part of the logic changed in Bug 1333714 (e3a0d990896d) The hide method of the auto refresh highlighters were modified to allow hide() to be called as long as the highlighter env window was still valid. This could lead to calling hide on highlighters where show() had not been previously called, slowing down closing the inspector for no reason. This changes the hide() method to also bail out in case this.currentNode is not truthy, which means show() was not called previously. MozReview-Commit-ID: 4EOgjD6W2QB
devtools/server/actors/highlighters/auto-refresh.js
--- a/devtools/server/actors/highlighters/auto-refresh.js
+++ b/devtools/server/actors/highlighters/auto-refresh.js
@@ -114,17 +114,17 @@ AutoRefreshHighlighter.prototype = {
     }
     return shown;
   },
 
   /**
    * Hide the highlighter
    */
   hide: function () {
-    if (Cu.isDeadWrapper(this.highlighterEnv.window)) {
+    if (!this.currentNode || !this.highlighterEnv.window) {
       return;
     }
 
     this._hide();
     this._stopRefreshLoop();
     this.currentNode = null;
     this.currentQuads = {};
     this.options = null;