Skip to content

Commit 624cab0

Browse files
committed
src: use args.This() instead of Holder
The latter is deprecated in V8 Refs: http://crbug.com/333672197
1 parent 672e4cc commit 624cab0

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

+335
-337
lines changed

doc/api/addons.md

+2-2
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

+2-4
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
248248
void AsyncWrap::GetAsyncId(const FunctionCallbackInfo<Value>& args) {
249249
AsyncWrap* wrap;
250250
args.GetReturnValue().Set(kInvalidAsyncId);
251-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
251+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
252252
args.GetReturnValue().Set(wrap->get_async_id());
253253
}
254254

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

292292
AsyncWrap* wrap;
293-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
293+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
294294

295295
Local<Object> resource = args[0].As<Object>();
296296
double execution_async_id =
@@ -302,7 +302,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) {
302302
void AsyncWrap::GetProviderType(const FunctionCallbackInfo<Value>& args) {
303303
AsyncWrap* wrap;
304304
args.GetReturnValue().Set(AsyncWrap::PROVIDER_NONE);
305-
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
305+
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This());
306306
args.GetReturnValue().Set(wrap->provider_type());
307307
}
308308

src/cares_wrap.cc

+5-5
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

+7-7
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_ ||
@@ -773,7 +773,7 @@ bool CipherBase::SetAAD(
773773

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

779779
CHECK_EQ(args.Length(), 2);
@@ -886,7 +886,7 @@ bool CipherBase::SetAutoPadding(bool auto_padding) {
886886

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

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

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

0 commit comments

Comments
 (0)