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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp

Issue 2607433002: bindings: Throw a TypeError when a given callback function isn't callable (Closed)
Patch Set: Created 4 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
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp
index 586d88f82957021d39f8436a86a432d50ae7e2ab..37e7fc4c4beb11b2e614231a4af3758f7cde2b7f 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp
@@ -153,7 +153,7 @@ static void voidMethodCallbackFunctionInArgMethod(const v8::FunctionCallbackInfo
}
VoidCallbackFunction* voidCallbackFunctionArg;
- if (!info[0]->IsFunction()) {
+ if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
@@ -176,7 +176,7 @@ static void voidMethodCallbackFunctionInArg2Method(const v8::FunctionCallbackInf
}
AnyCallbackFunctionOptionalAnyArg* anyCallbackFunctionOptionalAnyArgArg;
- if (!info[0]->IsFunction()) {
+ if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionInArg2", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
@@ -199,7 +199,7 @@ static void voidMethodCallbackFunctionWithReturnValueInArgMethod(const v8::Funct
}
LongCallbackFunction* longCallbackFunctionArg;
- if (!info[0]->IsFunction()) {
+ if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodCallbackFunctionWithReturnValueInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
@@ -227,7 +227,7 @@ static void voidMethodOptionalCallbackFunctionInArgMethod(const v8::FunctionCall
impl->voidMethodOptionalCallbackFunctionInArg();
return;
}
- if (!info[0]->IsFunction()) {
+ if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodOptionalCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;
@@ -250,7 +250,7 @@ static void voidMethodNullableCallbackFunctionInArgMethod(const v8::FunctionCall
}
VoidCallbackFunction* voidCallbackFunctionArg;
- if (!info[0]->IsFunction() && !info[0]->IsNull()) {
+ if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
return;

Powered by Google App Engine
This is Rietveld 408576698