fix abort controller constructor with rooting of signal

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
gterzian 2025-06-06 17:42:02 +07:00
parent 9dc8fa36bb
commit 2909ef4a5f
No known key found for this signature in database
GPG key ID: E290318CF2FC84D3
2 changed files with 10 additions and 6 deletions

View file

@ -24,23 +24,27 @@ pub(crate) struct AbortController {
impl AbortController {
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller>
fn new_inherited() -> AbortController {
// The new AbortController() constructor steps are:
// Let signal be a new AbortSignal object.
fn new_inherited(signal: &AbortSignal) -> AbortController {
// Note: continuation of the constructor steps.
// Set thiss signal to signal.
AbortController {
reflector_: Reflector::new(),
signal: Dom::from_ref(&AbortSignal::new_inherited()),
signal: Dom::from_ref(signal),
}
}
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller>
fn new_with_proto(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,
) -> DomRoot<AbortController> {
// The new AbortController() constructor steps are:
// Let signal be a new AbortSignal object.
let signal = AbortSignal::new_with_proto(global, None, can_gc);
reflect_dom_object_with_proto(
Box::new(AbortController::new_inherited()),
Box::new(AbortController::new_inherited(&signal)),
global,
proto,
can_gc,

View file

@ -60,7 +60,7 @@ impl AbortSignal {
}
#[allow(dead_code)]
fn new_with_proto(
pub(crate) fn new_with_proto(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,