summaryrefslogtreecommitdiff
path: root/src/api/environment.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-14 23:30:37 +0100
committerAnna Henningsen <anna@addaleax.net>2019-02-18 09:17:11 +0100
commit85b95cc6a3d017c58a0e15efa2c4406b34bd4611 (patch)
treed4bbb8f3b8804116a783876e1908518fdfb5c1e1 /src/api/environment.cc
parent35e6070f143375ec61b8f0f14cb214e87a077171 (diff)
downloadandroid-node-v8-85b95cc6a3d017c58a0e15efa2c4406b34bd4611.tar.gz
android-node-v8-85b95cc6a3d017c58a0e15efa2c4406b34bd4611.tar.bz2
android-node-v8-85b95cc6a3d017c58a0e15efa2c4406b34bd4611.zip
worker: ignore --abort-on-uncaught-exception for terminate()
When running Worker threads with `--abort-on-uncaught-exception`, do not abort the process when `worker.terminate()` is called. PR-URL: https://github.com/nodejs/node/pull/26111 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/api/environment.cc')
-rw-r--r--src/api/environment.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc
index f93fcd738d..37028dff62 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -32,7 +32,9 @@ static bool AllowWasmCodeGenerationCallback(Local<Context> context,
static bool ShouldAbortOnUncaughtException(Isolate* isolate) {
HandleScope scope(isolate);
Environment* env = Environment::GetCurrent(isolate);
- return env != nullptr && env->should_abort_on_uncaught_toggle()[0] &&
+ return env != nullptr &&
+ (env->is_main_thread() || !env->is_stopping_worker()) &&
+ env->should_abort_on_uncaught_toggle()[0] &&
!env->inside_should_not_abort_on_uncaught_scope();
}