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

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

Issue 1057453002: bindings: Throw TypeError when required dictionary member is undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/templates/dictionary_v8.cpp
diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp
index c6b6d1343a7b3922a93e49f78d18884ee6347a01..dfd660285bb1e0c2e9d7c8ca2d7dff054badc1a2 100644
--- a/Source/bindings/templates/dictionary_v8.cpp
+++ b/Source/bindings/templates/dictionary_v8.cpp
@@ -46,7 +46,12 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{
return;
}
if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) {
+ {% if member.is_required %}
+ exceptionState.throwTypeError("required member {{member.name}} is undefined.");
+ return;
+ {% else %}
// Do nothing.
+ {% endif %}
{% if member.is_nullable %}
} else if ({{member.name}}Value->IsNull()) {
impl.{{member.null_setter_name}}();

Powered by Google App Engine
This is Rietveld 408576698