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

Issue 2826673004: bindings: Make the sequence conversion code more compliant with WebIDL. (Closed)

Created:
3 years, 8 months ago by Raphael Kubo da Costa (rakuco)
Modified:
3 years, 7 months ago
Reviewers:
haraken, Nico, bashi, Yuki
CC:
chromium-reviews, blink-reviews-w3ctests_chromium.org, shans, rjwright, tzik, blink-reviews-animation_chromium.org, nhiroki, tommyw+watchlist_chromium.org, blink-reviews-bindings_chromium.org, darktears, blink-reviews, kinuko+fileapi, Eric Willigers
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

bindings: Make the sequence conversion code more compliant with WebIDL. The existing bindings still referenced WebIDL array types that were removed from the spec in 2015, and converting JS types to IDL sequences with an algorithm that expected either a JS array (in which case it just iterated over each element) or an object that adhered to an outdated protocol where a "length" property was expected. The current WebIDL sequence conversion steps are simpler and described in https://heycam.github.io/webidl/#es-sequence. In short, JS objects are converted to sequences via @@iterator and the regular iteration protocol of calling next() and checking the returned object. This works with arrays as well as any object that implements a valid Symbol.iterator property. It opens the way for custom iterators, the lack of which was causing some layout tests to fail. In other words, any iterable JS object can now be converted into a sequence<>. The downside is that the Blink-V8 communication required for calling @@iterator, invoking next() and checking objects on every iteration step is costlier than what we had before, so the "fast case" has been preserved for JS arrays (even though it is not 100% clear if this is a valid shortcut to take, it at least does not introduce any regression compared to the previous code). This is part 1: several functions in V8Binding.h that implement the old conversion algorithm (e.g. ToMemberNativeArray(), ToImplArray(), ToV8Sequence() and ToImplSequence()) have not been removed yet, and their callers in the code base have not yet been changed. This will come at a later point in the future. BUG=690428 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org Review-Url: https://codereview.chromium.org/2826673004 Cr-Commit-Position: refs/heads/master@{#465649} Committed: https://chromium.googlesource.com/chromium/src/+/941cc09b668fbbe90f3e8fd65e8773e1d38bd66f

Patch Set 1 #

Patch Set 2 : Fix more test expectations #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+918 lines, -257 lines) Patch
A third_party/WebKit/LayoutTests/bindings/sequence-type.html View 1 chunk +207 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/crypto/subtle/aes-cbc/generateKey-failures-expected.txt View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/crypto/subtle/unwrapKey-badParameters-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 chunk +4 lines, -6 lines 0 comments Download
D third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-record-expected.txt View 1 chunk +0 lines, -14 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-expected.txt View 2 chunks +2 lines, -9 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html View 1 chunk +18 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/idl-union-type-unittest-expected.txt View 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor.html View 2 chunks +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt View 2 chunks +13 lines, -13 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/message-event-max-ports.html View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/message-event-max-ports-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/blob-constructor.html View 2 chunks +34 lines, -27 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/blob-constructor-expected.txt View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/file-constructor.html View 2 chunks +14 lines, -7 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/file-constructor-expected.txt View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamConstructor-expected.txt View 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-expected.txt View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/linux/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 chunk +4 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/win/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 chunk +4 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/storage/websql/execute-sql-args.js View 3 chunks +15 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/storage/websql/execute-sql-args-expected.txt View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/files/blob-constructor-expected.txt View 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/webaudio/dom-exceptions-expected.txt View 1 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt View 2 chunks +3 lines, -3 lines 0 comments Download
A third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-custom-iterator.html View 1 chunk +30 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h View 1 chunk +110 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp View 1 chunk +178 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptValue.h View 1 chunk +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8Binding.h View 3 chunks +8 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp View 1 chunk +17 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_methods.py View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_types.py View 4 chunks +7 lines, -42 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl View 1 chunk +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/ByteStringSequenceSequenceOrByteStringByteStringRecord.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/DoubleOrLongOrBooleanSequence.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/StringOrStringSequence.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/StringSequenceCallbackFunctionLongSequenceArg.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp View 8 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 22 chunks +22 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 4 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/core_idl_files.gni View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.h View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.cpp View 2 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.idl View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/core/testing/SequenceTest.h View 1 chunk +49 lines, -0 lines 1 comment Download
A third_party/WebKit/Source/core/testing/SequenceTest.cpp View 1 chunk +54 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/testing/SequenceTest.idl View 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (9 generated)
Raphael Kubo da Costa (rakuco)
PTAL. This was also spun off https://codereview.chromium.org/2810843002/. I'm following the suggestion bashi@ made there and ...
3 years, 8 months ago (2017-04-18 16:56:19 UTC) #1
Yuki
LGTM.
3 years, 8 months ago (2017-04-19 12:31:25 UTC) #2
haraken
LGTM
3 years, 8 months ago (2017-04-19 15:11:31 UTC) #5
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/2826673004/20001
3 years, 8 months ago (2017-04-19 17:13:15 UTC) #10
commit-bot: I haz the power
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/chromium/src/+/941cc09b668fbbe90f3e8fd65e8773e1d38bd66f
3 years, 8 months ago (2017-04-19 17:21:21 UTC) #13
bashi
lgtm (sorry for late response; I'm OOO every Wed in JST)
3 years, 8 months ago (2017-04-19 23:14:37 UTC) #14
Nico
minor style nit: https://codereview.chromium.org/2826673004/diff/20001/third_party/WebKit/Source/core/testing/SequenceTest.h File third_party/WebKit/Source/core/testing/SequenceTest.h (right): https://codereview.chromium.org/2826673004/diff/20001/third_party/WebKit/Source/core/testing/SequenceTest.h#newcode44 third_party/WebKit/Source/core/testing/SequenceTest.h:44: HeapVector<Member<Element>> m_elementSequence; blink now uses style ...
3 years, 7 months ago (2017-05-08 20:24:46 UTC) #16
Raphael Kubo da Costa (rakuco)
3 years, 7 months ago (2017-05-09 14:48:48 UTC) #17
Message was sent while issue was closed.
On 2017/05/08 20:24:46, Nico wrote:
> minor style nit:
> 
>
https://codereview.chromium.org/2826673004/diff/20001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/testing/SequenceTest.h (right):
> 
>
https://codereview.chromium.org/2826673004/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/testing/SequenceTest.h:44:
> HeapVector<Member<Element>> m_elementSequence;
> blink now uses style that's a lot closer to chromium style. Namely, capitalize
> member functions, and call member variables like_this_ instead of m_likeThis.
> (The method capitalization isn't done for IDL-exposed functions which at least
> some of the methods in here are, but the member variable at least is wrong.)

Thanks, I've sent https://codereview.chromium.org/2871933002 to fix the style
there.

Powered by Google App Engine
This is Rietveld 408576698