Index: Source/bindings/templates/dictionary_v8.cpp |
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp |
index 084666b692998a55a5ea7e8cd85947ac8dae48ee..54ae4ec7df558053aa63a1935fbead65b6ddc934 100644 |
--- a/Source/bindings/templates/dictionary_v8.cpp |
+++ b/Source/bindings/templates/dictionary_v8.cpp |
@@ -15,23 +15,23 @@ namespace blink { |
{% macro convert_and_set_member(member) %} |
{% endmacro %} |
-void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{cpp_class}}& impl, ExceptionState& exceptionState) |
+bool {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{cpp_class}}& impl, ExceptionState& exceptionState) |
{ |
if (isUndefinedOrNull(v8Value)) |
- return; |
+ return true; |
if (!v8Value->IsObject()) { |
{% if use_permissive_dictionary_conversion %} |
// Do nothing. |
+ return true; |
{% else %} |
exceptionState.throwTypeError("cannot convert to dictionary."); |
+ return false; |
{% endif %} |
- return; |
} |
{% if parent_v8_class %} |
- {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState); |
- if (exceptionState.hadException()) |
- return; |
+ if (!{{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState)) |
+ return false; |
{% endif %} |
{# Declare local variables only when the dictionary has members to avoid unused variable warnings. #} |
@@ -43,7 +43,7 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ |
v8::Local<v8::Value> {{member.name}}Value = v8Object->Get(v8String(isolate, "{{member.name}}")); |
if (block.HasCaught()) { |
exceptionState.rethrowV8Exception(block.Exception()); |
- return; |
+ return false; |
} |
if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) { |
// Do nothing. |
@@ -55,32 +55,30 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ |
{% if member.deprecate_as %} |
UseCounter::countDeprecationIfNotPrivateScript(isolate, callingExecutionContext(isolate), UseCounter::{{member.deprecate_as}}); |
{% endif %} |
- {% if member.use_output_parameter_for_result %} |
- {{member.cpp_type}} {{member.name}}; |
- {% endif %} |
{{member.v8_value_to_local_cpp_value}}; |
{% if member.is_interface_type %} |
if (!{{member.name}} && !{{member.name}}Value->IsNull()) { |
exceptionState.throwTypeError("member {{member.name}} is not of type {{member.idl_type}}."); |
- return; |
+ return false; |
} |
{% endif %} |
{% if member.enum_validation_expression %} |
String string = {{member.name}}; |
if (!({{member.enum_validation_expression}})) { |
exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
- return; |
+ return false; |
} |
{% elif member.is_object %} |
if (!{{member.name}}.isObject()) { |
exceptionState.throwTypeError("member {{member.name}} is not an object."); |
- return; |
+ return false; |
} |
{% endif %} |
impl.{{member.setter_name}}({{member.name}}); |
} |
{% endfor %} |
+ return true; |
} |
v8::Local<v8::Value> toV8(const {{cpp_class}}& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |