Bug 1116714 part 1 - Store the document where we added anonomous content so we can call removeAnonymousContent() on it later without throwing. r=pbrosset
☠☠ backed out by 1f32089c6733 ☠ ☠
authorMats Palmgren <mats@mozilla.com>
Tue, 06 Jan 2015 09:27:56 +0000
changeset 248031 652bd77f36c180084404def4d0f0748707b2c30e
parent 248030 dbd12f80f9fae280f9bcc8a75382f6f0c3045ee8
child 248032 5e51dc838a896d4aa649926ae9e763d1a657c169
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset
bugs1116714
milestone37.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 1116714 part 1 - Store the document where we added anonomous content so we can call removeAnonymousContent() on it later without throwing. r=pbrosset
toolkit/devtools/server/actors/highlighter.js
--- a/toolkit/devtools/server/actors/highlighter.js
+++ b/toolkit/devtools/server/actors/highlighter.js
@@ -416,33 +416,35 @@ let CustomHighlighterFront = protocol.Fr
  *        The tabactor which windows will be used to insert the node
  * @param {Function} nodeBuilder
  *        A function that, when executed, returns a DOM node to be inserted into
  *        the canvasFrame
  */
 function CanvasFrameAnonymousContentHelper(tabActor, nodeBuilder) {
   this.tabActor = tabActor;
   this.nodeBuilder = nodeBuilder;
+  this.anonymousContentDocument = this.tabActor.window.document;
 
   this._insert();
 
   this._onNavigate = this._onNavigate.bind(this);
   events.on(this.tabActor, "navigate", this._onNavigate);
 }
 
 CanvasFrameAnonymousContentHelper.prototype = {
   destroy: function() {
     // If the current window isn't the one the content was inserted into, this
     // will fail, but that's fine.
     try {
-      let doc = this.tabActor.window.document;
+      let doc = this.anonymousContentDocument;
       doc.removeAnonymousContent(this._content);
-    } catch (e) {}
+    } catch (e) {console.log(e)}
     events.off(this.tabActor, "navigate", this._onNavigate);
     this.tabActor = this.nodeBuilder = this._content = null;
+    this.anonymousContentDocument = null;
   },
 
   _insert: function() {
     // Re-insert the content node after page navigation only if the new page
     // isn't XUL.
     if (!isXUL(this.tabActor)) {
       // For now highlighter.css is injected in content as a ua sheet because
       // <style scoped> doesn't work inside anonymous content (see bug 1086532).