Revert "script: implement AbortController (#31361)" (#32243)

This reverts commit 7fce850cff.
This commit is contained in:
Samson 2024-05-07 08:23:14 +02:00 committed by GitHub
parent 45f2433d76
commit 8bc49299c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 1193 additions and 517 deletions

View file

@ -23,7 +23,6 @@ use servo_atoms::Atom;
use servo_url::ServoUrl;
use super::bindings::trace::HashMapTracedValues;
use crate::dom::abortsignal::AbortAlgorithm;
use crate::dom::beforeunloadevent::BeforeUnloadEvent;
use crate::dom::bindings::callback::{CallbackContainer, CallbackFunction, ExceptionHandling};
use crate::dom::bindings::cell::DomRefCell;
@ -705,7 +704,7 @@ impl EventTarget {
None => return,
};
let mut handlers = self.handlers.borrow_mut();
let entry = match handlers.entry(Atom::from(ty.clone())) {
let entry = match handlers.entry(Atom::from(ty)) {
Occupied(entry) => entry.into_mut(),
Vacant(entry) => entry.insert(EventListeners(vec![])),
};
@ -717,20 +716,12 @@ impl EventTarget {
};
let new_entry = EventListenerEntry {
phase,
listener: EventListenerType::Additive(Rc::clone(&listener)),
listener: EventListenerType::Additive(listener),
once: options.once,
};
if !entry.contains(&new_entry) {
entry.push(new_entry);
}
if let Some(signal) = options.signal {
signal.add_abort_algorithm(AbortAlgorithm::RemoveEventListener(
DomRoot::from_ref(&self),
ty,
listener,
options.parent,
));
};
}
// https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
@ -810,7 +801,6 @@ impl From<AddEventListenerOptionsOrBoolean> for AddEventListenerOptions {
AddEventListenerOptionsOrBoolean::Boolean(capture) => Self {
parent: EventListenerOptions { capture },
once: false,
signal: None,
},
}
}