Skip to content

Commit e4a3072

Browse files
targosnodejs-github-bot
authored andcommitted
src: migrate from deprecated xxxV2 APIs
- Set/GetPrototype - Holder Signed-Off-By: Michaël Zasso <targos@protonmail.com>
1 parent a0afdde commit e4a3072

13 files changed

Lines changed: 29 additions & 31 deletions

src/api/environment.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context,
943943

944944
Local<Object> private_symbols_object;
945945
if (!private_symbols->NewInstance(context).ToLocal(&private_symbols_object) ||
946-
private_symbols_object->SetPrototypeV2(context, Null(isolate))
946+
private_symbols_object->SetPrototype(context, Null(isolate))
947947
.IsNothing()) {
948948
return MaybeLocal<Object>();
949949
}
@@ -969,7 +969,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context,
969969
Local<Object> per_isolate_symbols_object;
970970
if (!per_isolate_symbols->NewInstance(context).ToLocal(
971971
&per_isolate_symbols_object) ||
972-
per_isolate_symbols_object->SetPrototypeV2(context, Null(isolate))
972+
per_isolate_symbols_object->SetPrototype(context, Null(isolate))
973973
.IsNothing()) {
974974
return MaybeLocal<Object>();
975975
}

src/internal_only_v8.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class PrototypeChainHas : public v8::QueryObjectPredicate {
3333
if (creation_context != context_) {
3434
return false;
3535
}
36-
for (Local<Value> proto = object->GetPrototypeV2(); proto->IsObject();
37-
proto = proto.As<Object>()->GetPrototypeV2()) {
36+
for (Local<Value> proto = object->GetPrototype(); proto->IsObject();
37+
proto = proto.As<Object>()->GetPrototype()) {
3838
if (search_ == proto) return true;
3939
}
4040
return false;

src/js_native_api_v8.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ napi_status NAPI_CDECL node_api_set_prototype(napi_env env,
15851585

15861586
v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value);
15871587

1588-
v8::Maybe<bool> set_maybe = obj->SetPrototypeV2(context, val);
1588+
v8::Maybe<bool> set_maybe = obj->SetPrototype(context, val);
15891589

15901590
RETURN_STATUS_IF_FALSE_WITH_PREAMBLE(
15911591
env, set_maybe.FromMaybe(false), napi_generic_failure);
@@ -1604,7 +1604,7 @@ napi_status NAPI_CDECL napi_get_prototype(napi_env env,
16041604
CHECK_TO_OBJECT(env, context, obj, object);
16051605

16061606
// This doesn't invokes Proxy's [[GetPrototypeOf]] handler.
1607-
v8::Local<v8::Value> val = obj->GetPrototypeV2();
1607+
v8::Local<v8::Value> val = obj->GetPrototype();
16081608
*result = v8impl::JsValueFromV8LocalValue(val);
16091609
return GET_RETURN_STATUS(env);
16101610
}

src/module_wrap.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ void ModuleWrap::HasAsyncGraph(Local<Name> property,
10321032
Isolate* isolate = args.GetIsolate();
10331033
Environment* env = Environment::GetCurrent(isolate);
10341034
ModuleWrap* obj;
1035-
ASSIGN_OR_RETURN_UNWRAP(&obj, args.HolderV2());
1035+
ASSIGN_OR_RETURN_UNWRAP(&obj, args.Holder());
10361036

10371037
Local<Module> module = obj->module_.Get(isolate);
10381038
if (module->GetStatus() < Module::kInstantiated) {
@@ -1248,7 +1248,7 @@ void ModuleWrap::SetImportMetaResolveInitializer(
12481248
static void ImportMetaResolveLazyGetter(
12491249
Local<v8::Name> name, const PropertyCallbackInfo<Value>& info) {
12501250
Isolate* isolate = info.GetIsolate();
1251-
Local<Value> receiver_val = info.HolderV2();
1251+
Local<Value> receiver_val = info.Holder();
12521252
if (!receiver_val->IsObject()) {
12531253
THROW_ERR_INVALID_INVOCATION(isolate);
12541254
return;
@@ -1289,7 +1289,7 @@ static void PathHelpersLazyGetter(Local<v8::Name> name,
12891289
// When this getter is invoked in a vm context, the `Realm::GetCurrent(info)`
12901290
// returns a nullptr and retrieve the creation context via `this` object and
12911291
// get the creation Realm.
1292-
Local<Value> receiver_val = info.HolderV2();
1292+
Local<Value> receiver_val = info.Holder();
12931293
if (!receiver_val->IsObject()) {
12941294
THROW_ERR_INVALID_INVOCATION(isolate);
12951295
return;

src/node_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ MaybeLocal<Uint8Array> New(Environment* env,
279279
size_t length) {
280280
CHECK(!env->buffer_prototype_object().IsEmpty());
281281
Local<Uint8Array> ui = Uint8Array::New(ab, byte_offset, length);
282-
if (ui->SetPrototypeV2(env->context(), env->buffer_prototype_object())
282+
if (ui->SetPrototype(env->context(), env->buffer_prototype_object())
283283
.IsNothing()) {
284284
return MaybeLocal<Uint8Array>();
285285
}

src/node_constants.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ void CreatePerContextProperties(Local<Object> target,
12841284
Isolate* isolate = Isolate::GetCurrent();
12851285
Environment* env = Environment::GetCurrent(context);
12861286

1287-
CHECK(target->SetPrototypeV2(env->context(), Null(isolate)).FromJust());
1287+
CHECK(target->SetPrototype(env->context(), Null(isolate)).FromJust());
12881288

12891289
Local<Object> os_constants =
12901290
Object::New(isolate, Null(isolate), nullptr, nullptr, 0);

src/node_contextify.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ ContextifyContext* ContextifyContext::Get(const PropertyCallbackInfo<T>& args) {
454454
// args.GetIsolate()->GetCurrentContext() and take the pointer at
455455
// ContextEmbedderIndex::kContextifyContext, as V8 is supposed to
456456
// push the creation context before invoking these callbacks.
457-
return Get(args.HolderV2());
457+
return Get(args.Holder());
458458
}
459459

460460
ContextifyContext* ContextifyContext::Get(Local<Object> object) {

src/node_ffi.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void DynamicLibrary::GetFunctions(const FunctionCallbackInfo<Value>& args) {
675675
}
676676

677677
Local<Object> functions = Object::New(isolate);
678-
if (!functions->SetPrototypeV2(context, Null(isolate)).FromMaybe(false)) {
678+
if (!functions->SetPrototype(context, Null(isolate)).FromMaybe(false)) {
679679
return;
680680
}
681681

@@ -824,7 +824,7 @@ void DynamicLibrary::GetSymbols(const FunctionCallbackInfo<Value>& args) {
824824
}
825825

826826
Local<Object> symbols = Object::New(isolate);
827-
if (!symbols->SetPrototypeV2(context, Null(isolate)).FromMaybe(false)) {
827+
if (!symbols->SetPrototype(context, Null(isolate)).FromMaybe(false)) {
828828
return;
829829
}
830830
for (const auto& entry : lib->symbols_) {

src/node_options.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,8 +1829,7 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) {
18291829

18301830
Local<Map> options = Map::New(isolate);
18311831
if (options
1832-
->SetPrototypeV2(context,
1833-
env->primordials_safe_map_prototype_object())
1832+
->SetPrototype(context, env->primordials_safe_map_prototype_object())
18341833
.IsNothing()) {
18351834
return;
18361835
}
@@ -1870,8 +1869,7 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) {
18701869
if (!ToV8Value(context, _ppop_instance.aliases_).ToLocal(&aliases)) return;
18711870

18721871
if (aliases.As<Object>()
1873-
->SetPrototypeV2(context,
1874-
env->primordials_safe_map_prototype_object())
1872+
->SetPrototype(context, env->primordials_safe_map_prototype_object())
18751873
.IsNothing()) {
18761874
return;
18771875
}

src/node_sqlite.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ Intercepted DatabaseSyncLimits::LimitsGetter(
758758
}
759759

760760
DatabaseSyncLimits* limits;
761-
ASSIGN_OR_RETURN_UNWRAP(&limits, info.HolderV2(), Intercepted::kNo);
761+
ASSIGN_OR_RETURN_UNWRAP(&limits, info.Holder(), Intercepted::kNo);
762762

763763
Environment* env = limits->env();
764764
Isolate* isolate = env->isolate();
@@ -790,7 +790,7 @@ Intercepted DatabaseSyncLimits::LimitsSetter(
790790
}
791791

792792
DatabaseSyncLimits* limits;
793-
ASSIGN_OR_RETURN_UNWRAP(&limits, info.HolderV2(), Intercepted::kNo);
793+
ASSIGN_OR_RETURN_UNWRAP(&limits, info.Holder(), Intercepted::kNo);
794794

795795
Environment* env = limits->env();
796796
Isolate* isolate = env->isolate();
@@ -2955,9 +2955,9 @@ BaseObjectPtr<StatementSyncIterator> StatementExecutionHelper::Iterate(
29552955
}
29562956

29572957
if (iter->object()
2958-
->GetPrototypeV2()
2958+
->GetPrototype()
29592959
.As<Object>()
2960-
->SetPrototypeV2(context, js_iterator_prototype)
2960+
->SetPrototype(context, js_iterator_prototype)
29612961
.IsNothing()) {
29622962
return BaseObjectPtr<StatementSyncIterator>();
29632963
}

0 commit comments

Comments
 (0)