From 9764e96641c62d793aba37d02540a065d420cce9 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Thu, 12 Feb 2015 06:44:00 -0500 Subject: [PATCH] Bug 1132448 - Don't log CONNECTION_REFUSED errors when they're expected. r=ochameau CLOSED TREE --- toolkit/devtools/client/connection-manager.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toolkit/devtools/client/connection-manager.js b/toolkit/devtools/client/connection-manager.js index 1f57c475672d..c4c0724ff602 100644 --- a/toolkit/devtools/client/connection-manager.js +++ b/toolkit/devtools/client/connection-manager.js @@ -6,7 +6,7 @@ "use strict"; -const {Cc, Ci, Cu} = require("chrome"); +const {Cc, Ci, Cu, Cr} = require("chrome"); const {setTimeout, clearTimeout} = require('sdk/timers'); const EventEmitter = require("devtools/toolkit/event-emitter"); const DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); @@ -310,7 +310,11 @@ Connection.prototype = { this._client.addOneTimeListener("closed", this._onDisconnected); this._client.connect(this._onConnected); }, e => { - console.error(e); + // If we're continuously trying to connect, we expect the connection to be + // rejected a couple times, so don't log these. + if (!this.keepConnecting || e.result !== Cr.NS_ERROR_CONNECTION_REFUSED) { + console.error(e); + } // In some cases, especially on Mac, the openOutputStream call in // DebuggerClient.socketConnect may throw NS_ERROR_NOT_INITIALIZED. // It occurs when we connect agressively to the simulator,