@@ -54,7 +54,6 @@ namespace fs {
5454
5555using v8::Array;
5656using v8::BigInt;
57- using v8::Boolean;
5857using v8::Context;
5958using v8::EscapableHandleScope;
6059using v8::Function;
@@ -1032,15 +1031,13 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {
10321031 env, permission::PermissionScope::kFileSystemRead , path.ToStringView ());
10331032
10341033 if (strlen (*path) != path.length ()) {
1035- args.GetReturnValue ().Set (Array::New (isolate));
10361034 return ; // Contains a nul byte.
10371035 }
10381036 uv_fs_t open_req;
10391037 const int fd = uv_fs_open (loop, &open_req, *path, O_RDONLY, 0 , nullptr );
10401038 uv_fs_req_cleanup (&open_req);
10411039
10421040 if (fd < 0 ) {
1043- args.GetReturnValue ().Set (Array::New (isolate));
10441041 return ;
10451042 }
10461043
@@ -1067,7 +1064,6 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {
10671064 uv_fs_req_cleanup (&read_req);
10681065
10691066 if (numchars < 0 ) {
1070- args.GetReturnValue ().Set (Array::New (isolate));
10711067 return ;
10721068 }
10731069 offset += numchars;
@@ -1079,42 +1075,10 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {
10791075 }
10801076 const size_t size = offset - start;
10811077
1082- // TODO(anonrig): Follow-up on removing the following changes for AIX.
1083- char * p = &chars[start];
1084- char * pe = &chars[size];
1085- char * pos[2 ];
1086- char ** ppos = &pos[0 ];
1087-
1088- while (p < pe) {
1089- char c = *p++;
1090- if (c == ' \\ ' && p < pe && *p == ' "' ) p++;
1091- if (c != ' "' ) continue ;
1092- *ppos++ = p;
1093- if (ppos < &pos[2 ]) continue ;
1094- ppos = &pos[0 ];
1095-
1096- char * s = &pos[0 ][0 ];
1097- char * se = &pos[1 ][-1 ]; // Exclude quote.
1098- size_t n = se - s;
1099-
1100- if (n == 4 ) {
1101- if (0 == memcmp (s, " main" , 4 )) break ;
1102- if (0 == memcmp (s, " name" , 4 )) break ;
1103- if (0 == memcmp (s, " type" , 4 )) break ;
1104- } else if (n == 7 ) {
1105- if (0 == memcmp (s, " exports" , 7 )) break ;
1106- if (0 == memcmp (s, " imports" , 7 )) break ;
1107- }
1108- }
1109-
1110- Local<Value> return_value[] = {
1078+ args.GetReturnValue ().Set (
11111079 String::NewFromUtf8 (
11121080 isolate, &chars[start], v8::NewStringType::kNormal , size)
1113- .ToLocalChecked (),
1114- Boolean::New (isolate, p < pe ? true : false )};
1115-
1116- args.GetReturnValue ().Set (
1117- Array::New (isolate, return_value, arraysize (return_value)));
1081+ .ToLocalChecked ());
11181082}
11191083
11201084// Used to speed up module loading. Returns 0 if the path refers to
0 commit comments