Chromium Code Reviews| Index: remoting/webapp/host_native_messaging.js |
| diff --git a/remoting/webapp/host_native_messaging.js b/remoting/webapp/host_native_messaging.js |
| index 8ed628c9120bc2309a0b779d0674673677b773b0..18117371d31cfbe97947e97d348cc22c6d4d7a43 100644 |
| --- a/remoting/webapp/host_native_messaging.js |
| +++ b/remoting/webapp/host_native_messaging.js |
| @@ -109,11 +109,11 @@ function checkType_(name, object, type) { |
| * @return {remoting.HostController.AsyncResult?} Converted result. |
| */ |
| function asAsyncResult_(result) { |
| - if (!checkType_('result', result, 'number')) { |
| + if (!checkType_('result', result, 'string')) { |
| return null; |
| } |
| for (var i in remoting.HostController.AsyncResult) { |
| - if (remoting.HostController.AsyncResult[i] == result) { |
| + if (i == result) { |
| return remoting.HostController.AsyncResult[i]; |
| } |
| } |
| @@ -129,11 +129,11 @@ function asAsyncResult_(result) { |
| * @return {remoting.HostController.State?} Converted result. |
| */ |
| function asHostState_(result) { |
| - if (!checkType_('result', result, 'number')) { |
| + if (!checkType_('result', result, 'string')) { |
| return null; |
| } |
| for (var i in remoting.HostController.State) { |
|
Sergey Ulanov
2013/05/30 23:14:52
You can replace this loop with:
if (result in rem
Lambros
2013/05/31 01:32:56
Nice! Done.
|
| - if (remoting.HostController.State[i] == result) { |
| + if (i == result) { |
| return remoting.HostController.State[i]; |
| } |
| } |