|
bindings: Make the sequence conversion code more complaint 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 change is implemented by moving all the conversion code to
NativeValueTraits like we already do for WebIDL record types, and making the
Python WebIDL compiler code use it instead. This allows us to get rid of:
- 2 ToMemberNativeArray() overloads
- 2 ToImplArray() overloads
- ToV8Sequence()
- ToImplSequence()
- 5 deprecated NativeValueTraits specializations
in addition to simplifying the Python code in v8_types.py by making it less
smart.
BUG= 690428
R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org
Total comments: 10
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+1010 lines, -841 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
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/crypto/subtle/unwrapKey-badParameters-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/csspaint/parse-input-arguments-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/csspaint/registerPaint-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/external/wpt/FileAPI/blob/Blob-constructor-expected.txt
|
View
|
1
|
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
2
|
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/external/wpt/webmessaging/with-ports/027.html
|
View
|
1
2
3
|
1 chunk |
+12 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html
|
View
|
1
|
1 chunk |
+18 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/dom/Window/window-postmessage-args.html
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt
|
View
|
1
|
2 chunks |
+7 lines, -8 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/dom/idl-union-type-unittest-expected.txt
|
View
|
1
|
1 chunk |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor.html
|
View
|
1
|
2 chunks |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt
|
View
|
1
|
2 chunks |
+13 lines, -13 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/init-message-event.html
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/init-message-event-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/message-event-max-ports.html
|
View
|
1
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/message-event-max-ports-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/message-port-multi-expected.txt
|
View
|
1
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/events/resources/message-port-multi.js
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/files/blob-constructor.html
|
View
|
1
|
2 chunks |
+34 lines, -27 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/files/blob-constructor-expected.txt
|
View
|
1
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/files/file-constructor.html
|
View
|
1
|
2 chunks |
+14 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/files/file-constructor-expected.txt
|
View
|
1
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamConstructor-expected.txt
|
View
|
1
|
1 chunk |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-expected.txt
|
View
|
1
|
2 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/workers/worker-context-multi-port-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/workers/worker-multi-port-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/workers/worker-onerror-09.html
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/fast/workers/worker-onerror-09-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
D |
third_party/WebKit/LayoutTests/platform/linux/external/wpt/FileAPI/blob/Blob-constructor-expected.txt
|
View
|
1
2
|
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
|
1 chunk |
+4 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/storage/websql/execute-sql-args.js
|
View
|
1
|
3 chunks |
+15 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/storage/websql/execute-sql-args-expected.txt
|
View
|
1
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/files/blob-constructor-expected.txt
|
View
|
1
2
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/worker-onerror-09-expected.txt
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/webaudio/dom-exceptions-expected.txt
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-custom-iterator.html
|
View
|
1
2
3
|
1 chunk |
+30 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/bindings.gni
|
View
|
1
2
3
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp
|
View
|
|
2 chunks |
+5 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/ExceptionMessages.h
|
View
|
1
|
1 chunk |
+0 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/ExceptionMessages.cpp
|
View
|
1
|
1 chunk |
+0 lines, -10 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h
|
View
|
1
2
3
|
1 chunk |
+110 lines, -6 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp
|
View
|
1
2
3
|
1 chunk |
+178 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp
|
View
|
|
3 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp
|
View
|
|
2 chunks |
+4 lines, -2 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/SerializedScriptValue.cpp
|
View
|
|
3 chunks |
+8 lines, -17 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/V8Binding.h
|
View
|
1
|
5 chunks |
+8 lines, -338 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
View
|
1
|
1 chunk |
+17 lines, -0 lines |
0 comments
|
Download
|
|
D |
third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
|
View
|
1
2
3
|
1 chunk |
+0 lines, -167 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp
|
View
|
|
2 chunks |
+4 lines, -3 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
|
1
|
4 chunks |
+7 lines, -42 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl
|
View
|
1
|
1 chunk |
+1 line, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/ByteStringSequenceSequenceOrByteStringByteStringRecord.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/DoubleOrLongOrBooleanSequence.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/StringOrStringSequence.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/StringSequenceCallbackFunctionLongSequenceArg.cpp
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp
|
View
|
1
|
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
2
3
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
|
View
|
1
2
3
|
22 chunks |
+22 lines, -22 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp
|
View
|
1
2
3
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/BUILD.gn
|
View
|
1
2
3
|
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/frame/DOMTimerTest.cpp
|
View
|
1
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/testing/Internals.h
|
View
|
1
2
3
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/testing/Internals.cpp
|
View
|
1
2
3
|
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 |
0 comments
|
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
|
|
M |
third_party/WebKit/Source/modules/cachestorage/Cache.cpp
|
View
|
|
3 chunks |
+7 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
|
View
|
1
2
3
|
3 chunks |
+10 lines, -10 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
|
View
|
|
3 chunks |
+8 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
|
View
|
1
|
1 chunk |
+7 lines, -3 lines |
0 comments
|
Download
|
Total messages: 14 (2 generated)
|