Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 2598123002: [Extensions Bindings] Add support for updateArgumentsPreValidate (Closed)

Created:
4 years ago by Devlin
Modified:
3 years, 11 months ago
Reviewers:
lazyboy, jbroman
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+500 lines, -143 lines) Patch
M extensions/renderer/api_binding.cc View 1 2 3 4 5 6 7 8 1 chunk +38 lines, -18 lines 0 comments Download
M extensions/renderer/api_binding_hooks.h View 1 5 chunks +15 lines, -4 lines 0 comments Download
M extensions/renderer/api_binding_hooks.cc View 1 2 3 4 5 6 7 7 chunks +156 lines, -61 lines 0 comments Download
M extensions/renderer/api_binding_test_util.h View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M extensions/renderer/api_binding_test_util.cc View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 0 comments Download
M extensions/renderer/api_binding_types.h View 1 2 3 4 5 6 7 1 chunk +13 lines, -0 lines 0 comments Download
M extensions/renderer/api_binding_unittest.cc View 1 2 3 4 5 6 7 8 9 chunks +132 lines, -13 lines 0 comments Download
M extensions/renderer/api_bindings_system.h View 2 chunks +3 lines, -0 lines 0 comments Download
M extensions/renderer/api_bindings_system.cc View 1 2 3 4 5 6 7 8 3 chunks +8 lines, -5 lines 0 comments Download
M extensions/renderer/api_bindings_system_unittest.cc View 1 2 3 4 5 6 2 chunks +15 lines, -13 lines 0 comments Download
M extensions/renderer/api_signature.h View 3 chunks +4 lines, -6 lines 0 comments Download
M extensions/renderer/api_signature.cc View 1 2 3 4 12 chunks +42 lines, -23 lines 0 comments Download
M extensions/renderer/native_extension_bindings_system.cc View 1 2 3 4 5 6 7 2 chunks +28 lines, -0 lines 0 comments Download
M extensions/renderer/native_extension_bindings_system_unittest.cc View 1 2 3 4 5 6 2 chunks +29 lines, -0 lines 0 comments Download

Messages

Total messages: 32 (21 generated)
Devlin
Heya folks, another one for you. This technically follow https://codereview.chromium.org/2583273002/, but most of the content ...
3 years, 12 months ago (2016-12-23 00:39:05 UTC) #3
jbroman
I'll have a closer look after the holidays, but a couple initial (superficial) thoughts: https://codereview.chromium.org/2598123002/diff/40001/extensions/renderer/api_binding.cc ...
3 years, 12 months ago (2016-12-23 22:37:06 UTC) #4
Devlin
https://codereview.chromium.org/2598123002/diff/40001/extensions/renderer/api_binding.cc File extensions/renderer/api_binding.cc (right): https://codereview.chromium.org/2598123002/diff/40001/extensions/renderer/api_binding.cc#newcode200 extensions/renderer/api_binding.cc:200: arguments->ThrowTypeError("Invalid invocation"); On 2016/12/23 22:37:06, jbroman wrote: > Isn't ...
3 years, 11 months ago (2016-12-28 19:02:39 UTC) #10
jbroman
lgtm with some nits Hopefully some of this complexity can go away in the future. ...
3 years, 11 months ago (2017-01-02 19:46:38 UTC) #11
Devlin
lazyboy@, wanna take a look? https://codereview.chromium.org/2598123002/diff/140001/extensions/renderer/api_binding.cc File extensions/renderer/api_binding.cc (right): https://codereview.chromium.org/2598123002/diff/140001/extensions/renderer/api_binding.cc#newcode197 extensions/renderer/api_binding.cc:197: if (try_catch.HasCaught()) { On ...
3 years, 11 months ago (2017-01-04 17:57:02 UTC) #12
lazyboy
lgtm w/ one q. https://codereview.chromium.org/2598123002/diff/160001/extensions/renderer/api_binding_hooks.cc File extensions/renderer/api_binding_hooks.cc (right): https://codereview.chromium.org/2598123002/diff/160001/extensions/renderer/api_binding_hooks.cc#newcode245 extensions/renderer/api_binding_hooks.cc:245: run_js_.Run(handle_request, context, parsed_v8_args.size(), run_js_ RunJSFunctionSync ...
3 years, 11 months ago (2017-01-05 20:10:35 UTC) #17
Devlin
https://codereview.chromium.org/2598123002/diff/160001/extensions/renderer/api_binding_hooks.cc File extensions/renderer/api_binding_hooks.cc (right): https://codereview.chromium.org/2598123002/diff/160001/extensions/renderer/api_binding_hooks.cc#newcode245 extensions/renderer/api_binding_hooks.cc:245: run_js_.Run(handle_request, context, parsed_v8_args.size(), On 2017/01/05 20:10:35, lazyboy wrote: > ...
3 years, 11 months ago (2017-01-05 21:03:51 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2598123002/160001
3 years, 11 months ago (2017-01-05 21:31:46 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/297742) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, ...
3 years, 11 months ago (2017-01-05 21:44:08 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2598123002/180001
3 years, 11 months ago (2017-01-05 22:46:14 UTC) #29
commit-bot: I haz the power
3 years, 11 months ago (2017-01-06 02:13:03 UTC) #32
Message was sent while issue was closed.
Committed patchset #9 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/f4c89ab6c9e2d821172cd1cded61...

Powered by Google App Engine
This is Rietveld 408576698