Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index b0d80ed49a7d9a2da309aaa969e736a4ead97a83..21da1bfc136295fb51d4117c6fb0492d1b2bd037 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -24979,3 +24979,20 @@ TEST(Proxy) { |
CHECK(proxy->GetTarget()->SameValue(target)); |
CHECK(proxy->GetHandler()->IsNull()); |
} |
+ |
+void EmptyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {} |
+ |
+TEST(CallOnNonConstructableFunction) { |
+ LocalContext context; |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ |
+ v8::Local<v8::FunctionTemplate> tmpl = |
+ v8::FunctionTemplate::New(isolate, EmptyFunction); |
+ tmpl->RemovePrototype(); |
+ v8::Local<v8::Function> fun = |
+ tmpl->GetFunction(context.local()).ToLocalChecked(); |
+ CHECK( |
+ !fun->CallAsFunction(context.local(), v8::Undefined(isolate), 0, nullptr) |
+ .IsEmpty()); |
+} |