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

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

Issue 2802223002: bindings: Throw a type error if converting an interface or callback function fails. (Closed)
Patch Set: Add |callback_function_name| to the callback function template Created 3 years, 8 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.tmpl' import v8_value_to_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
2 {% filter format_blink_cpp_source_code %} 2 {% filter format_blink_cpp_source_code %}
3 3
4 {% include 'copyright_block.txt' %} 4 {% include 'copyright_block.txt' %}
5 5
6 #include "{{cpp_class}}.h" 6 #include "{{cpp_class}}.h"
7 7
8 {% for filename in cpp_includes %} 8 {% for filename in cpp_includes %}
9 #include "{{filename}}" 9 #include "{{filename}}"
10 {% endfor %} 10 {% endfor %}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 {% if return_value %} 76 {% if return_value %}
77 {{v8_value_to_local_cpp_value(return_value) | indent(2)}} 77 {{v8_value_to_local_cpp_value(return_value) | indent(2)}}
78 returnValue = cppValue; 78 returnValue = cppValue;
79 {% endif %} 79 {% endif %}
80 return true; 80 return true;
81 } 81 }
82 82
83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) { 83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
84 return {{cpp_class}}::create(ScriptState::current(isolate), value); 84 {{cpp_class}}* nativeValue = {{cpp_class}}::create(ScriptState::current(isolat e), value);
85 if (!nativeValue)
86 exceptionState.throwTypeError("Unable to convert value to {{callback_functio n_name}}.");
87 return nativeValue;
85 } 88 }
86 89
87 } // namespace blink 90 } // namespace blink
88 91
89 {% endfilter %}{# format_blink_cpp_source_code #} 92 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698