@@ -1231,7 +1231,9 @@ class QueryAnyWrap: public QueryWrap {
1231
1231
CHECK_EQ (naddrttls, a_count);
1232
1232
for (int i = 0 ; i < a_count; i++) {
1233
1233
Local<Object> obj = Object::New (env ()->isolate ());
1234
- obj->Set (context, env ()->address_string (), ret->Get (i)).FromJust ();
1234
+ obj->Set (context,
1235
+ env ()->address_string (),
1236
+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
1235
1237
obj->Set (context,
1236
1238
env ()->ttl_string (),
1237
1239
Integer::New (env ()->isolate (), addrttls[i].ttl )).FromJust ();
@@ -1243,7 +1245,9 @@ class QueryAnyWrap: public QueryWrap {
1243
1245
} else {
1244
1246
for (int i = 0 ; i < a_count; i++) {
1245
1247
Local<Object> obj = Object::New (env ()->isolate ());
1246
- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1248
+ obj->Set (context,
1249
+ env ()->value_string (),
1250
+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
1247
1251
obj->Set (context,
1248
1252
env ()->type_string (),
1249
1253
env ()->dns_cname_string ()).FromJust ();
@@ -1272,7 +1276,9 @@ class QueryAnyWrap: public QueryWrap {
1272
1276
CHECK_EQ (aaaa_count, naddr6ttls);
1273
1277
for (uint32_t i = a_count; i < ret->Length (); i++) {
1274
1278
Local<Object> obj = Object::New (env ()->isolate ());
1275
- obj->Set (context, env ()->address_string (), ret->Get (i)).FromJust ();
1279
+ obj->Set (context,
1280
+ env ()->address_string (),
1281
+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
1276
1282
obj->Set (context,
1277
1283
env ()->ttl_string (),
1278
1284
Integer::New (env ()->isolate (), addr6ttls[i].ttl )).FromJust ();
@@ -1299,7 +1305,9 @@ class QueryAnyWrap: public QueryWrap {
1299
1305
}
1300
1306
for (uint32_t i = old_count; i < ret->Length (); i++) {
1301
1307
Local<Object> obj = Object::New (env ()->isolate ());
1302
- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1308
+ obj->Set (context,
1309
+ env ()->value_string (),
1310
+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
1303
1311
obj->Set (context,
1304
1312
env ()->type_string (),
1305
1313
env ()->dns_ns_string ()).FromJust ();
@@ -1325,7 +1333,9 @@ class QueryAnyWrap: public QueryWrap {
1325
1333
status = ParseGeneralReply (env (), buf, len, &type, ret);
1326
1334
for (uint32_t i = old_count; i < ret->Length (); i++) {
1327
1335
Local<Object> obj = Object::New (env ()->isolate ());
1328
- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1336
+ obj->Set (context,
1337
+ env ()->value_string (),
1338
+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
1329
1339
obj->Set (context,
1330
1340
env ()->type_string (),
1331
1341
env ()->dns_ptr_string ()).FromJust ();
@@ -1945,10 +1955,14 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
1945
1955
Local<Object> req_wrap_obj = args[0 ].As <Object>();
1946
1956
node::Utf8Value hostname (env->isolate (), args[1 ]);
1947
1957
1948
- int32_t flags = (args[3 ]->IsInt32 ()) ? args[3 ]->Int32Value () : 0 ;
1958
+ int32_t flags = 0 ;
1959
+ if (args[3 ]->IsInt32 ()) {
1960
+ flags = args[3 ]->Int32Value (env->context ()).FromJust ();
1961
+ }
1962
+
1949
1963
int family;
1950
1964
1951
- switch (args[2 ]->Int32Value ()) {
1965
+ switch (args[2 ]->Int32Value (env-> context ()). FromJust ( )) {
1952
1966
case 0 :
1953
1967
family = AF_UNSPEC;
1954
1968
break ;
@@ -1992,7 +2006,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
1992
2006
CHECK (args[2 ]->IsUint32 ());
1993
2007
Local<Object> req_wrap_obj = args[0 ].As <Object>();
1994
2008
node::Utf8Value ip (env->isolate (), args[1 ]);
1995
- const unsigned port = args[2 ]->Uint32Value ();
2009
+ const unsigned port = args[2 ]->Uint32Value (env-> context ()). FromJust ( );
1996
2010
struct sockaddr_storage addr;
1997
2011
1998
2012
CHECK (uv_ip4_addr (*ip, port, reinterpret_cast <sockaddr_in*>(&addr)) == 0 ||
@@ -2069,17 +2083,23 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
2069
2083
int err;
2070
2084
2071
2085
for (uint32_t i = 0 ; i < len; i++) {
2072
- CHECK (arr->Get (i )->IsArray ());
2086
+ CHECK (arr->Get (env-> context (), i). ToLocalChecked ( )->IsArray ());
2073
2087
2074
- Local<Array> elm = Local<Array>::Cast (arr->Get (i));
2088
+ Local<Array> elm =
2089
+ Local<Array>::Cast (arr->Get (env->context (), i).ToLocalChecked ());
2075
2090
2076
- CHECK (elm->Get (0 )->Int32Value ());
2077
- CHECK (elm->Get (1 )->IsString ());
2078
- CHECK (elm->Get (2 )->Int32Value ());
2091
+ CHECK (elm->Get (env->context (),
2092
+ 0 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
2093
+ CHECK (elm->Get (env->context (), 1 ).ToLocalChecked ()->IsString ());
2094
+ CHECK (elm->Get (env->context (),
2095
+ 2 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
2079
2096
2080
- int fam = elm->Get (0 )->Int32Value ();
2081
- node::Utf8Value ip (env->isolate (), elm->Get (1 ));
2082
- int port = elm->Get (2 )->Int32Value ();
2097
+ int fam = elm->Get (env->context (), 0 )
2098
+ .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
2099
+ node::Utf8Value ip (env->isolate (),
2100
+ elm->Get (env->context (), 1 ).ToLocalChecked ());
2101
+ int port = elm->Get (env->context (), 2 )
2102
+ .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
2083
2103
2084
2104
ares_addr_port_node* cur = &servers[i];
2085
2105
@@ -2129,7 +2149,8 @@ void Cancel(const FunctionCallbackInfo<Value>& args) {
2129
2149
2130
2150
void StrError (const FunctionCallbackInfo<Value>& args) {
2131
2151
Environment* env = Environment::GetCurrent (args);
2132
- const char * errmsg = ares_strerror (args[0 ]->Int32Value ());
2152
+ const char * errmsg = ares_strerror (args[0 ]->Int32Value (env->context ())
2153
+ .FromJust ());
2133
2154
args.GetReturnValue ().Set (OneByteString (env->isolate (), errmsg));
2134
2155
}
2135
2156
0 commit comments