Chromium Code Reviews| Index: mojo/public/js/bindings/router.js |
| diff --git a/mojo/public/js/bindings/router.js b/mojo/public/js/bindings/router.js |
| index 2718e8b0b7805bec9a81350cadd95a6b8fb13d3f..fd99ef352ecd0a8c39232324af3a243379ce070c 100644 |
| --- a/mojo/public/js/bindings/router.js |
| +++ b/mojo/public/js/bindings/router.js |
| @@ -5,7 +5,8 @@ |
| define("mojo/public/js/bindings/router", [ |
| "mojo/public/js/bindings/codec", |
| "mojo/public/js/bindings/connector", |
| -], function(codec, connector) { |
| + "mojo/public/js/bindings/validator", |
| +], function(codec, connector, validator) { |
| function Router(handle) { |
| this.connector_ = new connector.Connector(handle); |
| @@ -60,8 +61,11 @@ define("mojo/public/js/bindings/router", [ |
| }; |
| Router.prototype.handleIncomingMessage_ = function(message) { |
| - var flags = message.getFlags(); |
| - if (flags & codec.kMessageExpectsResponse) { |
| + var v = new validator.Validator(message); |
| + if (v.validateMessage() != validator.ValidationError.NONE) |
|
Tom Sepez
2014/07/29 16:32:54
nit: purists might insist on !==
hansmuller
2014/07/29 19:06:23
Done.
|
| + this.close(); |
| + |
| + if (message.expectsResponse()) { |
| if (this.incomingReceiver_) { |
| this.incomingReceiver_.acceptWithResponder(message, this); |
| } else { |
| @@ -69,7 +73,7 @@ define("mojo/public/js/bindings/router", [ |
| // listening, then we have no choice but to tear down the pipe. |
| this.close(); |
| } |
| - } else if (flags & codec.kMessageIsResponse) { |
| + } else if (message.isResponse()) { |
| var reader = new codec.MessageReader(message); |
| var requestID = reader.requestID; |
| var responder = this.responders_[requestID]; |