|
Improve TypeError messages from failed array conversions.
Should the conversion of a value into a native array fail due to it
not having a sequence type, throw the expected TypeError but with a
message that better explains what failed.
Address this by extending the two v8 bindings helpers
WebCore::toNativeArray() and WebCore::toRefPtrNativeArray() with an
extra argument to indicate either the property name that's being
converted to an array, or its argument index position (1-indexed.)
(Or 0, if it is a setter with an array/sequence type.) In the case of
toRefPtrNativeArray(), either a property name or an argument index
might supplied; toNativeArray() only needs to support the argument
indexed form.
The code generator has been extended to supply the extra argument when
calling upon these two array conversion helpers.
So, if the array conversion fails due to the value not being array (or
array-like), the TypeError's message is now generated by a pair of
ExceptionMessages helper methods:
static String notASequenceTypeArgumentOrValue(int argumentIndexOrValue);
static String notASequenceTypeProperty(const String& propertyName);
which handles the argument/setter value and property case,
respectively. The output will be of the form
{X} is not an array, nor does it have indexed properties.
where X is one of
"'{ThePropertyName}' property"
"Value"
"Argument {First,Second,Third,<N>th}"
R=
BUG= 308730
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=160593
Total comments: 11
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+215 lines, -93 lines) |
Patch |
|
M |
LayoutTests/crypto/generateKey-expected.txt
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
LayoutTests/fast/canvas/canvas-lineDash-input-sequence-expected.txt
|
View
|
|
1 chunk |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
LayoutTests/fast/events/constructors/message-event-constructor-expected.txt
|
View
|
|
1 chunk |
+11 lines, -11 lines |
0 comments
|
Download
|
|
A |
LayoutTests/fast/events/init-message-event.html
|
View
|
|
1 chunk |
+24 lines, -0 lines |
0 comments
|
Download
|
|
A |
LayoutTests/fast/events/init-message-event-expected.txt
|
View
|
|
1 chunk |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
Source/bindings/scripts/code_generator_v8.pm
|
View
|
1
|
9 chunks |
+16 lines, -9 lines |
0 comments
|
Download
|
|
M |
Source/bindings/scripts/unstable/v8_types.py
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/bindings/tests/results/V8TestObject.cpp
|
View
|
|
9 chunks |
+9 lines, -9 lines |
0 comments
|
Download
|
|
M |
Source/bindings/tests/results/V8TestObjectPython.cpp
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
Source/bindings/tests/results/V8TestTypedefs.cpp
|
View
|
|
5 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/Dictionary.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
Source/bindings/v8/ExceptionMessages.h
|
View
|
1
|
1 chunk |
+5 lines, -1 line |
0 comments
|
Download
|
|
M |
Source/bindings/v8/ExceptionMessages.cpp
|
View
|
1
2
|
1 chunk |
+27 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/V8Binding.h
|
View
|
1
|
7 chunks |
+53 lines, -25 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/V8Utilities.h
|
View
|
1
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
Source/bindings/v8/V8Utilities.cpp
|
View
|
1
|
3 chunks |
+20 lines, -4 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp
|
View
|
1
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/custom/V8MessageEventCustom.cpp
|
View
|
1
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/custom/V8MessagePortCustom.cpp
|
View
|
1
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
Source/bindings/v8/custom/V8WindowCustom.cpp
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
Source/bindings/v8/custom/V8WorkerCustom.cpp
|
View
|
1
|
1 chunk |
+3 lines, -2 lines |
0 comments
|
Download
|
Total messages: 8 (0 generated)
|