mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
fix abort controller constructor with rooting of signal
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
9dc8fa36bb
commit
2909ef4a5f
2 changed files with 10 additions and 6 deletions
|
@ -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 this’s 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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue