A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/a94c3ae06f below:

replace ToLocalChecked uses with ToLocal in node-file · nodejs/node@a94c3ae · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+45

-20

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+45

-20

lines changed Original file line number Diff line number Diff line change

@@ -221,9 +221,15 @@ void FSReqPromise<AliasedBufferT>::Reject(v8::Local<v8::Value> reject) {

221 221

finished_ = true;

222 222

v8::HandleScope scope(env()->isolate());

223 223

InternalCallbackScope callback_scope(this);

224 -

v8::Local<v8::Value> value =

225 -

object()->Get(env()->context(),

226 -

env()->promise_string()).ToLocalChecked();

224 +

v8::Local<v8::Value> value;

225 +

if (!object()

226 +

->Get(env()->context(), env()->promise_string())

227 +

.ToLocal(&value)) {

228 +

// If we hit this, getting the value from the object failed and

229 +

// an error was likely scheduled. We could try to reject the promise

230 +

// but let's just allow the error to propagate.

231 +

return;

232 +

}

227 233

v8::Local<v8::Promise::Resolver> resolver = value.As<v8::Promise::Resolver>();

228 234

USE(resolver->Reject(env()->context(), reject).FromJust());

229 235

}

@@ -233,9 +239,13 @@ void FSReqPromise<AliasedBufferT>::Resolve(v8::Local<v8::Value> value) {

233 239

finished_ = true;

234 240

v8::HandleScope scope(env()->isolate());

235 241

InternalCallbackScope callback_scope(this);

236 -

v8::Local<v8::Value> val =

237 -

object()->Get(env()->context(),

238 -

env()->promise_string()).ToLocalChecked();

242 +

v8::Local<v8::Value> val;

243 +

if (!object()->Get(env()->context(), env()->promise_string()).ToLocal(&val)) {

244 +

// If we hit this, getting the value from the object failed and

245 +

// an error was likely scheduled. We could try to reject the promise

246 +

// but let's just allow the error to propagate.

247 +

return;

248 +

}

239 249

v8::Local<v8::Promise::Resolver> resolver = val.As<v8::Promise::Resolver>();

240 250

USE(resolver->Resolve(env()->context(), value).FromJust());

241 251

}

@@ -255,9 +265,13 @@ void FSReqPromise<AliasedBufferT>::ResolveStatFs(const uv_statfs_t* stat) {

255 265

template <typename AliasedBufferT>

256 266

void FSReqPromise<AliasedBufferT>::SetReturnValue(

257 267

const v8::FunctionCallbackInfo<v8::Value>& args) {

258 -

v8::Local<v8::Value> val =

259 -

object()->Get(env()->context(),

260 -

env()->promise_string()).ToLocalChecked();

268 +

v8::Local<v8::Value> val;

269 +

if (!object()->Get(env()->context(), env()->promise_string()).ToLocal(&val)) {

270 +

// If we hit this, getting the value from the object failed and

271 +

// an error was likely scheduled. We could try to reject the promise

272 +

// but let's just allow the error to propagate.

273 +

return;

274 +

}

261 275

v8::Local<v8::Promise::Resolver> resolver = val.As<v8::Promise::Resolver>();

262 276

args.GetReturnValue().Set(resolver->GetPromise());

263 277

}

Original file line number Diff line number Diff line change

@@ -437,7 +437,8 @@ MaybeLocal<Promise> FileHandle::ClosePromise() {

437 437 438 438

auto maybe_resolver = Promise::Resolver::New(context);

439 439

CHECK(!maybe_resolver.IsEmpty());

440 -

Local<Promise::Resolver> resolver = maybe_resolver.ToLocalChecked();

440 +

Local<Promise::Resolver> resolver;

441 +

if (!maybe_resolver.ToLocal(&resolver)) return {};

441 442

Local<Promise> promise = resolver.As<Promise>();

442 443 443 444

Local<Object> close_req_obj;

@@ -844,10 +845,12 @@ void AfterStringPath(uv_fs_t* req) {

844 845

req->path,

845 846

req_wrap->encoding(),

846 847

&error);

847 -

if (link.IsEmpty())

848 +

if (link.IsEmpty()) {

848 849

req_wrap->Reject(error);

849 -

else

850 -

req_wrap->Resolve(link.ToLocalChecked());

850 +

} else {

851 +

Local<Value> val;

852 +

if (link.ToLocal(&val)) req_wrap->Resolve(val);

853 +

}

851 854

}

852 855

}

853 856

@@ -864,10 +867,12 @@ void AfterStringPtr(uv_fs_t* req) {

864 867

static_cast<const char*>(req->ptr),

865 868

req_wrap->encoding(),

866 869

&error);

867 -

if (link.IsEmpty())

870 +

if (link.IsEmpty()) {

868 871

req_wrap->Reject(error);

869 -

else

870 -

req_wrap->Resolve(link.ToLocalChecked());

872 +

} else {

873 +

Local<Value> val;

874 +

if (link.ToLocal(&val)) req_wrap->Resolve(val);

875 +

}

871 876

}

872 877

}

873 878

@@ -2237,7 +2242,8 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {

2237 2242

MaybeStackBuffer<uv_buf_t> iovs(chunks->Length());

2238 2243 2239 2244

for (uint32_t i = 0; i < iovs.length(); i++) {

2240 -

Local<Value> chunk = chunks->Get(env->context(), i).ToLocalChecked();

2245 +

Local<Value> chunk;

2246 +

if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return;

2241 2247

CHECK(Buffer::HasInstance(chunk));

2242 2248

iovs[i] = uv_buf_init(Buffer::Data(chunk), Buffer::Length(chunk));

2243 2249

}

@@ -2577,8 +2583,12 @@ static void ReadFileUtf8(const FunctionCallbackInfo<Value>& args) {

2577 2583

}

2578 2584

FS_SYNC_TRACE_END(read);

2579 2585 2580 -

args.GetReturnValue().Set(

2581 -

ToV8Value(env->context(), result, isolate).ToLocalChecked());

2586 +

Local<Value> val;

2587 +

if (!ToV8Value(env->context(), result, isolate).ToLocal(&val)) {

2588 +

return;

2589 +

}

2590 + 2591 +

args.GetReturnValue().Set(val);

2582 2592

}

2583 2593 2584 2594

// Wrapper for readv(2).

@@ -2606,7 +2616,8 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {

2606 2616 2607 2617

// Init uv buffers from ArrayBufferViews

2608 2618

for (uint32_t i = 0; i < iovs.length(); i++) {

2609 -

Local<Value> buffer = buffers->Get(env->context(), i).ToLocalChecked();

2619 +

Local<Value> buffer;

2620 +

if (!buffers->Get(env->context(), i).ToLocal(&buffer)) return;

2610 2621

CHECK(Buffer::HasInstance(buffer));

2611 2622

iovs[i] = uv_buf_init(Buffer::Data(buffer), Buffer::Length(buffer));

2612 2623

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4