Description[Extensions Bindings] Add support for updateArgumentsPreValidate
A number of our custom bindings use a hook (updateArgumentsPreValidate)
to "massage" the arguments. This can be necessary when the arguments
passed by the extension are either ambiguous or don't strictly match
what we expect, and need to be converted in some way.
Add a new method on the js hook interface to allow bindings to register
a hook for this, in the same way they previously could. This is a little
complicated because it entails calling back into JS while handling a JS
call, and also modifying the arguments we're going to use.
The former complication, calling back into JS, means that we want to do
that synchronously, as opposed to asynchronously. In theory, since this
is all in a direct reaction to a JS API call, this is okay. In practice,
we default to safety and CHECK our assumptions. That is, we will still
refuse to execute if we shouldn't.
The latter complication, modifying the JS arguments we're going to use,
means that we have to move away from gin::Arguments (which don't allow
mutation) to a vector of v8 values.
Add a number of tests for the same.
BUG=653596
Review-Url: https://codereview.chromium.org/2598123002
Cr-Commit-Position: refs/heads/master@{#441821}
Committed: https://chromium.googlesource.com/chromium/src/+/f4c89ab6c9e2d821172cd1cded6163aefa894c11
Patch Set 1 #Patch Set 2 : . #Patch Set 3 : . #
Total comments: 4
Patch Set 4 : jbroman initial #Patch Set 5 : missing include #Patch Set 6 : . #Patch Set 7 : rebase #
Total comments: 14
Patch Set 8 : jbroman II #
Total comments: 2
Patch Set 9 : rebase #Messages
Total messages: 32 (21 generated)
|