Chromium Code Reviews| Index: remoting/webapp/client_session.js |
| diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js |
| index da8051e452e7e987b4efee4a77d271c2de0c6f40..f11f52d4162dc4d92126a2b848e708da5518b530 100644 |
| --- a/remoting/webapp/client_session.js |
| +++ b/remoting/webapp/client_session.js |
| @@ -94,6 +94,13 @@ remoting.ClientSession = function(hostJid, hostPublicKey, sharedSecret, |
| this.fullScreen_.addEventListener('click', this.callToggleFullScreen_, false); |
| /** @type {number?} @private */ |
| this.bumpScrollTimer_ = null; |
| + /** |
| + * Allow error reporting to be suppressed in situations where it would not |
| + * be useful, for example, when the device is offline. |
| + * |
| + * @type {boolean} @private |
| + */ |
| + this.logErrors_ = true; |
|
Wez
2012/08/07 00:01:00
There's a danger that we suppress logging and miss
Jamie
2012/08/07 00:37:04
We still log eof-session, and it will still have t
|
| }; |
| // Note that the positive values in both of these enums are copied directly |
| @@ -521,8 +528,15 @@ remoting.ClientSession.prototype.setState_ = function(newState) { |
| if (this.onStateChange) { |
| this.onStateChange(oldState, newState); |
| } |
| - this.logToServer.logClientSessionStateChange(this.state, this.error, |
| - this.mode); |
| + // If connection errors are being suppressed from the logs, translate |
| + // FAILED to CLOSED here. This ensures that the duration is still logged. |
| + var state = this.state; |
| + if (this.state == remoting.ClientSession.State.FAILED && |
| + !this.logErrors_) { |
| + console.log('Suppressing error.'); |
| + state = remoting.ClientSession.State.CLOSED; |
| + } |
| + this.logToServer.logClientSessionStateChange(state, this.error, this.mode); |
| }; |
| /** |
| @@ -649,6 +663,17 @@ remoting.ClientSession.prototype.logStatistics = function(stats) { |
| }; |
| /** |
| + * Enable or disable logging of connection errors. For example, if attempting |
| + * a connection using a cached JID, errors should not be logged because the |
| + * JID will be refreshed and the connection retried. |
| + * |
| + * @param {boolean} enable True to log errors; false to suppress them. |
| + */ |
| +remoting.ClientSession.prototype.logErrors = function(enable) { |
| + this.logErrors_ = enable; |
| +}; |
| + |
| +/** |
| * Toggles between full-screen and windowed mode. |
| * @return {void} Nothing. |
| * @private |