summaryrefslogtreecommitdiff
path: root/core/ops_builtin_v8.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-04-27 13:40:03 +0100
committerGitHub <noreply@github.com>2023-04-27 14:40:03 +0200
commit03132e19da6c8e34e8100c6a57cd911b43900950 (patch)
tree014db77ed12f9ae882abba3c23c5f541461f03b4 /core/ops_builtin_v8.rs
parentd043a6d72cbf683c70f7eb4b9b3c09003afd2683 (diff)
fix(test): handle dispatched exceptions from test functions (#18853)
Fixes #18852.
Diffstat (limited to 'core/ops_builtin_v8.rs')
-rw-r--r--core/ops_builtin_v8.rs23
1 files changed, 9 insertions, 14 deletions
diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs
index 6e8b2efda..f4133f3b8 100644
--- a/core/ops_builtin_v8.rs
+++ b/core/ops_builtin_v8.rs
@@ -713,22 +713,17 @@ fn op_dispatch_exception(
) {
let state_rc = JsRuntime::state(scope);
let mut state = state_rc.borrow_mut();
- state
- .dispatched_exceptions
- .push_front(v8::Global::new(scope, exception.v8_value));
- // Only terminate execution if there are no inspector sessions.
- if state.inspector.is_none() {
- scope.terminate_execution();
- return;
- }
+ if let Some(inspector) = &state.inspector {
+ let inspector = inspector.borrow();
+ // TODO(nayeemrmn): Send exception message to inspector sessions here.
- // FIXME(bartlomieju): I'm not sure if this assumption is valid... Maybe when
- // inspector is polling on pause?
- if state.inspector().try_borrow().is_ok() {
- scope.terminate_execution();
- } else {
- // If the inspector is borrowed at this time, assume an inspector is active.
+ // This indicates that the op is being called from a REPL. Skip termination.
+ if inspector.is_dispatching_message() {
+ return;
+ }
}
+ state.dispatched_exception = Some(v8::Global::new(scope, exception.v8_value));
+ scope.terminate_execution();
}
#[op(v8)]