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

Unified Diff: third_party/WebKit/Source/bindings/templates/callback_function.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/callback_function.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl
index 412a9df6e81537ad6a75346ed36922528b74761e..abce755796d649ce8129f394306776281fc271a9 100644
--- a/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/callback_function.cpp.tmpl
@@ -11,6 +11,13 @@
namespace blink {
+// static
+{{cpp_class}}* {{cpp_class}}::create(ScriptState* scriptState, v8::Local<v8::Value> callback){
+ if (isUndefinedOrNull(callback))
+ return nullptr;
+ return new {{cpp_class}}(scriptState, v8::Local<v8::Function>::Cast(callback));
+}
+
{{cpp_class}}::{{cpp_class}}(ScriptState* scriptState, v8::Local<v8::Function> callback)
: m_scriptState(scriptState),
m_callback(scriptState->isolate(), this, callback) {

Powered by Google App Engine
This is Rietveld 408576698