diff --git a/ext/web/event.rs b/ext/web/event.rs index c5e404c6e6..e4bc26bcf6 100644 --- a/ext/web/event.rs +++ b/ext/web/event.rs @@ -2137,6 +2137,7 @@ impl AbortSignal { cppgc::wrap_object2(scope, obj, (event_target, abort_signal)) } + #[required(1)] #[static_method] fn any<'a>( scope: &mut v8::HandleScope<'a>, @@ -2168,6 +2169,17 @@ impl AbortSignal { )) } + fn throw_if_aborted<'a>( + &self, + scope: &mut v8::HandleScope<'a>, + ) -> v8::Local<'a, v8::Value> { + if let Some(reason) = &*self.reason.borrow() { + let reason = v8::Local::new(scope, reason); + scope.throw_exception(reason); + } + v8::undefined(scope).into() + } + #[getter] fn aborted(&self) -> bool { self.aborted_inner()