@@ -1229,7 +1229,9 @@ class QueryAnyWrap: public QueryWrap {
12291229 CHECK_EQ (naddrttls, a_count);
12301230 for (int i = 0 ; i < a_count; i++) {
12311231 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 ();
12331235 obj->Set (context,
12341236 env ()->ttl_string (),
12351237 Integer::New (env ()->isolate (), addrttls[i].ttl )).FromJust ();
@@ -1241,7 +1243,9 @@ class QueryAnyWrap: public QueryWrap {
12411243 } else {
12421244 for (int i = 0 ; i < a_count; i++) {
12431245 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 ();
12451249 obj->Set (context,
12461250 env ()->type_string (),
12471251 env ()->dns_cname_string ()).FromJust ();
@@ -1270,7 +1274,9 @@ class QueryAnyWrap: public QueryWrap {
12701274 CHECK_EQ (aaaa_count, naddr6ttls);
12711275 for (uint32_t i = a_count; i < ret->Length (); i++) {
12721276 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 ();
12741280 obj->Set (context,
12751281 env ()->ttl_string (),
12761282 Integer::New (env ()->isolate (), addr6ttls[i].ttl )).FromJust ();
@@ -1297,7 +1303,9 @@ class QueryAnyWrap: public QueryWrap {
12971303 }
12981304 for (uint32_t i = old_count; i < ret->Length (); i++) {
12991305 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 ();
13011309 obj->Set (context,
13021310 env ()->type_string (),
13031311 env ()->dns_ns_string ()).FromJust ();
@@ -1323,7 +1331,9 @@ class QueryAnyWrap: public QueryWrap {
13231331 status = ParseGeneralReply (env (), buf, len, &type, ret);
13241332 for (uint32_t i = old_count; i < ret->Length (); i++) {
13251333 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 ();
13271337 obj->Set (context,
13281338 env ()->type_string (),
13291339 env ()->dns_ptr_string ()).FromJust ();
@@ -1943,10 +1953,14 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
19431953 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19441954 node::Utf8Value hostname (env->isolate (), args[1 ]);
19451955
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+
19471961 int family;
19481962
1949- switch (args[2 ]->Int32Value ()) {
1963+ switch (args[2 ]->Int32Value (env-> context ()). FromJust ( )) {
19501964 case 0 :
19511965 family = AF_UNSPEC;
19521966 break ;
@@ -1990,7 +2004,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
19902004 CHECK (args[2 ]->IsUint32 ());
19912005 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19922006 node::Utf8Value ip (env->isolate (), args[1 ]);
1993- const unsigned port = args[2 ]->Uint32Value ();
2007+ const unsigned port = args[2 ]->Uint32Value (env-> context ()). FromJust ( );
19942008 struct sockaddr_storage addr;
19952009
19962010 CHECK (uv_ip4_addr (*ip, port, reinterpret_cast <sockaddr_in*>(&addr)) == 0 ||
@@ -2067,17 +2081,23 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
20672081 int err;
20682082
20692083 for (uint32_t i = 0 ; i < len; i++) {
2070- CHECK (arr->Get (i )->IsArray ());
2084+ CHECK (arr->Get (env-> context (), i). ToLocalChecked ( )->IsArray ());
20712085
2072- Local<Array> elm = Local<Array>::Cast (arr->Get (i));
2086+ Local<Array> elm =
2087+ Local<Array>::Cast (arr->Get (env->context (), i).ToLocalChecked ());
20732088
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 ());
20772094
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 ();
20812101
20822102 ares_addr_port_node* cur = &servers[i];
20832103
@@ -2127,7 +2147,8 @@ void Cancel(const FunctionCallbackInfo<Value>& args) {
21272147
21282148void StrError (const FunctionCallbackInfo<Value>& args) {
21292149 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 ());
21312152 args.GetReturnValue ().Set (OneByteString (env->isolate (), errmsg));
21322153}
21332154
0 commit comments