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

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

Issue 568703002: IDL: Values for dictionaries should be a object, null or undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove assertion and added a guard Created 6 years, 3 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/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index 5f7f0bb8d783867550a371075da1ce216a8dc010..5051f7283e13f8e5150d0c8e74a7df2149c747a9 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -197,10 +197,17 @@ if (!({{argument.enum_validation_expression}})) {
(argument.index + 1)) | indent}}
return;
}
-{% elif argument.idl_type in ['Dictionary', 'Promise'] %}
+{% elif argument.is_dictionary or argument.idl_type == 'Dictionary' %}
Jens Widell 2014/09/12 09:13:53 It would make sense to have this check before we c
bashi 2014/09/12 10:00:49 Done, and now I can change if -> ASSERT() in toImp
{# Dictionaries must have type Undefined, Null or Object:
http://heycam.github.io/webidl/#es-dictionary
-We also require this for our implementation of promises, though not in spec:
+FIXME: Remove generic 'Dictionary' special-casing. #}
+if (!isUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->IsObject()) {
+ {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' %
+ (argument.index + 1, argument.name)) | indent}}
+ return;
+}
+{% elif argument.idl_type == 'Promise' %}
+{# We also require this for our implementation of promises, though not in spec:
http://heycam.github.io/webidl/#es-promise #}
if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) {
{{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' %
« no previous file with comments | « Source/bindings/templates/dictionary_v8.cpp ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698