Bug 1518777 - move stopListeners from the client detach method to the actor destroy method; r=nchevobbe

r=ochameau,nchevobbe

This patch moves stopListeners to the actor, and removes the need for the callback in the
detach call on the client.

Differential Revision: https://phabricator.services.mozilla.com/D16178

--HG--
extra : moz-landing-system : lando
This commit is contained in:
yulia 2019-01-24 11:48:37 +00:00
parent da28778ed4
commit 1e21fdffad
2 changed files with 5 additions and 38 deletions

View File

@ -328,39 +328,6 @@ WebConsoleActor.prototype =
* Destroy the current WebConsoleActor instance.
*/
destroy() {
if (this.consoleServiceListener) {
this.consoleServiceListener.destroy();
this.consoleServiceListener = null;
}
if (this.netmonitors) {
for (const { messageManager } of this.netmonitors) {
messageManager.sendAsyncMessage("debug:destroy-network-monitor", {
actorID: this.actorID,
});
}
this.netmonitors = null;
}
if (this.consoleAPIListener) {
this.consoleAPIListener.destroy();
this.consoleAPIListener = null;
}
if (this.stackTraceCollector) {
this.stackTraceCollector.destroy();
this.stackTraceCollector = null;
}
if (this.consoleProgressListener) {
this.consoleProgressListener.destroy();
this.consoleProgressListener = null;
}
if (this.consoleReflowListener) {
this.consoleReflowListener.destroy();
this.consoleReflowListener = null;
}
if (this.contentProcessListener) {
this.contentProcessListener.destroy();
this.contentProcessListener = null;
}
EventEmitter.off(this.parentActor, "changed-toplevel-document",
this._onChangedToplevelDocument);
@ -375,6 +342,7 @@ WebConsoleActor.prototype =
this.dbg.onConsoleMessage = null;
}
this.stopListeners({ listeners: null });
this._actorPool = null;
this._webConsoleCommandsCache = null;
this._lastConsoleInputEvaluation = null;
@ -740,8 +708,8 @@ WebConsoleActor.prototype =
// If no specific listeners are requested to be detached, we stop all
// listeners.
const toDetach = request.listeners ||
["PageError", "ConsoleAPI", "NetworkActivity",
"FileActivity", "ContentProcessMessages"];
["PageError", "ConsoleAPI", "NetworkActivity", "FileActivity",
"ReflowActivity", "ContentProcessMessages", "DocumentEvents"];
while (toDetach.length > 0) {
const listener = toDetach.shift();

View File

@ -696,8 +696,7 @@ WebConsoleClient.prototype = {
},
/**
* Close the WebConsoleClient. This stops all the listeners on the server and
* detaches from the console actor.
* Close the WebConsoleClient.
*
* @param function onResponse
* Function to invoke when the server response is received.
@ -709,13 +708,13 @@ WebConsoleClient.prototype = {
this.onNetworkEventUpdate);
this._client.removeListener("inspectObject", this.onInspectObject);
this._client.removeListener("documentEvent", this.onDocEvent);
this.stopListeners(null, onResponse);
this._longStrings = null;
this._client = null;
this.pendingEvaluationResults.clear();
this.pendingEvaluationResults = null;
this.clearNetworkRequests();
this._networkRequests = null;
onResponse();
},
clearNetworkRequests: function() {