Skip to content

Commit 15df4ed

Browse files
committed
src: use args.This() instead of Holder
The latter is deprecated in V8. Refs: http://crbug.com/333672197 PR-URL: #53474 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 977beab commit 15df4ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+356
-382
lines changed

doc/api/addons.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ void MyObject::New(const FunctionCallbackInfo<Value>& args) {
923923
void MyObject::PlusOne(const FunctionCallbackInfo<Value>& args) {
924924
Isolate* isolate = args.GetIsolate();
925925

926-
MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.Holder());
926+
MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This());
927927
obj->value_ += 1;
928928

929929
args.GetReturnValue().Set(Number::New(isolate, obj->value_));
@@ -1138,7 +1138,7 @@ void MyObject::NewInstance(const FunctionCallbackInfo<Value>& args) {
11381138
void MyObject::PlusOne(const FunctionCallbackInfo<Value>& args) {
11391139
Isolate* isolate = args.GetIsolate();
11401140

1141-
MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.Holder());
1141+
MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This());
11421142
obj->value_ += 1;
11431143

11441144
args.GetReturnValue().Set(Number::New(isolate, obj->value_));

src/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ Node.js source code.)
418418

419419
`args[n]` is a `Local<Value>` that represents the n-th argument passed to the
420420
function. `args.This()` is the `this` value inside this function call.
421-
`args.Holder()` is equivalent to `args.This()` in all use cases inside of
422-
Node.js.
423421

424422
`args.GetReturnValue()` is a placeholder for the return value of the function,
425423
and provides a `.Set()` method that can be called with a boolean, integer,
@@ -829,7 +827,7 @@ The JavaScript object can be accessed as a `v8::Local<v8::Object>` by using
829827
`self->object()`, given a `BaseObject` named `self`.
830828

831829
Accessing a `BaseObject` from a `v8::Local<v8::Object>` (frequently that is
832-
`args.This()` or `args.Holder()` in a [binding function][]) can be done using
830+
`args.This()` in a [binding function][]) can be done using
833831
the `Unwrap<T>(obj)` function, where `T` is a subclass of `BaseObject`.
834832
A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the
835833
current function if unwrapping fails (typically that means that the `BaseObject`
@@ -838,7 +836,7 @@ has been deleted earlier).
838836
```cpp
839837
void Http2Session::Request(const FunctionCallbackInfo<Value>& args) {
840838
Http2Session* session;
841-
ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
839+
ASSIGN_OR_RETURN_UNWRAP(&session, args.This());
842840
Environment* env = session->env();
843841
Local<Context> context = env->context();
844842
Isolate* isolate = env->isolate();

src/async_wrap.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
254254
void AsyncWrap::GetAsyncId(const FunctionCallbackInfo<Value>& args) {
255255
AsyncWrap* wrap;
256256
args.GetReturnValue().Set(kInvalidAsyncId);
257-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
257+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
258258
args.GetReturnValue().Set(wrap->get_async_id());
259259
}
260260

@@ -296,7 +296,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) {
296296
CHECK(args[0]->IsObject());
297297

298298
AsyncWrap* wrap;
299-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
299+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
300300

301301
Local<Object> resource = args[0].As<Object>();
302302
double execution_async_id =
@@ -308,7 +308,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) {
308308
void AsyncWrap::GetProviderType(const FunctionCallbackInfo<Value>& args) {
309309
AsyncWrap* wrap;
310310
args.GetReturnValue().Set(AsyncWrap::PROVIDER_NONE);
311-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
311+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
312312
args.GetReturnValue().Set(wrap->provider_type());
313313
}
314314

src/cares_wrap.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ template <class Wrap>
14041404
static void Query(const FunctionCallbackInfo<Value>& args) {
14051405
Environment* env = Environment::GetCurrent(args);
14061406
ChannelWrap* channel;
1407-
ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder());
1407+
ASSIGN_OR_RETURN_UNWRAP(&channel, args.This());
14081408

14091409
CHECK_EQ(false, args.IsConstructCall());
14101410
CHECK(args[0]->IsObject());
@@ -1664,7 +1664,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
16641664
void GetServers(const FunctionCallbackInfo<Value>& args) {
16651665
Environment* env = Environment::GetCurrent(args);
16661666
ChannelWrap* channel;
1667-
ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder());
1667+
ASSIGN_OR_RETURN_UNWRAP(&channel, args.This());
16681668

16691669
Local<Array> server_array = Array::New(env->isolate());
16701670

@@ -1702,7 +1702,7 @@ void GetServers(const FunctionCallbackInfo<Value>& args) {
17021702
void SetServers(const FunctionCallbackInfo<Value>& args) {
17031703
Environment* env = Environment::GetCurrent(args);
17041704
ChannelWrap* channel;
1705-
ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder());
1705+
ASSIGN_OR_RETURN_UNWRAP(&channel, args.This());
17061706

17071707
if (channel->active_query_count()) {
17081708
return args.GetReturnValue().Set(DNS_ESETSRVPENDING);
@@ -1783,7 +1783,7 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
17831783
void SetLocalAddress(const FunctionCallbackInfo<Value>& args) {
17841784
Environment* env = Environment::GetCurrent(args);
17851785
ChannelWrap* channel;
1786-
ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder());
1786+
ASSIGN_OR_RETURN_UNWRAP(&channel, args.This());
17871787

17881788
CHECK_EQ(args.Length(), 2);
17891789
CHECK(args[0]->IsString());
@@ -1846,7 +1846,7 @@ void SetLocalAddress(const FunctionCallbackInfo<Value>& args) {
18461846

18471847
void Cancel(const FunctionCallbackInfo<Value>& args) {
18481848
ChannelWrap* channel;
1849-
ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder());
1849+
ASSIGN_OR_RETURN_UNWRAP(&channel, args.This());
18501850

18511851
TRACE_EVENT_INSTANT0(TRACING_CATEGORY_NODE2(dns, native),
18521852
"cancel", TRACE_EVENT_SCOPE_THREAD);

src/crypto/crypto_cipher.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void CipherBase::Init(const char* cipher_type,
438438

439439
void CipherBase::Init(const FunctionCallbackInfo<Value>& args) {
440440
CipherBase* cipher;
441-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
441+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
442442
Environment* env = Environment::GetCurrent(args);
443443

444444
CHECK_GE(args.Length(), 3);
@@ -510,7 +510,7 @@ void CipherBase::InitIv(const char* cipher_type,
510510

511511
void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) {
512512
CipherBase* cipher;
513-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
513+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
514514
Environment* env = cipher->env();
515515

516516
CHECK_GE(args.Length(), 4);
@@ -645,7 +645,7 @@ bool CipherBase::IsAuthenticatedMode() const {
645645
void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) {
646646
Environment* env = Environment::GetCurrent(args);
647647
CipherBase* cipher;
648-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
648+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
649649

650650
// Only callable after Final and if encrypting.
651651
if (cipher->ctx_ ||
@@ -661,7 +661,7 @@ void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) {
661661

662662
void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) {
663663
CipherBase* cipher;
664-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
664+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
665665
Environment* env = Environment::GetCurrent(args);
666666

667667
if (!cipher->ctx_ ||
@@ -774,7 +774,7 @@ bool CipherBase::SetAAD(
774774

775775
void CipherBase::SetAAD(const FunctionCallbackInfo<Value>& args) {
776776
CipherBase* cipher;
777-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
777+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
778778
Environment* env = Environment::GetCurrent(args);
779779

780780
CHECK_EQ(args.Length(), 2);
@@ -887,7 +887,7 @@ bool CipherBase::SetAutoPadding(bool auto_padding) {
887887

888888
void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
889889
CipherBase* cipher;
890-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
890+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
891891

892892
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue());
893893
args.GetReturnValue().Set(b); // Possibly report invalid state failure
@@ -962,7 +962,7 @@ void CipherBase::Final(const FunctionCallbackInfo<Value>& args) {
962962
Environment* env = Environment::GetCurrent(args);
963963

964964
CipherBase* cipher;
965-
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
965+
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This());
966966
if (cipher->ctx_ == nullptr)
967967
return THROW_ERR_CRYPTO_INVALID_STATE(env);
968968

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy