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

Unified Diff: mojo/public/js/bindings/connection.js

Issue 488173006: Integrate Mojo JS validation bindings with the Router (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a template indentO Created 6 years, 4 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 | « no previous file | mojo/public/js/bindings/router.js » ('j') | mojo/public/js/bindings/router.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/bindings/connection.js
diff --git a/mojo/public/js/bindings/connection.js b/mojo/public/js/bindings/connection.js
index ebf60adb7f8de5a94014d762db9c1ecbc0d8c356..a92d05129e0962028b4b13faa99915f25d500681 100644
--- a/mojo/public/js/bindings/connection.js
+++ b/mojo/public/js/bindings/connection.js
@@ -6,11 +6,18 @@ define("mojo/public/js/bindings/connection", [
"mojo/public/js/bindings/router",
], function(router) {
+ function getValidators(factory) {
+ var validators = factory.prototype.validators;
+ return Array.isArray(validators) ? validators : [];
+ }
+
function Connection(handle, localFactory, remoteFactory) {
this.router_ = new router.Router(handle);
this.remote = new remoteFactory(this.router_);
this.local = new localFactory(this.remote);
this.router_.setIncomingReceiver(this.local);
+ this.router_.setValidators(
+ getValidators(localFactory).concat(getValidators(remoteFactory)));
}
Connection.prototype.close = function() {
« no previous file with comments | « no previous file | mojo/public/js/bindings/router.js » ('j') | mojo/public/js/bindings/router.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698