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 265466 62150718ee217ad0e614d77fc5ba9289612d8ab2
parent 265465 2fb9041fcc77a455b9d9109ad5ebac556ab14ab3
child 265467 302de53f3fb93b3b39f9e2a59184a3dd24266269
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiker, sledru
bugs1139937
milestone39.0a2
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