diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 23:50:45 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 23:50:45 +0000 |
commit | 05b76a01a1a3ad57ed55a8b5aff173c6ace262fa (patch) | |
tree | 2ecdbe887970ee923aaeacd0b7543b06924e5a63 /remoting/webapp/client_plugin_async.js | |
parent | de860e038998941c597c729d7812497a3b841574 (diff) | |
download | chromium_src-05b76a01a1a3ad57ed55a8b5aff173c6ace262fa.zip chromium_src-05b76a01a1a3ad57ed55a8b5aff173c6ace262fa.tar.gz chromium_src-05b76a01a1a3ad57ed55a8b5aff173c6ace262fa.tar.bz2 |
Remoting webapp: Use hasOwnProperty instead of if..in.. where needed
Cases such as "if 'someLiteralString' in myObj" are OK and not changed
by this CL. But when the attribute being tested comes from external
input, this CL fixes the test to use hasOwnProperty(), which is
appropriate for simple enumerations and similar types such as
window.localStorage.
BUG=246380
R=jamiewalch@chromium.org
Review URL: https://codereview.chromium.org/17322005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/client_plugin_async.js')
-rw-r--r-- | remoting/webapp/client_plugin_async.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js index a4ac9eb..f457d15 100644 --- a/remoting/webapp/client_plugin_async.js +++ b/remoting/webapp/client_plugin_async.js @@ -203,7 +203,7 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { this.onDebugMessageHandler(message.data['message']); } else if (message.method == 'onConnectionStatus') { if (typeof message.data['state'] != 'string' || - !(message.data['state'] in remoting.ClientSession.State) || + !remoting.ClientSession.State.hasOwnProperty(message.data['state']) || typeof message.data['error'] != 'string') { console.error('Received invalid onConnectionState message: ' + messageStr); @@ -213,7 +213,8 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { /** @type {remoting.ClientSession.State} */ var state = remoting.ClientSession.State[message.data['state']]; var error; - if (message.data['error'] in remoting.ClientSession.ConnectionError) { + if (remoting.ClientSession.ConnectionError.hasOwnProperty( + message.data['error'])) { error = /** @type {remoting.ClientSession.ConnectionError} */ remoting.ClientSession.ConnectionError[message.data['error']]; } else { |