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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp

Issue 1946453002: Make nullable members of IDL dictionaries contain null in JS when unset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_getComputedTiming
Patch Set: Fix test Created 4 years, 7 months 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 unified diff | Download patch
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable %}
2 {% include 'copyright_block.txt' %} 2 {% include 'copyright_block.txt' %}
3 #include "{{v8_original_class}}.h" 3 #include "{{v8_original_class}}.h"
4 4
5 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 5 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
6 #include "{{filename}}" 6 #include "{{filename}}"
7 {% endfor %} 7 {% endfor %}
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (impl.{{member.has_method_name}}()) { 110 if (impl.{{member.has_method_name}}()) {
111 {% if member.is_object %} 111 {% if member.is_object %}
112 ASSERT(impl.{{member.cpp_name}}().isObject()); 112 ASSERT(impl.{{member.cpp_name}}().isObject());
113 {% endif %} 113 {% endif %}
114 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}})) ) 114 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}})) )
115 return false; 115 return false;
116 {% if member.v8_default_value %} 116 {% if member.v8_default_value %}
117 } else { 117 } else {
118 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}}))) 118 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}})))
119 return false; 119 return false;
120 {% elif member.is_nullable %}
121 } else {
122 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon text(), v8String(isolate, "{{member.name}}"), v8::Null(isolate))))
123 return false;
120 {% elif member.is_required %} 124 {% elif member.is_required %}
121 } else { 125 } else {
122 ASSERT_NOT_REACHED(); 126 ASSERT_NOT_REACHED();
123 {% endif %} 127 {% endif %}
124 } 128 }
125 129
126 {% endfor %} 130 {% endfor %}
127 return true; 131 return true;
128 } 132 }
129 133
130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) 134 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState)
131 { 135 {
132 {{cpp_class}} impl; 136 {{cpp_class}} impl;
133 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); 137 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
134 return impl; 138 return impl;
135 } 139 }
136 140
137 } // namespace blink 141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698