Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1839)

Unified Diff: remoting/webapp/client_plugin_async.js

Issue 9567033: Cleanup error handling in the client plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/remoting.gyp ('k') | remoting/webapp/client_session.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_plugin_async.js
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index e3d68cf407955e56465bb74d2b9ccf674733084c..73eb0756207cdc38fecc7eb075b9fec8c0523b06 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -119,16 +119,22 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(message_str) {
} else if (message.method == 'onConnectionStatus') {
if (typeof message.data['state'] != 'string' ||
!(message.data['state'] in remoting.ClientSession.State) ||
- typeof message.data['error'] != 'string' ||
- !(message.data['error'] in remoting.ClientSession.ConnectionError)) {
+ typeof message.data['error'] != 'string') {
console.error('Received invalid onConnectionState message: ' +
message_str);
return;
}
+
/** @type {remoting.ClientSession.State} */
var state = remoting.ClientSession.State[message.data['state']];
- /** @type {remoting.ClientSession.ConnectionError} */
- var error = remoting.ClientSession.ConnectionError[message.data['error']];
+ var error;
+ if (message.data['error'] in remoting.ClientSession.ConnectionError) {
+ error = /** @type {remoting.ClientSession.ConnectionError} */
+ remoting.ClientSession.ConnectionError[message.data['error']];
+ } else {
+ error = remoting.ClientSession.ConnectionError.UNKNOWN;
+ }
+
this.onConnectionStatusUpdateHandler(state, error);
} else if (message.method == 'onDesktopSize') {
if (typeof message.data['width'] != 'number' ||
« no previous file with comments | « remoting/remoting.gyp ('k') | remoting/webapp/client_session.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698