src: add more `can_call_into_js()` guards · nodejs/node@94357db · GitHub
Skip to content

Commit 94357db

Browse files
committed
src: add more can_call_into_js() guards
This is in preparation for running native `SetImmediate()` callbacks during shutdown. PR-URL: #30666 Fixes: #30643 Refs: #30374 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d54432f commit 94357db

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/env.cc

Lines changed: 4 additions & 1 deletion

src/node_errors.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ static void ReportFatalException(Environment* env,
278278
Local<Value> error,
279279
Local<Message> message,
280280
EnhanceFatalException enhance_stack) {
281+
if (!env->can_call_into_js())
282+
enhance_stack = EnhanceFatalException::kDontEnhance;
283+
281284
Isolate* isolate = env->isolate();
282285
CHECK(!error.IsEmpty());
283286
CHECK(!message.IsEmpty());
@@ -956,7 +959,7 @@ void TriggerUncaughtException(Isolate* isolate,
956959
}
957960

958961
MaybeLocal<Value> handled;
959-
{
962+
if (env->can_call_into_js()) {
960963
// We do not expect the global uncaught exception itself to throw any more
961964
// exceptions. If it does, exit the current Node.js instance.
962965
errors::TryCatchScope try_catch(env,

src/node_process_events.cc

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)