Bug 1249119 - Prevent exception when opening inspector on a loading document. r=pbro
MozReview-Commit-ID: 9TNRUblT0SW
--- 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);