Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: mojo/public/js/router.js

Issue 2842073003: Handle error in connector and close handle and swap with dummy handle. (Closed)
Patch Set: Formatting. Add early return in HandleError if |this.handle_| is null. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/js/connector.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « mojo/public/js/connector.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698