Skip to content

Commit 4d1c92a

Browse files
committed
src: migrate from deprecated xxxV2 APIs
- Set/GetPrototype - Holder Signed-Off-By: Michaël Zasso <targos@protonmail.com>
1 parent 04f088f commit 4d1c92a

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
@@ -652,7 +652,7 @@ void DynamicLibrary::GetFunctions(const FunctionCallbackInfo<Value>& args) {
652652
}
653653

654654
Local<Object> functions = Object::New(isolate);
655-
if (!functions->SetPrototypeV2(context, Null(isolate)).FromMaybe(false)) {
655+
if (!functions->SetPrototype(context, Null(isolate)).FromMaybe(false)) {
656656
return;
657657
}
658658

@@ -801,7 +801,7 @@ void DynamicLibrary::GetSymbols(const FunctionCallbackInfo<Value>& args) {
801801
}
802802

803803
Local<Object> symbols = Object::New(isolate);
804-
if (!symbols->SetPrototypeV2(context, Null(isolate)).FromMaybe(false)) {
804+
if (!symbols->SetPrototype(context, Null(isolate)).FromMaybe(false)) {
805805
return;
806806
}
807807
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
@@ -748,7 +748,7 @@ Intercepted DatabaseSyncLimits::LimitsGetter(
748748
}
749749

750750
DatabaseSyncLimits* limits;
751-
ASSIGN_OR_RETURN_UNWRAP(&limits, info.HolderV2(), Intercepted::kNo);
751+
ASSIGN_OR_RETURN_UNWRAP(&limits, info.Holder(), Intercepted::kNo);
752752

753753
Environment* env = limits->env();
754754
Isolate* isolate = env->isolate();
@@ -780,7 +780,7 @@ Intercepted DatabaseSyncLimits::LimitsSetter(
780780
}
781781

782782
DatabaseSyncLimits* limits;
783-
ASSIGN_OR_RETURN_UNWRAP(&limits, info.HolderV2(), Intercepted::kNo);
783+
ASSIGN_OR_RETURN_UNWRAP(&limits, info.Holder(), Intercepted::kNo);
784784

785785
Environment* env = limits->env();
786786
Isolate* isolate = env->isolate();
@@ -2945,9 +2945,9 @@ BaseObjectPtr<StatementSyncIterator> StatementExecutionHelper::Iterate(
29452945
}
29462946

29472947
if (iter->object()
2948-
->GetPrototypeV2()
2948+
->GetPrototype()
29492949
.As<Object>()
2950-
->SetPrototypeV2(context, js_iterator_prototype)
2950+
->SetPrototype(context, js_iterator_prototype)
29512951
.IsNothing()) {
29522952
return BaseObjectPtr<StatementSyncIterator>();
29532953
}

0 commit comments

Comments
 (0)