| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 03d6013 commit 513ab0e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ static bool ShouldAbortOnUncaughtException(Isolate* isolate) { | |||
| 42 | 42 | Environment* env = Environment::GetCurrent(isolate); | |
| 43 | 43 | return env != nullptr && | |
| 44 | 44 | (env->is_main_thread() || !env->is_stopping()) && | |
| 45 | + env->abort_on_uncaught_exception() && | ||
| 45 | 46 | env->should_abort_on_uncaught_toggle()[0] && | |
| 46 | 47 | !env->inside_should_not_abort_on_uncaught_scope(); | |
| 47 | 48 | } | |
@@ -355,9 +356,6 @@ Environment* CreateEnvironment( | |||
| 355 | 356 | exec_args, | |
| 356 | 357 | flags, | |
| 357 | 358 | thread_id); | |
| 358 | - if (flags & EnvironmentFlags::kOwnsProcessState) { | ||
| 359 | - env->set_abort_on_uncaught_exception(false); | ||
| 360 | - } | ||
| 361 | 359 | ||
| 362 | 360 | #if HAVE_INSPECTOR | |
| 363 | 361 | if (inspector_parent_handle) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,6 +348,10 @@ Environment::Environment(IsolateData* isolate_data, | |||
| 348 | 348 | inspector_host_port_.reset( | |
| 349 | 349 | new ExclusiveAccess<HostPort>(options_->debug_options().host_port)); | |
| 350 | 350 | ||
| 351 | + if (!(flags_ & EnvironmentFlags::kOwnsProcessState)) { | ||
| 352 | + set_abort_on_uncaught_exception(false); | ||
| 353 | + } | ||
| 354 | + | ||
| 351 | 355 | #if HAVE_INSPECTOR | |
| 352 | 356 | // We can only create the inspector agent after having cloned the options. | |
| 353 | 357 | inspector_agent_ = std::make_unique<inspector::Agent>(this); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + // Flags: --abort-on-uncaught-exception | ||
| 2 | + 'use strict'; | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const { Worker } = require('worker_threads'); | ||
| 6 | + | ||
| 7 | + // Tests that --abort-on-uncaught-exception does not apply to | ||
| 8 | + // Workers. | ||
| 9 | + | ||
| 10 | + const w = new Worker('throw new Error()', { eval: true }); | ||
| 11 | + w.on('error', common.mustCall()); | ||
| 12 | + w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1))); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments