Bug 795978 - Error: this._containers is undefined in MarkupView.jsm Line: 327; r=mratcliffe

This commit is contained in:
J. Ryan Stinnett 2013-04-30 16:05:22 -05:00
parent a12d043261
commit 6f0e8150ab

View File

@ -68,6 +68,8 @@ function MarkupView(aInspector, aFrame, aControllerWindow)
this._boundFocus = this._onFocus.bind(this);
this._frame.addEventListener("focus", this._boundFocus, false);
this._boundOnLoadRootNode = this._onLoadRootNode.bind(this);
this._initPreview();
}
@ -313,10 +315,7 @@ MarkupView.prototype = {
var container = new RootContainer(this, aNode);
this._elt.appendChild(container.elt);
this._rootNode = aNode;
aNode.addEventListener("load", function MP_watch_contentLoaded(aEvent) {
// Fake a childList mutation here.
this._mutationObserver([{target: aEvent.target, type: "childList"}]);
}.bind(this), true);
aNode.addEventListener("load", this._boundOnLoadRootNode, true);
}
this._containers.set(aNode, container);
@ -334,6 +333,14 @@ MarkupView.prototype = {
return container;
},
/**
* Update the state of the tree once the root node is loaded.
*/
_onLoadRootNode: function MV__onLoadRootNode(aEvent) {
// Fake a childList mutation here.
this._mutationObserver([{target: aEvent.target, type: "childList"}]);
},
/**
* Mutation observer used for included nodes.
*/
@ -654,6 +661,9 @@ MarkupView.prototype = {
this._inspector.selection.off("new-node", this._boundOnNewSelection);
delete this._boundOnNewSelection;
this._rootNode.removeEventListener("load", this._boundOnLoadRootNode, true);
delete this._boundOnLoadRootNode;
delete this._elt;
delete this._containers;