Bug 1302702 - Fix inspector panel deadwrapper exceptions on addon reloads.
MozReview-Commit-ID: DPaUiLeTyCC
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -2441,16 +2441,18 @@ var WalkerActor = protocol.ActorClassWit
}
if (isTopLevel) {
// If we initialize the inspector while the document is loading,
// we may already have a root document set in the constructor.
if (this.rootDoc && !Cu.isDeadWrapper(this.rootDoc) &&
this.rootDoc.defaultView) {
this.onFrameUnload({ window: this.rootDoc.defaultView });
}
+ // Update all DOM objects references to target the new document.
+ this.rootWin = window;
this.rootDoc = window.document;
this.rootNode = this.document();
this.queueMutation({
type: "newRoot",
target: this.rootNode.form()
});
return;
}
@@ -2982,17 +2984,17 @@ function isNodeDead(node) {
* Either SKIP_TO_PARENT or SKIP_TO_SIBLING. If the provided node is not compatible
* with the filter function for this walker, try to find a compatible one either
* in the parents or in the siblings of the node.
*/
function DocumentWalker(node, rootWin,
whatToShow = nodeFilterConstants.SHOW_ALL,
filter = standardTreeWalkerFilter,
skipTo = SKIP_TO_PARENT) {
- if (!rootWin.location) {
+ if (Cu.isDeadWrapper(rootWin) || !rootWin.location) {
throw new Error("Got an invalid root window in DocumentWalker");
}
this.walker = Cc["@mozilla.org/inspector/deep-tree-walker;1"]
.createInstance(Ci.inIDeepTreeWalker);
this.walker.showAnonymousContent = true;
this.walker.showSubDocuments = true;
this.walker.showDocumentsAsNodes = true;