• hansmuller@chromium.org's avatar
    JavaScript bindings for Mojo message validation · 093df912
    hansmuller@chromium.org authored
    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
    
    Review URL: https://codereview.chromium.org/468713002
    
    Cr-Commit-Position: refs/heads/master@{#290104}
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290104 0039d316-1c4b-4281-b951-d872f2087c98
    093df912
validation_unittests.js 8.29 KB