DescriptionJavaScript bindings for Mojo message validation
For each interface Foo, the Mojo JavaScript bindings now generate
a pair of functions: |validateFooRequest(validator)| and
|validateFooResponse(messageValidator)|.
For each Mojo struct type, an additional |validate(validator)|
method is generated.
All of the validate methods return a validationError;
validationError.NONE if the message is valid or not recognized.
The JS validator class has been extended to validate structs, arrays,
and handles.
The generated methods are unit tested, in the same way as their C++
counterparts, by reading test messages and expected results from
/mojo/public/interfaces/bindings/tests/data/validation/.
Currently the two pointer overflow test cases are skipped because
they depend on reading 64 uints, which the test message file parser
can't handle at the moment. JS doesn't support 64 bit integers. 53
bits is the limit for integer Numbers.
The message router still only checks the validity of incoming message
headers. I'd like to integrate the router with the new validation code
in a separate commit.
BUG=386808
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=290104
Patch Set 1 #Patch Set 2 : Merged #Patch Set 3 : Removed a console import #
Total comments: 14
Patch Set 4 : Simplified the interface definition template #
Total comments: 15
Patch Set 5 : Updates to the unit test, bindings generator, and codec.js #Patch Set 6 : Binding generator simplification for Arrays #
Total comments: 33
Patch Set 7 : Updates per yzshen's second round of feedback #
Total comments: 1
Patch Set 8 : Restored a blank link #Patch Set 9 : Skip unexpected null tests" #Messages
Total messages: 19 (0 generated)
|