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

Review URL: https://codereview.chromium.org/38063003

git-svn-id: svn://svn.chromium.org/blink/trunk@160593 bbb929c8-8fbe-4397-9dbb-9b2b20218538
22 files changed
tree: ebedff9d3fa1259e21198965fc3832cbe87c8264
  1. third_party/