Bug 1460223 - Handle computedStyle.display failures for non-elements; r=gl
authorPatrick Brosset <pbrosset@mozilla.com>
Tue, 15 May 2018 10:20:03 +0200
changeset 472689 db12e77242559a3aac6d80d705deaa770269e603
parent 472688 38d9226183f0762e3182b16d0c1927e912961f47
child 472690 a9ff6f58c296e9616e070017ba452d23c3f0bf05
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1460223
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1460223 - Handle computedStyle.display failures for non-elements; r=gl MozReview-Commit-ID: 9raK8Tkl4GI
devtools/server/actors/inspector/node.js
devtools/shared/fronts/node.js
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -245,35 +245,39 @@ const NodeActor = protocol.ActorClassWit
       return null;
     }
 
     let style = this.computedStyle;
     if (!style) {
       return null;
     }
 
-    return style.display;
+    let display = null;
+    try {
+      display = style.display;
+    } catch (e) {
+      // Fails for <scrollbar> elements.
+    }
+    return display;
   },
 
   /**
-   * Is the node's display computed style value other than "none"
+   * Is the node currently displayed?
    */
   get isDisplayed() {
-    // Consider all non-element nodes as displayed.
-    if (InspectorActorUtils.isNodeDead(this) ||
-        this.rawNode.nodeType !== Ci.nsIDOMNode.ELEMENT_NODE) {
+    let type = this.displayType;
+
+    // Consider all non-elements or elements with no display-types to be displayed.
+    if (!type) {
       return true;
     }
 
-    let style = this.computedStyle;
-    if (!style) {
-      return true;
-    }
-
-    return style.display !== "none";
+    // Otherwise consider elements to be displayed only if their display-types is other
+    // than "none"".
+    return type !== "none";
   },
 
   /**
    * Are there event listeners that are listening on this node? This method
    * uses all parsers registered via event-parsers.js.registerEventParser() to
    * check if there are any event listeners.
    */
   get _hasEventListeners() {
--- a/devtools/shared/fronts/node.js
+++ b/devtools/shared/fronts/node.js
@@ -343,19 +343,17 @@ const NodeFront = FrontClassWithSpec(nod
     return this.pseudoClassLocks.some(locked => locked === pseudo);
   },
 
   get displayType() {
     return this._form.displayType;
   },
 
   get isDisplayed() {
-    // The NodeActor's form contains the isDisplayed information as a boolean
-    // starting from FF32. Before that, the property is missing
-    return "isDisplayed" in this._form ? this._form.isDisplayed : true;
+    return this._form.isDisplayed;
   },
 
   get isTreeDisplayed() {
     let parent = this;
     while (parent) {
       if (!parent.isDisplayed) {
         return false;
       }