Bug 1116714 part 1 - Store the document where we added anonomous content so we can call removeAnonymousContent() on it later without throwing. r=pbrosset

This commit is contained in:
Mats Palmgren 2015-01-06 09:27:56 +00:00
parent 42d993decb
commit ed0d945146

View File

@ -421,6 +421,7 @@ let CustomHighlighterFront = protocol.FrontClass(CustomHighlighterActor, {});
function CanvasFrameAnonymousContentHelper(tabActor, nodeBuilder) { function CanvasFrameAnonymousContentHelper(tabActor, nodeBuilder) {
this.tabActor = tabActor; this.tabActor = tabActor;
this.nodeBuilder = nodeBuilder; this.nodeBuilder = nodeBuilder;
this.anonymousContentDocument = this.tabActor.window.document;
this._insert(); this._insert();
@ -433,11 +434,12 @@ CanvasFrameAnonymousContentHelper.prototype = {
// If the current window isn't the one the content was inserted into, this // If the current window isn't the one the content was inserted into, this
// will fail, but that's fine. // will fail, but that's fine.
try { try {
let doc = this.tabActor.window.document; let doc = this.anonymousContentDocument;
doc.removeAnonymousContent(this._content); doc.removeAnonymousContent(this._content);
} catch (e) {} } catch (e) {console.log(e)}
events.off(this.tabActor, "navigate", this._onNavigate); events.off(this.tabActor, "navigate", this._onNavigate);
this.tabActor = this.nodeBuilder = this._content = null; this.tabActor = this.nodeBuilder = this._content = null;
this.anonymousContentDocument = null;
}, },
_insert: function() { _insert: function() {