[Extensions Bindings] DCHECK on invalid responses
Add native validation for bindings when passing the response back to the caller that the response fits the values specified in the schema. Do this by adding the expected callback signature to the type reference map, and then matching the returned values against that signature. Given the performance cost, we don't want to check these values by default. Instead, only do so if response validation is enabled. Outside of testing, this is currently only true for debug builds; this matches current behavior for JS bindings as well. However, this is easily tweakable by a boolean, which could be linked to a finch feature if we so desired. Additionally, tweak matching against expected signatures for responses to be stricter than signature matching for callers. This is because we want to ensure that extensions are invoked with the appropriate arguments at the appropriate indices, rather than needing them to do our own complicated signature matching. This is a behavior change (and and improvement) over current JS response validation, since it will require that every response is truly valid, rather than being able to be mutated into something valid. Add unittests for all affected systems, including response validation, signature matching, and callback signature parsing. Bug: 829913 Change-Id: Ib630b3bee935f54e252f66bba7bccf14724adfa9 Reviewed-on: https://chromium-review.googlesource.com/1011407 Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Reviewed-by:Istiaque Ahmed <lazyboy@chromium.org> Reviewed-by:
Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#553859}
Showing
Please register or sign in to comment