script: Refer to DOM interfaces with generic types in generated bindings. (#35457)

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-02-21 06:10:00 -05:00 committed by GitHub
parent 14db055d46
commit 1192ae32b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 627 additions and 167 deletions

View file

@ -384,3 +384,22 @@ fn create_native_handler_function(
obj.get()
}
}
/// Operations that must be invoked from the generated bindings.
pub(crate) trait PromiseHelpers<D: crate::DomTypes> {
fn new_resolved(
global: &D::GlobalScope,
cx: SafeJSContext,
value: impl ToJSValConvertible,
) -> Rc<D::Promise>;
}
impl PromiseHelpers<crate::DomTypeHolder> for Promise {
fn new_resolved(
global: &GlobalScope,
cx: SafeJSContext,
value: impl ToJSValConvertible,
) -> Rc<Promise> {
Promise::new_resolved(global, cx, value)
}
}