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

Issue 2802223002: bindings: Throw a type error if converting an interface or callback function fails. (Closed)

Created:
3 years, 8 months ago by Raphael Kubo da Costa (rakuco)
Modified:
3 years, 8 months ago
Reviewers:
haraken, bashi, Yuki
CC:
chromium-reviews, blink-reviews, iclelland+watch_chromuim.org, blink-reviews-bindings_chromium.org, chasej+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

bindings: Throw a type error if converting an interface or callback function fails. The previous implementation of nativeValue() for IDL interfaces and callback functions simply called implTypeWithCheck() (or create() for callback functions) and returned its value. This meant it was not possible for callers to easily distinguish a nullptr returned here (meaning the conversion failed) from nullptr being returned by a nativeValue() call for another type (which can just be a nullptr). BUG=690428 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org Review-Url: https://codereview.chromium.org/2802223002 Cr-Commit-Position: refs/heads/master@{#462890} Committed: https://chromium.googlesource.com/chromium/src/+/125a3532433159edc1041c7f031d733df0c7682d

Patch Set 1 #

Total comments: 2

Patch Set 2 : Use {{interface_name}} for interfaces #

Patch Set 3 : Add |callback_function_name| to the callback function template #

Unified diffs Side-by-side diffs Delta from patch set Stats (+210 lines, -45 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp View 2 chunks +25 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_callback_function.py View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl View 1 2 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/AnyCallbackFunctionOptionalAnyArg.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/LongCallbackFunction.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/StringSequenceCallbackFunctionLongSequenceArg.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8DataView.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexed.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedPrimaryGlobal.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInitConstructor.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/VoidCallbackFunction.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/VoidCallbackFunctionInterfaceArg.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/VoidCallbackFunctionTypedef.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp View 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 25 (16 generated)
Raphael Kubo da Costa (rakuco)
PTAL. This is part of the long road to solving bug 690428.
3 years, 8 months ago (2017-04-07 13:25:40 UTC) #1
Yuki
LGTM. https://codereview.chromium.org/2802223002/diff/1/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl File third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl (right): https://codereview.chromium.org/2802223002/diff/1/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl#newcode86 third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl:86: exceptionState.throwTypeError("Unable to convert value to {{cpp_class}}."); nit: Can ...
3 years, 8 months ago (2017-04-07 13:37:21 UTC) #6
Raphael Kubo da Costa (rakuco)
On 2017/04/07 13:37:21, Yuki wrote: > LGTM. > > https://codereview.chromium.org/2802223002/diff/1/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl > File third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl > (right): ...
3 years, 8 months ago (2017-04-07 13:52:30 UTC) #7
haraken
LGTM
3 years, 8 months ago (2017-04-07 13:55:33 UTC) #8
Yuki
On 2017/04/07 13:52:30, Raphael Kubo da Costa (rakuco) wrote: > On 2017/04/07 13:37:21, Yuki wrote: ...
3 years, 8 months ago (2017-04-07 14:14:14 UTC) #13
Raphael Kubo da Costa (rakuco)
On 2017/04/07 14:14:14, Yuki wrote: > On 2017/04/07 13:52:30, Raphael Kubo da Costa (rakuco) wrote: ...
3 years, 8 months ago (2017-04-07 14:48:45 UTC) #14
Yuki
LGTM.
3 years, 8 months ago (2017-04-07 15:00:19 UTC) #17
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/2802223002/40001
3 years, 8 months ago (2017-04-07 16:27:05 UTC) #22
commit-bot: I haz the power
3 years, 8 months ago (2017-04-07 16:37:54 UTC) #25
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/125a3532433159edc1041c7f031d...

Powered by Google App Engine
This is Rietveld 408576698