Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 48d0c156e7fb76b3e03ffda22c0bb7ac27c3f52d..6f9f6979a8c982fe0b13ff88971bd36fd0bbeb47 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -7085,6 +7085,9 @@ THREADED_TEST(Regress892105) { |
.FromJust()); |
} |
+static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ args.GetReturnValue().Set(args.This()); |
+} |
THREADED_TEST(UndetectableObject) { |
LocalContext env; |
@@ -7093,6 +7096,7 @@ THREADED_TEST(UndetectableObject) { |
Local<v8::FunctionTemplate> desc = |
v8::FunctionTemplate::New(env->GetIsolate()); |
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable |
Local<v8::Object> obj = desc->GetFunction(env.local()) |
.ToLocalChecked() |
@@ -7141,6 +7145,7 @@ THREADED_TEST(VoidLiteral) { |
Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate); |
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable |
Local<v8::Object> obj = desc->GetFunction(env.local()) |
.ToLocalChecked() |
@@ -7191,6 +7196,7 @@ THREADED_TEST(ExtensibleOnUndetectable) { |
Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate); |
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable |
Local<v8::Object> obj = desc->GetFunction(env.local()) |
.ToLocalChecked() |
@@ -11775,11 +11781,6 @@ static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) { |
} |
-static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) { |
- args.GetReturnValue().Set(args.This()); |
-} |
- |
- |
// Test that a call handler can be set for objects which will allow |
// non-function objects created through the API to be called as |
// functions. |