diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-11-26 19:05:25 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-28 19:49:11 +0300 |
commit | 5b59c248413af4e81a0616286790b3dc718107ef (patch) | |
tree | 5b2078e4d515638137ea21814113c4ca7a2b9634 /src/node_errors.cc | |
parent | f73716d35aa14d4808be2775dc8374db7aa2fed9 (diff) |
src: add more `can_call_into_js()` guards
This is in preparation for running native `SetImmediate()`
callbacks during shutdown.
PR-URL: https://github.com/nodejs/node/pull/30666
Fixes: https://github.com/nodejs/node/issues/30643
Refs: https://github.com/nodejs/node/pull/30374
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_errors.cc')
-rw-r--r-- | src/node_errors.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/node_errors.cc b/src/node_errors.cc index e094fe4681f..17c1bd7f55c 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -278,6 +278,9 @@ static void ReportFatalException(Environment* env, Local<Value> error, Local<Message> message, EnhanceFatalException enhance_stack) { + if (!env->can_call_into_js()) + enhance_stack = EnhanceFatalException::kDontEnhance; + Isolate* isolate = env->isolate(); CHECK(!error.IsEmpty()); CHECK(!message.IsEmpty()); @@ -956,7 +959,7 @@ void TriggerUncaughtException(Isolate* isolate, } MaybeLocal<Value> handled; - { + if (env->can_call_into_js()) { // We do not expect the global uncaught exception itself to throw any more // exceptions. If it does, exit the current Node.js instance. errors::TryCatchScope try_catch(env, |