Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index cb6658082206e529c84f701a0835ca63122ad3fc..6be72a67759b5c7622c84feebab6b1b232067eeb 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4497,22 +4497,23 @@ Local<v8::Value> Object::CallAsConstructor(int argc, |
RETURN_TO_LOCAL_UNCHECKED(CallAsConstructor(context, argc, argv_cast), Value); |
} |
- |
MaybeLocal<Function> Function::New(Local<Context> context, |
FunctionCallback callback, Local<Value> data, |
- int length) { |
+ int length, bool remove_prototype) { |
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); |
LOG_API(isolate, Function, New); |
ENTER_V8(isolate); |
- return FunctionTemplateNew(isolate, callback, nullptr, data, |
- Local<Signature>(), length, true) |
- ->GetFunction(context); |
+ auto templ = FunctionTemplateNew(isolate, callback, nullptr, data, |
+ Local<Signature>(), length, true); |
+ if (remove_prototype) templ->RemovePrototype(); |
+ return templ->GetFunction(context); |
} |
Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback, |
Local<Value> data, int length) { |
- return Function::New(v8_isolate->GetCurrentContext(), callback, data, length) |
+ return Function::New(v8_isolate->GetCurrentContext(), callback, data, length, |
+ false) |
.FromMaybe(Local<Function>()); |
} |