Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: Source/bindings/templates/dictionary_v8.cpp

Issue 768793002: Revert of IDL: Null values should be converted for non-nullable dictionary members (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/templates/dictionary_impl.h ('k') | Source/bindings/tests/results/core/TestDictionary.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/dictionary_v8.cpp
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp
index b134a423f9686c5a358b3b0b6d349508da22d917..94a48cdf5a905696c430ecc76932f09beb4d8a7a 100644
--- a/Source/bindings/templates/dictionary_v8.cpp
+++ b/Source/bindings/templates/dictionary_v8.cpp
@@ -13,8 +13,6 @@
namespace blink {
-{% macro convert_and_set_member(member) %}
-{% endmacro %}
void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {{cpp_class}}& impl, ExceptionState& exceptionState)
{
if (isUndefinedOrNull(v8Value))
@@ -34,34 +32,27 @@
v8::TryCatch block;
{% for member in members %}
v8::Local<v8::Value> {{member.name}}Value = v8Object->Get(v8String(isolate, "{{member.name}}"));
- if (block.HasCaught()) {
- exceptionState.rethrowV8Exception(block.Exception());
- return;
- }
- if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) {
- // Do nothing.
- {% if member.is_nullable %}
- } else if ({{member.name}}Value->IsNull()) {
- impl.{{member.null_setter_name}}();
+ if (!{{member.name}}Value.IsEmpty() && !isUndefinedOrNull({{member.name}}Value)) {
+ {% if member.use_output_parameter_for_result %}
+ {{member.cpp_type}} {{member.name}};
{% endif %}
- } else {
- {% if member.use_output_parameter_for_result %}
- {{member.cpp_type}} {{member.name}};
- {% endif %}
{{member.v8_value_to_local_cpp_value}};
- {% if member.enum_validation_expression %}
+ {% 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;
}
- {% elif member.is_object %}
+ {% elif member.is_object %}
if (!{{member.name}}.isObject()) {
exceptionState.throwTypeError("member {{member.name}} is not an object.");
return;
}
- {% endif %}
+ {% endif %}
impl.{{member.setter_name}}({{member.name}});
+ } else if (block.HasCaught()) {
+ exceptionState.rethrowV8Exception(block.Exception());
+ return;
}
{% endfor %}
« no previous file with comments | « Source/bindings/templates/dictionary_impl.h ('k') | Source/bindings/tests/results/core/TestDictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698