Integrate Mojo JS validation bindings with the Router
commit08768f75fe85867797a826fc53f555d592cfda5c
authorhansmuller <hansmuller@chromium.org>
Wed, 27 Aug 2014 23:45:25 +0000 (27 16:45 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 27 Aug 2014 23:46:04 +0000 (27 23:46 +0000)
tree465961717a99d0feb952ed2b0c472a687ce0c63d
parentfcf8643d31301eea990a4c42d7d8c9fc30cc33ec
Integrate Mojo JS validation bindings with the Router

Instad of generating exported validateFooRequest(),
validateFooResponse() methods, a pointer to a validation
functions is added to the generated Stub and Proxy class
prototypes. For example, given an interface Foo, with
client interface FooClient:

  FooStub.prototype.validators = [validateFooRequest];
  FooProxy.prototype.validators = [validateFooResponse];

Note that if interface Foo has no callbacks, then
FooProxy.prototype.validators is an empty array.

The router validates incoming messages using these functions
and validateMessageHeader().

BUG=407181

Review URL: https://codereview.chromium.org/488173006

Cr-Commit-Position: refs/heads/master@{#292270}
mojo/public/js/bindings/connection.js
mojo/public/js/bindings/router.js
mojo/public/js/bindings/validation_unittests.js
mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
mojo/public/tools/bindings/generators/js_templates/module.js.tmpl