Bug 1139937 - Don't try accessing the computedStyle of pseudo elements on reflow; r=miker

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.
This commit is contained in:
Patrick Brosset 2015-04-07 12:01:47 +02:00
parent 0c9336dbb9
commit 84737b3f2a

View File

@ -324,9 +324,15 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
* 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";