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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2617653002: bindings: Don't throw a TypeError when 'null' is passed to nullable callback function (Closed)
Patch Set: Created 3 years, 11 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: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
index a4fb97619af188d899c3abdbb07e50c4dd40c0f0..d7009da8926ef9d291c860745512eed8fa1bc1c6 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
@@ -177,7 +177,7 @@ if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
{% endif %}{# argument.is_optional #}
{% endif %}{# argument.idl_type == 'EventListener' #}
{% elif argument.is_callback_function %}
-if (!info[{{argument.index}}]->IsObject() || !v8::Local<v8::Object>::Cast(info[{{argument.index}}])->IsCallable()) {
+if ({% if argument.is_nullable %}!isUndefinedOrNull(info[{{argument.index}}]) && {% endif %}!(info[{{argument.index}}]->IsObject() && v8::Local<v8::Object>::Cast(info[{{argument.index}}])->IsCallable())) {
peria 2017/01/05 04:39:18 who tests this new {% if %} branch in run-binding-
bashi 2017/01/05 04:41:31 TestCallbackFunctions.voidMethodNullableCallbackFu
{{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not a function.")}}
return;
}

Powered by Google App Engine
This is Rietveld 408576698