Skip to content

Commit

Permalink
src: create handle scope in FastInternalModuleStat
Browse files Browse the repository at this point in the history
It needs a handle scope for the context handle. Since the
FastApiCallbackOptions struct doesn't have isolate on it
in V8 12.4 on Node.js 22, use Isolate::TryGetCurrent() to
get to the isolate needed for the handle scope creation and
fallback to the slow callback if no isolate is entered.

PR-URL: #54384
Refs: #52797
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
joyeecheung authored and RafaelGSS committed Sep 6, 2024
1 parent 99e5abc commit 5c9599a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,14 @@ static int32_t FastInternalModuleStat(
const FastOneByteString& input,
// NOLINTNEXTLINE(runtime/references) This is V8 api.
FastApiCallbackOptions& options) {
// This needs a HandleScope which needs an isolate.
Isolate* isolate = Isolate::TryGetCurrent();
if (!isolate) {
options.fallback = true;
return -1;
}

HandleScope scope(isolate);
Environment* env = Environment::GetCurrent(recv->GetCreationContextChecked());

auto path = std::filesystem::path(input.data, input.data + input.length);
Expand Down

0 comments on commit 5c9599a

Please sign in to comment.