Bug 1249119 - Prevent exception when opening inspector on a loading document. r=pbro draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Oct 2016 05:26:40 -0700
changeset 427783 6621dbe5dc15405a85b37e5bba4cfa9dd160f226
parent 427782 9e8da4d69b92a5ed29a72c8ed845e87095bcef85
child 427802 955d6d6a7013b430d7b200afea211e9350cd0f1b
push id33111
push userbmo:poirot.alex@gmail.com
push dateThu, 20 Oct 2016 21:28:50 +0000
reviewerspbro
bugs1249119
milestone52.0a1
Bug 1249119 - Prevent exception when opening inspector on a loading document. r=pbro MozReview-Commit-ID: 9TNRUblT0SW
devtools/client/inspector/markup/views/markup-container.js
devtools/server/actors/inspector.js
--- a/devtools/client/inspector/markup/views/markup-container.js
+++ b/devtools/client/inspector/markup/views/markup-container.js
@@ -628,18 +628,20 @@ MarkupContainer.prototype = {
 
   set selected(value) {
     this.tagState.classList.remove("flash-out");
     this._selected = value;
     this.editor.selected = value;
     // Markup tree item should have accessible selected state.
     this.tagLine.setAttribute("aria-selected", value);
     if (this._selected) {
-      this.markup.getContainer(this.markup._rootNode).elt.setAttribute(
-        "aria-activedescendant", this.id);
+      let container = this.markup.getContainer(this.markup._rootNode);
+      if (container) {
+        container.elt.setAttribute("aria-activedescendant", this.id);
+      }
       this.tagLine.setAttribute("selected", "");
       this.tagState.classList.add("theme-selected");
     } else {
       this.tagLine.removeAttribute("selected");
       this.tagState.classList.remove("theme-selected");
     }
   },
 
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -613,16 +613,19 @@ var NodeActor = exports.NodeActor = prot
   setNodeValue: function (value) {
     this.rawNode.nodeValue = value;
   },
 
   /**
    * Get a unique selector string for this node.
    */
   getUniqueSelector: function () {
+    if (Cu.isDeadWrapper(this.rawNode)) {
+      return "";
+    }
     return CssLogic.findCssSelector(this.rawNode);
   },
 
   /**
    * Scroll the selected node into view.
    */
   scrollIntoView: function () {
     this.rawNode.scrollIntoView(true);