diff --git a/devtools/server/actors/css-properties.js b/devtools/server/actors/css-properties.js index d24c133d4206..c83f29aa9ad9 100644 --- a/devtools/server/actors/css-properties.js +++ b/devtools/server/actors/css-properties.js @@ -19,9 +19,8 @@ const { cssColors } = require("devtools/shared/css/color-db"); exports.CssPropertiesActor = ActorClassWithSpec(cssPropertiesSpec, { typeName: "cssProperties", - initialize(conn, parent) { + initialize(conn) { Actor.prototype.initialize.call(this, conn); - this.parent = parent; }, destroy() { diff --git a/devtools/server/actors/promises.js b/devtools/server/actors/promises.js index a9a56219d785..3fd6e0ba2759 100644 --- a/devtools/server/actors/promises.js +++ b/devtools/server/actors/promises.js @@ -18,13 +18,13 @@ loader.lazyRequireGetter(this, "events", "sdk/event/core"); var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, { /** * @param conn DebuggerServerConnection. - * @param parent TabActor|RootActor + * @param parentActor TabActor|RootActor */ - initialize: function (conn, parent) { + initialize: function (conn, parentActor) { protocol.Actor.prototype.initialize.call(this, conn); this.conn = conn; - this.parent = parent; + this.parentActor = parentActor; this.state = "detached"; this._dbg = null; this._gripDepth = 0; @@ -38,16 +38,16 @@ var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, { }, destroy: function () { - protocol.Actor.prototype.destroy.call(this, this.conn); - if (this.state === "attached") { this.detach(); } + + protocol.Actor.prototype.destroy.call(this, this.conn); }, get dbg() { if (!this._dbg) { - this._dbg = this.parent.makeDebugger(); + this._dbg = this.parentActor.makeDebugger(); } return this._dbg; }, @@ -65,14 +65,14 @@ var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, { this._promisesSettled = []; this.dbg.findScripts().forEach(s => { - this.parent.sources.createSourceActors(s.source); + this.parentActor.sources.createSourceActors(s.source); }); this.dbg.onNewScript = s => { - this.parent.sources.createSourceActors(s.source); + this.parentActor.sources.createSourceActors(s.source); }; - events.on(this.parent, "window-ready", this._onWindowReady); + events.on(this.parentActor, "window-ready", this._onWindowReady); this.state = "attached"; }, "attaching to the PromisesActor"), @@ -92,7 +92,7 @@ var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, { this._navigationLifetimePool = null; } - events.off(this.parent, "window-ready", this._onWindowReady); + events.off(this.parentActor, "window-ready", this._onWindowReady); this.state = "detached"; }), @@ -122,7 +122,7 @@ var PromisesActor = protocol.ActorClassWithSpec(promisesSpec, { decrementGripDepth: () => this._gripDepth--, createValueGrip: v => createValueGrip(v, this._navigationLifetimePool, this.objectGrip), - sources: () => this.parent.sources, + sources: () => this.parentActor.sources, createEnvironmentActor: () => DevToolsUtils.reportException( "PromisesActor", Error("createEnvironmentActor not yet implemented")), getGlobalDebugObject: () => DevToolsUtils.reportException( diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index 572cd6b68467..7cd1db8c3ce7 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -161,6 +161,9 @@ StorageActors.defaults = function (typeName, observationTopic) { events.off(this.storageActor, "window-destroyed", this.onWindowDestroyed); this.hostVsStores.clear(); + + protocol.Actor.prototype.destroy.call(this); + this.storageActor = null; }, @@ -415,7 +418,11 @@ StorageActors.createActor({ events.off(this.storageActor, "window-ready", this.onWindowReady); events.off(this.storageActor, "window-destroyed", this.onWindowDestroyed); - this._pendingResponse = this.storageActor = null; + this._pendingResponse = null; + + protocol.Actor.prototype.destroy.call(this); + + this.storageActor = null; }, /** @@ -1444,6 +1451,10 @@ StorageActors.createActor({ events.off(this.storageActor, "window-ready", this.onWindowReady); events.off(this.storageActor, "window-destroyed", this.onWindowDestroyed); + + protocol.Actor.prototype.destroy.call(this); + + this.storageActor = null; }, /** @@ -2233,9 +2244,8 @@ let StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, { }, initialize(conn, tabActor) { - protocol.Actor.prototype.initialize.call(this, null); + protocol.Actor.prototype.initialize.call(this, conn); - this.conn = conn; this.parentActor = tabActor; this.childActorPool = new Map(); @@ -2271,10 +2281,8 @@ let StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, { Services.obs.removeObserver(this, "inner-window-destroyed", false); this.destroyed = true; if (this.parentActor.browser) { - this.parentActor.browser.removeEventListener( - "pageshow", this.onPageChange, true); - this.parentActor.browser.removeEventListener( - "pagehide", this.onPageChange, true); + this.parentActor.browser.removeEventListener("pageshow", this.onPageChange, true); + this.parentActor.browser.removeEventListener("pagehide", this.onPageChange, true); } // Destroy the registered store types for (let actor of this.childActorPool.values()) { @@ -2282,9 +2290,15 @@ let StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, { } this.childActorPool.clear(); this.childWindowPool.clear(); - this.childWindowPool = this.childActorPool = this.__poolMap = this.conn = - this.parentActor = this.boundUpdate = this.registeredPool = - this._pendingResponse = null; + + this.childActorPool = null; + this.childWindowPool = null; + this.parentActor = null; + this.boundUpdate = null; + this.registeredPool = null; + this._pendingResponse = null; + + protocol.Actor.prototype.destroy.call(this); }, /** diff --git a/devtools/server/primitive.js b/devtools/server/primitive.js index 45346bc78072..811c159aeeba 100644 --- a/devtools/server/primitive.js +++ b/devtools/server/primitive.js @@ -28,9 +28,7 @@ var WebGLPrimitiveCounter = exports.WebGLPrimitiveCounter = Class({ this.tabActor = tabActor; }, - destroy: function () { - this.stopRecording(); - }, + destroy: function () {}, /** * Starts monitoring primitive draws, storing the primitives count per tick.