script: Make callbacks generic over DOM interfaces. (#35459)

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-02-21 07:17:11 -05:00 committed by GitHub
parent 2b0d2ecc73
commit a433b20259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 141 additions and 97 deletions

View file

@ -77,7 +77,7 @@ pub(crate) enum CommonEventHandler {
}
impl CommonEventHandler {
fn parent(&self) -> &CallbackFunction {
fn parent(&self) -> &CallbackFunction<crate::DomTypeHolder> {
match *self {
CommonEventHandler::EventHandler(ref handler) => &handler.parent,
CommonEventHandler::ErrorEventHandler(ref handler) => &handler.parent,
@ -612,7 +612,7 @@ impl EventTarget {
}
#[allow(unsafe_code)]
pub(crate) fn set_event_handler_common<T: CallbackContainer>(
pub(crate) fn set_event_handler_common<T: CallbackContainer<crate::DomTypeHolder>>(
&self,
ty: &str,
listener: Option<Rc<T>>,
@ -628,7 +628,7 @@ impl EventTarget {
}
#[allow(unsafe_code)]
pub(crate) fn set_error_event_handler<T: CallbackContainer>(
pub(crate) fn set_error_event_handler<T: CallbackContainer<crate::DomTypeHolder>>(
&self,
ty: &str,
listener: Option<Rc<T>>,
@ -644,7 +644,7 @@ impl EventTarget {
}
#[allow(unsafe_code)]
pub(crate) fn set_beforeunload_event_handler<T: CallbackContainer>(
pub(crate) fn set_beforeunload_event_handler<T: CallbackContainer<crate::DomTypeHolder>>(
&self,
ty: &str,
listener: Option<Rc<T>>,
@ -660,7 +660,7 @@ impl EventTarget {
}
#[allow(unsafe_code)]
pub(crate) fn get_event_handler_common<T: CallbackContainer>(
pub(crate) fn get_event_handler_common<T: CallbackContainer<crate::DomTypeHolder>>(
&self,
ty: &str,
can_gc: CanGc,