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