Bug 914403 - Part 1: Fix explicit selection removal with remote highlighter. r=paul, a=lsblakk
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 16 Sep 2013 19:23:57 -0500
changeset 160341 b7c012b45bf6cb702c2e479a7806dd3ee246acf2
parent 160340 cd61e189b895193d1cacd235b150825f84559cc5
child 160342 a72a845b6892e034c089df25d90430f2404847e7
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul, lsblakk
bugs914403
milestone26.0a2
Bug 914403 - Part 1: Fix explicit selection removal with remote highlighter. r=paul, a=lsblakk
browser/devtools/inspector/test/browser_inspector_basic_highlighter.js
toolkit/devtools/server/actors/inspector.js
--- a/browser/devtools/inspector/test/browser_inspector_basic_highlighter.js
+++ b/browser/devtools/inspector/test/browser_inspector_basic_highlighter.js
@@ -40,17 +40,17 @@ function test()
     let nodes = doc.querySelectorAll(":-moz-devtools-highlighted");
     is(nodes.length, 1, "only one node selected");
     is(nodes[0], h1, "h1 selected");
     inspector.selection.once("new-node-front", () => executeSoon(testNoNodeSelected));
     inspector.selection.setNode(null);
   }
 
   function testNoNodeSelected() {
-    ok(doc.querySelectorAll(":-moz-devtools-highlighted").length, 0, "no node selected");
+    ok(doc.querySelectorAll(":-moz-devtools-highlighted").length === 0, "no node selected");
     finishUp();
   }
 
   function finishUp() {
     let h = require("devtools/inspector/highlighter");
     h._forceBasic.value = false;
     gBrowser.removeCurrentTab();
     finish();
--- a/toolkit/devtools/server/actors/inspector.js
+++ b/toolkit/devtools/server/actors/inspector.js
@@ -918,25 +918,25 @@ var WalkerActor = protocol.ActorClass({
     }
     let nodes = this.rootDoc.querySelectorAll(HIGHLIGHTED_PSEUDO_CLASS);
     for (let node of nodes) {
       DOMUtils.removePseudoClassLock(node, HIGHLIGHTED_PSEUDO_CLASS);
     }
   },
 
   highlight: method(function(node) {
-    this._installHelperSheet(node);
     this._unhighlight();
 
     if (!node ||
         !node.rawNode ||
          node.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE) {
       return;
     }
 
+    this._installHelperSheet(node);
     this.layoutHelpers.scrollIntoViewIfNeeded(node.rawNode);
     DOMUtils.addPseudoClassLock(node.rawNode, HIGHLIGHTED_PSEUDO_CLASS);
     this._highlightTimeout = setTimeout(this._unhighlight.bind(this), HIGHLIGHTED_TIMEOUT);
 
   }, { request: { node: Arg(0, "nullable:domnode") }}),
 
   /**
    * Watch the given document node for mutations using the DOM observer