mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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:
parent
14db055d46
commit
1192ae32b0
20 changed files with 627 additions and 167 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue