Index: Source/bindings/v8/V8Binding.h |
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h |
index d00ee43e8b3c5cb55fd7930df88ecd1f23e4280c..da51dd8fd028d2dfcd764278f77c97cb94d23395 100644 |
--- a/Source/bindings/v8/V8Binding.h |
+++ b/Source/bindings/v8/V8Binding.h |
@@ -75,7 +75,7 @@ namespace WebCore { |
v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator(); |
- v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::Isolate*); |
+ v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, bool* notASequence, v8::Isolate*); |
inline v8::Handle<v8::Value> argumentOrNull(const v8::FunctionCallbackInfo<v8::Value>& args, int index) |
{ |
@@ -450,7 +450,7 @@ namespace WebCore { |
uint32_t length = 0; |
if (value->IsArray()) |
length = v8::Local<v8::Array>::Cast(v8Value)->Length(); |
- else if (toV8Sequence(value, length, isolate).IsEmpty()) |
+ else if (toV8Sequence(value, length, 0, isolate).IsEmpty()) |
return Vector<RefPtr<T> >(); |
Vector<RefPtr<T> > result; |
@@ -481,7 +481,7 @@ namespace WebCore { |
uint32_t length = 0; |
if (value->IsArray()) |
length = v8::Local<v8::Array>::Cast(v8Value)->Length(); |
- else if (toV8Sequence(value, length, isolate).IsEmpty()) |
+ else if (toV8Sequence(value, length, 0, isolate).IsEmpty()) |
return Vector<T>(); |
Vector<T> result; |
@@ -510,7 +510,7 @@ namespace WebCore { |
// Validates that the passed object is a sequence type per WebIDL spec |
// http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-sequence |
- inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint32_t& length, v8::Isolate* isolate) |
+ inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint32_t& length, bool* notASequence, v8::Isolate* isolate) |
{ |
// Attempt converting to a sequence if the value is not already an array but is |
// any kind of object except for a native Date object or a native RegExp object. |
@@ -518,7 +518,11 @@ namespace WebCore { |
// FIXME: Do we really need to special case Date and RegExp object? |
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=22806 |
if (!value->IsObject() || value->IsDate() || value->IsRegExp()) { |
- throwTypeError(isolate); |
+ // Signal that the caller must handle the type error. |
+ if (notASequence) |
+ *notASequence = true; |
+ else |
+ throwTypeError(isolate); |
return v8Undefined(); |
} |
@@ -531,7 +535,11 @@ namespace WebCore { |
V8TRYCATCH(v8::Local<v8::Value>, lengthValue, object->Get(v8::String::NewSymbol("length"))); |
if (lengthValue->IsUndefined() || lengthValue->IsNull()) { |
- throwTypeError(isolate); |
+ // Signal that the caller must handle the type error. |
+ if (notASequence) |
+ *notASequence = true; |
+ else |
+ throwTypeError(isolate); |
return v8Undefined(); |
} |