diff options
author | imcheng <imcheng@chromium.org> | 2015-11-24 14:13:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-24 22:14:29 +0000 |
commit | b58be47970bcac4f7413bb84fc8f34cca69f802e (patch) | |
tree | 6a88c729caf290367e04660e1f64c9cedc63b64d /extensions/renderer/resources | |
parent | 2536ddbba72ac599fe2bcedf2b9c29cb0d292dc9 (diff) | |
download | chromium_src-b58be47970bcac4f7413bb84fc8f34cca69f802e.zip chromium_src-b58be47970bcac4f7413bb84fc8f34cca69f802e.tar.gz chromium_src-b58be47970bcac4f7413bb84fc8f34cca69f802e.tar.bz2 |
[MR] Fix early return bug in converting connection state in bindings.
Some switch statements in presentationConnectionStateToMojo_ are written
as:
case 'foo':
return
reallyLongNameThatWouldGoOver80CharsIfOnPrevLine;
Unfortunately this is incorrect because semicolons are optional in
Javscript. The above statement results in undefined being returned.
Mojo then silently converts undefined into the default value when
returning to C++, which is CONNECTED.
As a result of this, the TERMINATED state is not getting translated
correctly.
This patch fixes the formatting.
We should look into adding test for media_router_bindings.js, or at
least add integration tests (after Mounir lands 1466573002)
BUG=529893
Review URL: https://codereview.chromium.org/1471423002
Cr-Commit-Position: refs/heads/master@{#361466}
Diffstat (limited to 'extensions/renderer/resources')
-rw-r--r-- | extensions/renderer/resources/media_router_bindings.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js index 13bf88b..6bc357d86 100644 --- a/extensions/renderer/resources/media_router_bindings.js +++ b/extensions/renderer/resources/media_router_bindings.js @@ -103,19 +103,18 @@ define('media_router_bindings', [ * @return {!mediaRouterMojom.MediaRouter.PresentationConnectionState} */ function presentationConnectionStateToMojo_(state) { + var PresentationConnectionState = + mediaRouterMojom.MediaRouter.PresentationConnectionState; switch (state) { case 'connected': - return - mediaRouterMojom.MediaRouter.PresentationConnectionState.CONNECTED; + return PresentationConnectionState.CONNECTED; case 'closed': - return mediaRouterMojom.MediaRouter.PresentationConnectionState.CLOSED; + return PresentationConnectionState.CLOSED; case 'terminated': - return - mediaRouterMojom.MediaRouter.PresentationConnectionState.TERMINATED; + return PresentationConnectionState.TERMINATED; default: console.error('Unknown presentation connection state: ' + state); - return - mediaRouterMojom.MediaRouter.PresentationConnectionState.TERMINATED; + return PresentationConnectionState.TERMINATED; } } |