Index: mojo/public/js/router.js |
diff --git a/mojo/public/js/router.js b/mojo/public/js/router.js |
index dfe7c28b74147deb875a7cadeaad155ca3bde129..5fc0ed56b13f8e51ff57a3792f28253bffe6c851 100644 |
--- a/mojo/public/js/router.js |
+++ b/mojo/public/js/router.js |
@@ -153,8 +153,9 @@ define("mojo/public/js/router", [ |
var ok = endpoint.client.handleIncomingMessage(message, |
messageValidator); |
- if (!ok) { |
- this.handleInvalidIncomingMessage_(); |
+ // Handle invalid cached incoming message. |
+ if (!validator.isTestingMode() && !ok) { |
+ this.connector_.handleError(true, true); |
} |
} |
}).bind(this)); |
@@ -235,10 +236,6 @@ define("mojo/public/js/router", [ |
ok = endpoint.client.handleIncomingMessage(message, messageValidator); |
} |
} |
- |
- if (!ok) { |
- this.handleInvalidIncomingMessage_(); |
- } |
return ok; |
}; |
@@ -254,17 +251,6 @@ define("mojo/public/js/router", [ |
this.connector_.waitForNextMessageForTesting(); |
}; |
- Router.prototype.handleInvalidIncomingMessage_ = function(message) { |
- if (!validator.isTestingMode()) { |
- // TODO(yzshen): Consider notifying the embedder. |
- // TODO(yzshen): This should also trigger connection error handler. |
- // Consider making accept() return a boolean and let the connector deal |
- // with this, as the C++ code does. |
- this.close(); |
- return; |
- } |
- }; |
- |
Router.prototype.onPeerAssociatedEndpointClosed = function(interfaceId, |
reason) { |
check(!types.isMasterInterfaceId(interfaceId) || reason); |