implement Writablestreamdefaultcontroller abortcontroller (#37511)

using abort signal and abortcontroller in
Writablestreamdefaultcontroller

Part of https://github.com/servo/servo/issues/34866

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2025-06-18 08:26:05 -07:00 committed by GitHub
parent 3ee339eb6d
commit fc2135cc02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 63 additions and 119 deletions

View file

@ -35,7 +35,7 @@ impl AbortController {
}
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller>
fn new_with_proto(
pub(crate) fn new_with_proto(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,
@ -52,10 +52,22 @@ impl AbortController {
}
/// <https://dom.spec.whatwg.org/#abortcontroller-signal-abort>
fn signal_abort(&self, cx: JSContext, reason: HandleValue, realm: InRealm, can_gc: CanGc) {
pub(crate) fn signal_abort(
&self,
cx: JSContext,
reason: HandleValue,
realm: InRealm,
can_gc: CanGc,
) {
// signal abort on controllers signal with reason if it is given.
self.signal.signal_abort(cx, reason, realm, can_gc);
}
/// <https://dom.spec.whatwg.org/#abortcontroller-signal>
pub(crate) fn signal(&self) -> DomRoot<AbortSignal> {
// The signal getter steps are to return thiss signal.
self.signal.as_rooted()
}
}
impl AbortControllerMethods<crate::DomTypeHolder> for AbortController {