Bug 865328: Close console clients by building a chain of continuations. r=msucan

This commit is contained in:
Jim Blandy 2013-04-30 15:18:05 -07:00
parent 1ee74732c4
commit b8c5e96efb

View File

@ -350,26 +350,17 @@ DebuggerClient.prototype = {
let self = this;
let consolesClosed = 0;
let consolesToClose = 0;
for each (let client in this._consoleClients) {
consolesToClose++;
client.close(onConsoleClose);
}
if (!consolesToClose) {
let continuation = function () {
self._consoleClients = {};
detachThread();
}
function onConsoleClose() {
consolesClosed++;
if (consolesClosed >= consolesToClose) {
self._consoleClients = {};
detachThread();
}
for each (let client in this._consoleClients) {
continuation = client.close.bind(client, continuation);
}
continuation();
function detachThread() {
if (self.activeThread) {
self.activeThread.detach(detachTab);