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

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

Issue 1631333003: bindings: Throw exceptions when required dictionary members aren't passed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
11 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} 11 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %}
12 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ cpp_class}}& impl, ExceptionState& exceptionState) 12 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ cpp_class}}& impl, ExceptionState& exceptionState)
13 { 13 {
14 if (isUndefinedOrNull(v8Value)) 14 if (isUndefinedOrNull(v8Value)) {
15 {% if required_member_names %}
16 exceptionState.throwTypeError("Missing required member(s): {{required_me mber_names|join(', ')}}.");
17 {% endif %}
15 return; 18 return;
19 }
16 if (!v8Value->IsObject()) { 20 if (!v8Value->IsObject()) {
17 {% if use_permissive_dictionary_conversion %} 21 {% if use_permissive_dictionary_conversion %}
18 // Do nothing. 22 // Do nothing.
19 return; 23 return;
20 {% else %} 24 {% else %}
21 exceptionState.throwTypeError("cannot convert to dictionary."); 25 exceptionState.throwTypeError("cannot convert to dictionary.");
22 return; 26 return;
23 {% endif %} 27 {% endif %}
24 } 28 }
25 29
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 128 }
125 129
126 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) 130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState)
127 { 131 {
128 {{cpp_class}} impl; 132 {{cpp_class}} impl;
129 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); 133 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
130 return impl; 134 return impl;
131 } 135 }
132 136
133 } // namespace blink 137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698