From 45422188ae27037456155c6b61dc0ce4612d07b5 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Mon, 8 Sep 2014 14:18:20 -0500 Subject: [PATCH] bug 1063648 - don't cache transport. r=jryans --- toolkit/devtools/client/connection-manager.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/toolkit/devtools/client/connection-manager.js b/toolkit/devtools/client/connection-manager.js index 382c2aa98bcb..d0513ee706c2 100644 --- a/toolkit/devtools/client/connection-manager.js +++ b/toolkit/devtools/client/connection-manager.js @@ -193,8 +193,8 @@ Connection.prototype = { return; } if (!this._client) { - this._transport = transport; - if (this._transport) { + this._customTransport = transport; + if (this._customTransport) { this.log("connecting (custom transport)"); } else { this.log("connecting to " + this.host + ":" + this.port); @@ -223,12 +223,15 @@ Connection.prototype = { }, _clientConnect: function () { - if (!this._transport) { + let transport; + if (this._customTransport) { + transport = this._customTransport; + } else { if (!this.host) { - this._transport = DebuggerServer.connectPipe(); + transport = DebuggerServer.connectPipe(); } else { try { - this._transport = debuggerSocketConnect(this.host, this.port); + transport = debuggerSocketConnect(this.host, this.port); } catch (e) { // In some cases, especially on Mac, the openOutputStream call in // debuggerSocketConnect may throw NS_ERROR_NOT_INITIALIZED. @@ -240,7 +243,7 @@ Connection.prototype = { } } } - this._client = new DebuggerClient(this._transport); + this._client = new DebuggerClient(transport); this._client.addOneTimeListener("closed", this._onDisconnected); this._client.connect(this._onConnected); }, @@ -259,6 +262,7 @@ Connection.prototype = { _onDisconnected: function() { this._client = null; + this._customTransport = null; if (this._status == Connection.Status.CONNECTING && this.keepConnecting) { setTimeout(() => this._clientConnect(), 100);