Bug 877719 - DebuggerServer.destroy should always work. r=past

This commit is contained in:
Dave Camp 2013-05-30 09:42:00 -07:00
parent a3515f5036
commit 6ae5881813
2 changed files with 25 additions and 10 deletions

View File

@ -150,15 +150,20 @@ var DebuggerServer = {
* method returns, the debugger server must be initialized again before use.
*/
destroy: function DS_destroy() {
if (Object.keys(this._connections).length == 0) {
this.closeListener();
this.globalActorFactories = {};
this.tabActorFactories = {};
delete this._allowConnection;
this._transportInitialized = false;
this._initialized = false;
dumpn("Debugger server is shut down.");
if (!this._initialized) {
return;
}
for (let connID of Object.getOwnPropertyNames(this._connections)) {
this._connections[connID].close();
}
this.closeListener();
this.globalActorFactories = {};
this.tabActorFactories = {};
delete this._allowConnection;
this._transportInitialized = false;
this._initialized = false;
dumpn("Debugger server is shut down.");
},
/**
@ -525,6 +530,10 @@ DebuggerServerConnection.prototype = {
_transport: null,
get transport() { return this._transport },
close: function() {
this._transport.close();
},
send: function DSC_send(aPacket) {
this.transport.send(aPacket);
},

View File

@ -173,7 +173,10 @@ DebuggerTransport.prototype = {
onStopRequest:
makeInfallible(function DT_onStopRequest(aRequest, aContext, aStatus) {
this.close();
this.hooks.onClosed(aStatus);
if (this.hooks) {
this.hooks.onClosed(aStatus);
this.hooks = null;
}
}, "DebuggerTransport.prototype.onStopRequest"),
onDataAvailable:
@ -292,7 +295,10 @@ LocalDebuggerTransport.prototype = {
delete this.other;
other.close();
}
this.hooks.onClosed();
if (this.hooks) {
this.hooks.onClosed();
this.hooks = null;
}
},
/**