@@ -1227,7 +1227,9 @@ class QueryAnyWrap: public QueryWrap {
12271227 CHECK_EQ (naddrttls, a_count);
12281228 for (int i = 0 ; i < a_count; i++) {
12291229 Local<Object> obj = Object::New (env ()->isolate ());
1230- obj->Set (context, env ()->address_string (), ret->Get (i)).FromJust ();
1230+ obj->Set (context,
1231+ env ()->address_string (),
1232+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
12311233 obj->Set (context,
12321234 env ()->ttl_string (),
12331235 Integer::New (env ()->isolate (), addrttls[i].ttl )).FromJust ();
@@ -1239,7 +1241,9 @@ class QueryAnyWrap: public QueryWrap {
12391241 } else {
12401242 for (int i = 0 ; i < a_count; i++) {
12411243 Local<Object> obj = Object::New (env ()->isolate ());
1242- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1244+ obj->Set (context,
1245+ env ()->value_string (),
1246+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
12431247 obj->Set (context,
12441248 env ()->type_string (),
12451249 env ()->dns_cname_string ()).FromJust ();
@@ -1268,7 +1272,9 @@ class QueryAnyWrap: public QueryWrap {
12681272 CHECK_EQ (aaaa_count, naddr6ttls);
12691273 for (uint32_t i = a_count; i < ret->Length (); i++) {
12701274 Local<Object> obj = Object::New (env ()->isolate ());
1271- obj->Set (context, env ()->address_string (), ret->Get (i)).FromJust ();
1275+ obj->Set (context,
1276+ env ()->address_string (),
1277+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
12721278 obj->Set (context,
12731279 env ()->ttl_string (),
12741280 Integer::New (env ()->isolate (), addr6ttls[i].ttl )).FromJust ();
@@ -1295,7 +1301,9 @@ class QueryAnyWrap: public QueryWrap {
12951301 }
12961302 for (uint32_t i = old_count; i < ret->Length (); i++) {
12971303 Local<Object> obj = Object::New (env ()->isolate ());
1298- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1304+ obj->Set (context,
1305+ env ()->value_string (),
1306+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
12991307 obj->Set (context,
13001308 env ()->type_string (),
13011309 env ()->dns_ns_string ()).FromJust ();
@@ -1321,7 +1329,9 @@ class QueryAnyWrap: public QueryWrap {
13211329 status = ParseGeneralReply (env (), buf, len, &type, ret);
13221330 for (uint32_t i = old_count; i < ret->Length (); i++) {
13231331 Local<Object> obj = Object::New (env ()->isolate ());
1324- obj->Set (context, env ()->value_string (), ret->Get (i)).FromJust ();
1332+ obj->Set (context,
1333+ env ()->value_string (),
1334+ ret->Get (context, i).ToLocalChecked ()).FromJust ();
13251335 obj->Set (context,
13261336 env ()->type_string (),
13271337 env ()->dns_ptr_string ()).FromJust ();
@@ -1941,10 +1951,14 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
19411951 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19421952 node::Utf8Value hostname (env->isolate (), args[1 ]);
19431953
1944- int32_t flags = (args[3 ]->IsInt32 ()) ? args[3 ]->Int32Value () : 0 ;
1954+ int32_t flags = 0 ;
1955+ if (args[3 ]->IsInt32 ()) {
1956+ flags = args[3 ]->Int32Value (env->context ()).FromJust ();
1957+ }
1958+
19451959 int family;
19461960
1947- switch (args[2 ]->Int32Value ()) {
1961+ switch (args[2 ]->Int32Value (env-> context ()). FromJust ( )) {
19481962 case 0 :
19491963 family = AF_UNSPEC;
19501964 break ;
@@ -1988,7 +2002,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
19882002 CHECK (args[2 ]->IsUint32 ());
19892003 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19902004 node::Utf8Value ip (env->isolate (), args[1 ]);
1991- const unsigned port = args[2 ]->Uint32Value ();
2005+ const unsigned port = args[2 ]->Uint32Value (env-> context ()). FromJust ( );
19922006 struct sockaddr_storage addr;
19932007
19942008 CHECK (uv_ip4_addr (*ip, port, reinterpret_cast <sockaddr_in*>(&addr)) == 0 ||
@@ -2065,17 +2079,23 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
20652079 int err;
20662080
20672081 for (uint32_t i = 0 ; i < len; i++) {
2068- CHECK (arr->Get (i )->IsArray ());
2082+ CHECK (arr->Get (env-> context (), i). ToLocalChecked ( )->IsArray ());
20692083
2070- Local<Array> elm = Local<Array>::Cast (arr->Get (i));
2084+ Local<Array> elm =
2085+ Local<Array>::Cast (arr->Get (env->context (), i).ToLocalChecked ());
20712086
2072- CHECK (elm->Get (0 )->Int32Value ());
2073- CHECK (elm->Get (1 )->IsString ());
2074- CHECK (elm->Get (2 )->Int32Value ());
2087+ CHECK (elm->Get (env->context (),
2088+ 0 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
2089+ CHECK (elm->Get (env->context (), 1 ).ToLocalChecked ()->IsString ());
2090+ CHECK (elm->Get (env->context (),
2091+ 2 ).ToLocalChecked ()->Int32Value (env->context ()).FromJust ());
20752092
2076- int fam = elm->Get (0 )->Int32Value ();
2077- node::Utf8Value ip (env->isolate (), elm->Get (1 ));
2078- int port = elm->Get (2 )->Int32Value ();
2093+ int fam = elm->Get (env->context (), 0 )
2094+ .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
2095+ node::Utf8Value ip (env->isolate (),
2096+ elm->Get (env->context (), 1 ).ToLocalChecked ());
2097+ int port = elm->Get (env->context (), 2 )
2098+ .ToLocalChecked ()->Int32Value (env->context ()).FromJust ();
20792099
20802100 ares_addr_port_node* cur = &servers[i];
20812101
@@ -2125,7 +2145,8 @@ void Cancel(const FunctionCallbackInfo<Value>& args) {
21252145
21262146void StrError (const FunctionCallbackInfo<Value>& args) {
21272147 Environment* env = Environment::GetCurrent (args);
2128- const char * errmsg = ares_strerror (args[0 ]->Int32Value ());
2148+ const char * errmsg = ares_strerror (args[0 ]->Int32Value (env->context ())
2149+ .FromJust ());
21292150 args.GetReturnValue ().Set (OneByteString (env->isolate (), errmsg));
21302151}
21312152
0 commit comments