Bug 1132448 - Don't log CONNECTION_REFUSED errors when they're expected. r=ochameau
authorJan Keromnes <janx@linux.com>
Thu, 12 Feb 2015 06:44:00 -0500
changeset 256010 adc101cabb7fbcfed36e6d3c6ee0362f715e584e
parent 256009 35d9b7e0d58a4ae3c83418aaf0ea89080d50cbdf
child 256011 2c97566c3cb748b3bd2d1d277bc39a60c0a86fb9
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1132448
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1132448 - Don't log CONNECTION_REFUSED errors when they're expected. r=ochameau CLOSED TREE
toolkit/devtools/client/connection-manager.js
--- a/toolkit/devtools/client/connection-manager.js
+++ b/toolkit/devtools/client/connection-manager.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "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");
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
 Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
 DevToolsUtils.defineLazyModuleGetter(this, "Task",
@@ -305,17 +305,21 @@ Connection.prototype = {
     this._getTransport().then(transport => {
       if (!transport) {
         return;
       }
       this._client = new DebuggerClient(transport);
       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,
       // and keep trying to open a socket to the server being started in
       // the simulator.
       this._onDisconnected();
     });
   },