| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -287,21 +287,27 @@ FSReqBase* GetReqWrap(const v8::FunctionCallbackInfo<v8::Value>& args, | |||
| 287 | 287 | int index, | |
| 288 | 288 | bool use_bigint) { | |
| 289 | 289 | v8::Local<v8::Value> value = args[index]; | |
| 290 | + FSReqBase* result = nullptr; | ||
| 290 | 291 | if (value->IsObject()) { | |
| 291 | - return Unwrap<FSReqBase>(value.As<v8::Object>()); | ||
| 292 | - } | ||
| 293 | - | ||
| 294 | - Realm* realm = Realm::GetCurrent(args); | ||
| 295 | - BindingData* binding_data = realm->GetBindingData<BindingData>(); | ||
| 296 | - | ||
| 297 | - if (value->StrictEquals(realm->isolate_data()->fs_use_promises_symbol())) { | ||
| 298 | - if (use_bigint) { | ||
| 299 | - return FSReqPromise<AliasedBigInt64Array>::New(binding_data, use_bigint); | ||
| 300 | - } else { | ||
| 301 | - return FSReqPromise<AliasedFloat64Array>::New(binding_data, use_bigint); | ||
| 292 | + result = Unwrap<FSReqBase>(value.As<v8::Object>()); | ||
| 293 | + } else { | ||
| 294 | + Realm* realm = Realm::GetCurrent(args); | ||
| 295 | + BindingData* binding_data = realm->GetBindingData<BindingData>(); | ||
| 296 | + | ||
| 297 | + if (value->StrictEquals(realm->isolate_data()->fs_use_promises_symbol())) { | ||
| 298 | + if (use_bigint) { | ||
| 299 | + result = | ||
| 300 | + FSReqPromise<AliasedBigInt64Array>::New(binding_data, use_bigint); | ||
| 301 | + } else { | ||
| 302 | + result = | ||
| 303 | + FSReqPromise<AliasedFloat64Array>::New(binding_data, use_bigint); | ||
| 304 | + } | ||
| 302 | 305 | } | |
| 303 | 306 | } | |
| 304 | - return nullptr; | ||
| 307 | + if (result != nullptr) { | ||
| 308 | + result->SetReturnValue(args); | ||
| 309 | + } | ||
| 310 | + return result; | ||
| 305 | 311 | } | |
| 306 | 312 | ||
| 307 | 313 | // Returns nullptr if the operation fails from the start. | |
@@ -320,10 +326,7 @@ FSReqBase* AsyncDestCall(Environment* env, FSReqBase* req_wrap, | |||
| 320 | 326 | uv_req->path = nullptr; | |
| 321 | 327 | after(uv_req); // after may delete req_wrap if there is an error | |
| 322 | 328 | req_wrap = nullptr; | |
| 323 | - } else { | ||
| 324 | - req_wrap->SetReturnValue(args); | ||
| 325 | 329 | } | |
| 326 | - | ||
| 327 | 330 | return req_wrap; | |
| 328 | 331 | } | |
| 329 | 332 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2381,8 +2381,6 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) { | |||
| 2381 | 2381 | uv_req->path = nullptr; | |
| 2382 | 2382 | AfterInteger(uv_req); // after may delete req_wrap_async if there is | |
| 2383 | 2383 | // an error | |
| 2384 | - } else { | ||
| 2385 | - req_wrap_async->SetReturnValue(args); | ||
| 2386 | 2384 | } | |
| 2387 | 2385 | } else { // write(fd, string, pos, enc, undefined, ctx) | |
| 2388 | 2386 | CHECK_EQ(argc, 6); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -210,6 +210,12 @@ const relativeProtectedFolder = process.env.RELATIVEBLOCKEDFOLDER; | |||
| 210 | 210 | code: 'ERR_ACCESS_DENIED', | |
| 211 | 211 | permission: 'FileSystemWrite', | |
| 212 | 212 | })); | |
| 213 | + assert.rejects(async () => { | ||
| 214 | + await fs.promises.mkdtemp(path.join(blockedFolder, 'any-folder')); | ||
| 215 | + }, { | ||
| 216 | + code: 'ERR_ACCESS_DENIED', | ||
| 217 | + permission: 'FileSystemWrite', | ||
| 218 | + }); | ||
| 213 | 219 | } | |
| 214 | 220 | ||
| 215 | 221 | // fs.rename | |
| Back | FazBrowse Home | New Git URL |
0 commit comments