This commit is contained in:
Kenta Moriuchi 2025-08-21 23:00:00 +09:00
parent c84d7c0c62
commit 08bbcb065b
No known key found for this signature in database
GPG key ID: AC843C584A91BE0C

View file

@ -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()