| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1406,16 +1406,15 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) { | |||
| 1406 | 1406 | const char* link_path = static_cast<const char*>(req_wrap_sync.req.ptr); | |
| 1407 | 1407 | ||
| 1408 | 1408 | Local<Value> error; | |
| 1409 | - MaybeLocal<Value> rc = StringBytes::Encode(isolate, | ||
| 1410 | - link_path, | ||
| 1411 | - encoding, | ||
| 1412 | - &error); | ||
| 1413 | - if (rc.IsEmpty()) { | ||
| 1409 | + Local<Value> ret; | ||
| 1410 | + if (!StringBytes::Encode(isolate, link_path, encoding, &error) | ||
| 1411 | + .ToLocal(&ret)) { | ||
| 1412 | + DCHECK(!error.IsEmpty()); | ||
| 1414 | 1413 | env->isolate()->ThrowException(error); | |
| 1415 | 1414 | return; | |
| 1416 | 1415 | } | |
| 1417 | 1416 | ||
| 1418 | - args.GetReturnValue().Set(rc.ToLocalChecked()); | ||
| 1417 | + args.GetReturnValue().Set(ret); | ||
| 1419 | 1418 | } | |
| 1420 | 1419 | } | |
| 1421 | 1420 | ||
@@ -1817,15 +1816,16 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) { | |||
| 1817 | 1816 | } | |
| 1818 | 1817 | if (!req_wrap_sync.continuation_data()->first_path().empty()) { | |
| 1819 | 1818 | Local<Value> error; | |
| 1819 | + Local<Value> ret; | ||
| 1820 | 1820 | std::string first_path(req_wrap_sync.continuation_data()->first_path()); | |
| 1821 | - MaybeLocal<Value> path = StringBytes::Encode(env->isolate(), | ||
| 1822 | - first_path.c_str(), | ||
| 1823 | - UTF8, &error); | ||
| 1824 | - if (path.IsEmpty()) { | ||
| 1821 | + if (!StringBytes::Encode( | ||
| 1822 | + env->isolate(), first_path.c_str(), UTF8, &error) | ||
| 1823 | + .ToLocal(&ret)) { | ||
| 1824 | + DCHECK(!error.IsEmpty()); | ||
| 1825 | 1825 | env->isolate()->ThrowException(error); | |
| 1826 | 1826 | return; | |
| 1827 | 1827 | } | |
| 1828 | - args.GetReturnValue().Set(path.ToLocalChecked()); | ||
| 1828 | + args.GetReturnValue().Set(ret); | ||
| 1829 | 1829 | } | |
| 1830 | 1830 | } else { | |
| 1831 | 1831 | SyncCallAndThrowOnError(env, &req_wrap_sync, uv_fs_mkdir, *path, mode); | |
@@ -1866,16 +1866,15 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) { | |||
| 1866 | 1866 | const char* link_path = static_cast<const char*>(req_wrap_sync.req.ptr); | |
| 1867 | 1867 | ||
| 1868 | 1868 | Local<Value> error; | |
| 1869 | - MaybeLocal<Value> rc = StringBytes::Encode(isolate, | ||
| 1870 | - link_path, | ||
| 1871 | - encoding, | ||
| 1872 | - &error); | ||
| 1873 | - if (rc.IsEmpty()) { | ||
| 1869 | + Local<Value> ret; | ||
| 1870 | + if (!StringBytes::Encode(isolate, link_path, encoding, &error) | ||
| 1871 | + .ToLocal(&ret)) { | ||
| 1872 | + DCHECK(!error.IsEmpty()); | ||
| 1874 | 1873 | env->isolate()->ThrowException(error); | |
| 1875 | 1874 | return; | |
| 1876 | 1875 | } | |
| 1877 | 1876 | ||
| 1878 | - args.GetReturnValue().Set(rc.ToLocalChecked()); | ||
| 1877 | + args.GetReturnValue().Set(ret); | ||
| 1879 | 1878 | } | |
| 1880 | 1879 | } | |
| 1881 | 1880 | ||
@@ -1962,17 +1961,15 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) { | |||
| 1962 | 1961 | } | |
| 1963 | 1962 | ||
| 1964 | 1963 | Local<Value> error; | |
| 1965 | - MaybeLocal<Value> filename = StringBytes::Encode(isolate, | ||
| 1966 | - ent.name, | ||
| 1967 | - encoding, | ||
| 1968 | - &error); | ||
| 1969 | - | ||
| 1970 | - if (filename.IsEmpty()) { | ||
| 1964 | + Local<Value> fn; | ||
| 1965 | + if (!StringBytes::Encode(isolate, ent.name, encoding, &error) | ||
| 1966 | + .ToLocal(&fn)) { | ||
| 1967 | + DCHECK(!error.IsEmpty()); | ||
| 1971 | 1968 | isolate->ThrowException(error); | |
| 1972 | 1969 | return; | |
| 1973 | 1970 | } | |
| 1974 | 1971 | ||
| 1975 | - name_v.push_back(filename.ToLocalChecked()); | ||
| 1972 | + name_v.push_back(fn); | ||
| 1976 | 1973 | ||
| 1977 | 1974 | if (with_types) { | |
| 1978 | 1975 | type_v.emplace_back(Integer::New(isolate, ent.type)); | |
@@ -2993,13 +2990,14 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) { | |||
| 2993 | 2990 | return; | |
| 2994 | 2991 | } | |
| 2995 | 2992 | Local<Value> error; | |
| 2996 | - MaybeLocal<Value> rc = | ||
| 2997 | - StringBytes::Encode(isolate, req_wrap_sync.req.path, encoding, &error); | ||
| 2998 | - if (rc.IsEmpty()) { | ||
| 2993 | + Local<Value> ret; | ||
| 2994 | + if (!StringBytes::Encode(isolate, req_wrap_sync.req.path, encoding, &error) | ||
| 2995 | + .ToLocal(&ret)) { | ||
| 2996 | + DCHECK(!error.IsEmpty()); | ||
| 2999 | 2997 | env->isolate()->ThrowException(error); | |
| 3000 | 2998 | return; | |
| 3001 | 2999 | } | |
| 3002 | - args.GetReturnValue().Set(rc.ToLocalChecked()); | ||
| 3000 | + args.GetReturnValue().Set(ret); | ||
| 3003 | 3001 | } | |
| 3004 | 3002 | } | |
| 3005 | 3003 | ||
@@ -3311,9 +3309,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { | |||
| 3311 | 3309 | for (int i = 0; i < legacy_main_extensions_with_main_end; i++) { | |
| 3312 | 3310 | file_path = *initial_file_path + std::string(legacy_main_extensions[i]); | |
| 3313 | 3311 | // TODO(anonrig): Remove this when ToNamespacedPath supports std::string | |
| 3314 | - Local<Value> local_file_path = | ||
| 3315 | - Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) | ||
| 3316 | - .ToLocalChecked(); | ||
| 3312 | + Local<Value> local_file_path; | ||
| 3313 | + if (!Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) | ||
| 3314 | + .ToLocal(&local_file_path)) { | ||
| 3315 | + return; | ||
| 3316 | + } | ||
| 3317 | 3317 | BufferValue buff_file_path(isolate, local_file_path); | |
| 3318 | 3318 | ToNamespacedPath(env, &buff_file_path); | |
| 3319 | 3319 | ||
@@ -3346,9 +3346,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { | |||
| 3346 | 3346 | i++) { | |
| 3347 | 3347 | file_path = *initial_file_path + std::string(legacy_main_extensions[i]); | |
| 3348 | 3348 | // TODO(anonrig): Remove this when ToNamespacedPath supports std::string | |
| 3349 | - Local<Value> local_file_path = | ||
| 3350 | - Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) | ||
| 3351 | - .ToLocalChecked(); | ||
| 3349 | + Local<Value> local_file_path; | ||
| 3350 | + if (!Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) | ||
| 3351 | + .ToLocal(&local_file_path)) { | ||
| 3352 | + return; | ||
| 3353 | + } | ||
| 3352 | 3354 | BufferValue buff_file_path(isolate, local_file_path); | |
| 3353 | 3355 | ToNamespacedPath(env, &buff_file_path); | |
| 3354 | 3356 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments