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

Issue 2947223003: [Extensions Bindings] Consider argument type more in signature parsing (Closed)

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

Description

[Extensions Bindings] Consider argument type more in signature parsing Right now, when parsing arguments, we look at whether or not an argument matches the expected argument, and, if it does not and the argument is optional, we advance to the next argument. This results in strange error messages when in certain circumstances. For instance, consider a signature: optional object<prop: string>, optional function If we pass {prop: 2} to this signature, we'd first compare against the object parameter, find it doesn't match, and then advance to comparing against the function argument. This resulted in an error message focusing on the function argument, rather than the object argument. To address this, check the types of the arguments first. If the type matches the expected type, assume that the argument is meant to match. This way, when we see the first argument is an object, we parse it against the object parameter and give appropriate errors. This can potentially cause issues when there is an ambiguous signature based on argument types (e.g., optional object, optional object, and provided a single argument - which object to match against?), but these ambiguous signatures are already disallowed unless the API implements custom handling. BUG=653596 Review-Url: https://codereview.chromium.org/2947223003 Cr-Commit-Position: refs/heads/master@{#482118} Committed: https://chromium.googlesource.com/chromium/src/+/d701d8e63d28192afbdbe9d0d65569a4b994fd51

Patch Set 1 #

Patch Set 2 : . #

Total comments: 3

Patch Set 3 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -90 lines) Patch
M chrome/test/data/extensions/api_test/window_open/argument_overflow/test.js View 1 chunk +6 lines, -2 lines 0 comments Download
M extensions/renderer/bindings/api_signature.cc View 1 2 2 chunks +7 lines, -2 lines 0 comments Download
M extensions/renderer/bindings/api_signature_unittest.cc View 1 2 2 chunks +30 lines, -0 lines 0 comments Download
M extensions/renderer/bindings/argument_spec.h View 1 2 2 chunks +6 lines, -3 lines 0 comments Download
M extensions/renderer/bindings/argument_spec.cc View 1 2 5 chunks +107 lines, -80 lines 0 comments Download
M extensions/renderer/bindings/argument_spec_unittest.cc View 1 2 2 chunks +6 lines, -3 lines 0 comments Download

Messages

Total messages: 21 (15 generated)
Devlin
Hey folks, mind taking a look? Sorry for the long CL description... it's a bit ...
3 years, 6 months ago (2017-06-21 23:07:39 UTC) #5
jbroman
lgtm from a JS side of things; I don't know enough about extension APIs to ...
3 years, 6 months ago (2017-06-22 15:55:28 UTC) #8
Devlin
https://codereview.chromium.org/2947223003/diff/20001/extensions/renderer/argument_spec.cc File extensions/renderer/argument_spec.cc (right): https://codereview.chromium.org/2947223003/diff/20001/extensions/renderer/argument_spec.cc#newcode317 extensions/renderer/argument_spec.cc:317: *error = api_errors::InvalidChoice(); On 2017/06/22 15:55:27, jbroman wrote: > ...
3 years, 6 months ago (2017-06-22 16:05:17 UTC) #9
lazyboy
lgtm
3 years, 6 months ago (2017-06-23 23:07:05 UTC) #10
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/2947223003/40001
3 years, 6 months ago (2017-06-24 02:06:15 UTC) #18
commit-bot: I haz the power
3 years, 6 months ago (2017-06-24 02:11:23 UTC) #21
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/d701d8e63d28192afbdbe9d0d655...

Powered by Google App Engine
This is Rietveld 408576698