Bug 1139937 - Don't try accessing the computedStyle of pseudo elements on reflow. r=miker, a=sledru
authorPatrick Brosset <pbrosset@mozilla.com>
Tue, 07 Apr 2015 12:01:47 +0200
changeset 258385 9a763ea8d781
parent 258384 115865f14324
child 258386 a3c18ef98317
push id4657
push userryanvm@gmail.com
push date2015-04-08 20:55 +0000
treeherdermozilla-beta@bfff2ca94766 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiker, sledru
bugs1139937
milestone38.0
Bug 1139937 - Don't try accessing the computedStyle of pseudo elements on reflow. r=miker, a=sledru In some situations the WalkerActor tries to access the computed-style (via css-logic.css) of pseudo (after or before) elements in the DOM. It does this on reflows to update the visibility indicator on nodes in the inspector-panel. This fixes early checks in the reflows event handler to avoid trying to get the style if the node isn't an element.
toolkit/devtools/server/actors/inspector.js
--- a/toolkit/devtools/server/actors/inspector.js
+++ b/toolkit/devtools/server/actors/inspector.js
@@ -319,19 +319,25 @@ var NodeActor = exports.NodeActor = prot
   get computedStyle() {
     return CssLogic.getComputedStyle(this.rawNode);
   },
 
   /**
    * Is the node's display computed style value other than "none"
    */
   get isDisplayed() {
+    // Consider all non-element nodes as displayed.
+    if (this.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE ||
+        this.isAfterPseudoElement ||
+        this.isBeforePseudoElement) {
+      return true;
+    }
+
     let style = this.computedStyle;
     if (!style) {
-      // Consider all non-element nodes as displayed
       return true;
     } else {
       return style.display !== "none";
     }
   },
 
   /**
    * Are there event listeners that are listening on this node? This method