Bug 1249119 - Prevent exception when opening inspector on a loading document. r=pbro
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Oct 2016 05:26:40 -0700
changeset 319100 9ebb57bb1d766831114afb897fc13840ce8f2896
parent 319099 46b32222e682b25578d090664a9c32f389e9dae4
child 319101 47efa3e76f692a661cc2edfe0ac8e3ebf38550ac
push id30861
push usercbook@mozilla.com
push dateMon, 24 Oct 2016 14:54:01 +0000
treeherdermozilla-central@08efaee1d568 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1249119
milestone52.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 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);