@@ -1231,7 +1231,9 @@ class QueryAnyWrap: public QueryWrap {
12311231 CHECK_EQ (naddrttls, a_count);
12321232 for (int i = 0 ; i < a_count; i++) {
12331233 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 ();
12351237 obj->Set (context,
12361238 env ()->ttl_string (),
12371239 Integer::New (env ()->isolate (), addrttls[i].ttl )).FromJust ();
@@ -1243,7 +1245,9 @@ class QueryAnyWrap: public QueryWrap {
12431245 } else {
12441246 for (int i = 0 ; i < a_count; i++) {
12451247 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 ();
12471251 obj->Set (context,
12481252 env ()->type_string (),
12491253 env ()->dns_cname_string ()).FromJust ();
@@ -1272,7 +1276,9 @@ class QueryAnyWrap: public QueryWrap {
12721276 CHECK_EQ (aaaa_count, naddr6ttls);
12731277 for (uint32_t i = a_count; i < ret->Length (); i++) {
12741278 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 ();
12761282 obj->Set (context,
12771283 env ()->ttl_string (),
12781284 Integer::New (env ()->isolate (), addr6ttls[i].ttl )).FromJust ();
@@ -1299,7 +1305,9 @@ class QueryAnyWrap: public QueryWrap {
12991305 }
13001306 for (uint32_t i = old_count; i < ret->Length (); i++) {
13011307 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 ();
13031311 obj->Set (context,
13041312 env ()->type_string (),
13051313 env ()->dns_ns_string ()).FromJust ();
@@ -1325,7 +1333,9 @@ class QueryAnyWrap: public QueryWrap {
13251333 status = ParseGeneralReply (env (), buf, len, &type, ret);
13261334 for (uint32_t i = old_count; i < ret->Length (); i++) {
13271335 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 ();
13291339 obj->Set (context,
13301340 env ()->type_string (),
13311341 env ()->dns_ptr_string ()).FromJust ();
@@ -1945,10 +1955,14 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
19451955 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19461956 node::Utf8Value hostname (env->isolate (), args[1 ]);
19471957
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+
19491963 int family;
19501964
1951- switch (args[2 ]->Int32Value ()) {
1965+ switch (args[2 ]->Int32Value (env-> context ()). FromJust ( )) {
19521966 case 0 :
19531967 family = AF_UNSPEC;
19541968 break ;
@@ -1992,7 +2006,7 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
19922006 CHECK (args[2 ]->IsUint32 ());
19932007 Local<Object> req_wrap_obj = args[0 ].As <Object>();
19942008 node::Utf8Value ip (env->isolate (), args[1 ]);
1995- const unsigned port = args[2 ]->Uint32Value ();
2009+ const unsigned port = args[2 ]->Uint32Value (env-> context ()). FromJust ( );
19962010 struct sockaddr_storage addr;
19972011
19982012 CHECK (uv_ip4_addr (*ip, port, reinterpret_cast <sockaddr_in*>(&addr)) == 0 ||
@@ -2069,17 +2083,23 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
20692083 int err;
20702084
20712085 for (uint32_t i = 0 ; i < len; i++) {
2072- CHECK (arr->Get (i )->IsArray ());
2086+ CHECK (arr->Get (env-> context (), i). ToLocalChecked ( )->IsArray ());
20732087
2074- Local<Array> elm = Local<Array>::Cast (arr->Get (i));
2088+ Local<Array> elm =
2089+ Local<Array>::Cast (arr->Get (env->context (), i).ToLocalChecked ());
20752090
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 ());
20792096
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 ();
20832103
20842104 ares_addr_port_node* cur = &servers[i];
20852105
@@ -2129,7 +2149,8 @@ void Cancel(const FunctionCallbackInfo<Value>& args) {
21292149
21302150void StrError (const FunctionCallbackInfo<Value>& args) {
21312151 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 ());
21332154 args.GetReturnValue ().Set (OneByteString (env->isolate (), errmsg));
21342155}
21352156
0 commit comments