Browse Source

v8: drop v8::FunctionCallbackInfo<T>::NewTarget()

Remove the new method that was introduced in the back-port of
v8/v8@306c412c ("[api] Expose FunctionCallbackInfo::NewTarget")
so that the meat of the patch can land in a patch release.

This commit can be reverted again in the next minor release.

Fixes: https://github.com/nodejs/node/issues/9288
PR-URL: https://github.com/nodejs/node/pull/9293
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
v6.x
Ben Noordhuis 8 years ago
committed by Myles Borins
parent
commit
2e15d48447
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 7
      deps/v8/include/v8.h
  2. 37
      deps/v8/test/cctest/test-api.cc

7
deps/v8/include/v8.h

@ -3177,7 +3177,6 @@ class FunctionCallbackInfo {
Local<Function> Callee() const);
V8_INLINE Local<Object> This() const;
V8_INLINE Local<Object> Holder() const;
V8_INLINE Local<Value> NewTarget() const;
V8_INLINE bool IsConstructCall() const;
V8_INLINE Local<Value> Data() const;
V8_INLINE Isolate* GetIsolate() const;
@ -7904,12 +7903,6 @@ Local<Object> FunctionCallbackInfo<T>::Holder() const {
&implicit_args_[kHolderIndex]));
}
template<typename T>
Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
return Local<Value>(
reinterpret_cast<Value*>(&implicit_args_[kNewTargetIndex]));
}
template<typename T>
Local<Value> FunctionCallbackInfo<T>::Data() const {
return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));

37
deps/v8/test/cctest/test-api.cc

@ -13350,43 +13350,6 @@ THREADED_TEST(IsConstructCall) {
CHECK(value->BooleanValue(context.local()).FromJust());
}
static void NewTargetHandler(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
args.GetReturnValue().Set(args.NewTarget());
}
THREADED_TEST(NewTargetHandler) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
// Function template with call handler.
Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
templ->SetCallHandler(NewTargetHandler);
LocalContext context;
Local<Function> function =
templ->GetFunction(context.local()).ToLocalChecked();
CHECK(context->Global()
->Set(context.local(), v8_str("f"), function)
.FromJust());
Local<Value> value = CompileRun("f()");
CHECK(value->IsUndefined());
value = CompileRun("new f()");
CHECK(value->IsFunction());
CHECK(value == function);
Local<Value> subclass = CompileRun("var g = class extends f { }; g");
CHECK(subclass->IsFunction());
value = CompileRun("new g()");
CHECK(value->IsFunction());
CHECK(value == subclass);
value = CompileRun("Reflect.construct(f, [], Array)");
CHECK(value->IsFunction());
CHECK(value ==
context->Global()
->Get(context.local(), v8_str("Array"))
.ToLocalChecked());
}
THREADED_TEST(ObjectProtoToString) {
v8::Isolate* isolate = CcTest::isolate();

Loading…
Cancel
Save