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

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

Issue 767313003: IDL dictionary: Throw a TypeError when an interface member conversion fails (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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/scripts/v8_dictionary.py ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('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 652ebc83bd4cd550581c38dd69b1ac1da9d7124f..c2e6ef1b96f7e498460f080a608721fb1d1aa5be 100644
--- a/Source/bindings/templates/dictionary_v8.cpp
+++ b/Source/bindings/templates/dictionary_v8.cpp
@@ -52,6 +52,12 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {
{{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;
+ }
+ {% endif %}
{% if member.enum_validation_expression %}
String string = {{member.name}};
if (!({{member.enum_validation_expression}})) {
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698