From 29af71d6af3d1028df8bd2978a171d412246a2d0 Mon Sep 17 00:00:00 2001 From: yulia Date: Wed, 26 Sep 2018 10:08:43 +0200 Subject: [PATCH] Bug 1473513 - resolve memory leak Summary: Depends on D6476 Reviewers: ochameau Reviewed By: ochameau Bug #: 1473513 Differential Revision: https://phabricator.services.mozilla.com/D6477 --HG-- extra : rebase_source : 61ccae905e3136ad3c293db692551786e83075c7 --- devtools/server/actor-registry.js | 2 +- devtools/server/actors/targets/browsing-context.js | 2 +- devtools/server/actors/targets/worker.js | 2 +- devtools/server/actors/worker/service-worker.js | 2 +- devtools/shared/transport/tests/unit/testactors.js | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/devtools/server/actor-registry.js b/devtools/server/actor-registry.js index 035af51aedae..707559e0c9a9 100644 --- a/devtools/server/actor-registry.js +++ b/devtools/server/actor-registry.js @@ -251,7 +251,7 @@ const ActorRegistry = { constructor: "AccessibilityActor", type: { target: true } }); - this.registerModule("devtools/server/actors/screenshot", { + this.registerModule("devtools/server/actors/screenshot", { prefix: "screenshot", constructor: "ScreenshotActor", type: { target: true } diff --git a/devtools/server/actors/targets/browsing-context.js b/devtools/server/actors/targets/browsing-context.js index b25430322b2e..cf266476a40f 100644 --- a/devtools/server/actors/targets/browsing-context.js +++ b/devtools/server/actors/targets/browsing-context.js @@ -495,8 +495,8 @@ const browsingContextTargetPrototype = { * Called when the actor is removed from the connection. */ destroy() { - Actor.prototype.destroy.call(this); this.exit(); + Actor.prototype.destroy.call(this); }, /** diff --git a/devtools/server/actors/targets/worker.js b/devtools/server/actors/targets/worker.js index 633b84ca2380..6ed88e0b7d01 100644 --- a/devtools/server/actors/targets/worker.js +++ b/devtools/server/actors/targets/worker.js @@ -90,10 +90,10 @@ const WorkerTargetActor = protocol.ActorClassWithSpec(workerTargetSpec, { }, destroy() { - protocol.Actor.prototype.destroy.call(this); if (this._attached) { this._detach(); } + protocol.Actor.prototype.destroy.call(this); }, connect(options) { diff --git a/devtools/server/actors/worker/service-worker.js b/devtools/server/actors/worker/service-worker.js index d4606665180f..ff1461686c7d 100644 --- a/devtools/server/actors/worker/service-worker.js +++ b/devtools/server/actors/worker/service-worker.js @@ -50,8 +50,8 @@ const PushSubscriptionActor = protocol.ActorClassWithSpec(pushSubscriptionSpec, }, destroy() { - protocol.Actor.prototype.destroy.call(this); this._subscription = null; + protocol.Actor.prototype.destroy.call(this); }, }); diff --git a/devtools/shared/transport/tests/unit/testactors.js b/devtools/shared/transport/tests/unit/testactors.js index 173024f7aed8..3b34c5d18694 100644 --- a/devtools/shared/transport/tests/unit/testactors.js +++ b/devtools/shared/transport/tests/unit/testactors.js @@ -7,7 +7,6 @@ const { RootActor } = require("devtools/server/actors/root"); const { ThreadActor } = require("devtools/server/actors/thread"); const { DebuggerServer } = require("devtools/server/main"); const { ActorRegistry } = require("devtools/server/actor-registry"); -const promise = require("promise"); var gTestGlobals = []; DebuggerServer.addTestGlobal = function(global) {