mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make generated bindings generic over DOM types (#35169)
* bindings: Start making generated bindings methods generic over DOM trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * bindings: Make binding initialization generic over the DOM types trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * bindings: Start making proxyhandler code generic over DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
8748071329
commit
d5d7b0d34f
6 changed files with 72 additions and 52 deletions
|
@ -3272,3 +3272,15 @@ unsafe fn global_scope_from_global_static(global: *mut JSObject) -> DomRoot<Glob
|
|||
);
|
||||
root_from_object_static(global).unwrap()
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) trait GlobalScopeHelpers<D: crate::DomTypes> {
|
||||
unsafe fn from_context(cx: *mut JSContext, realm: InRealm) -> DomRoot<D::GlobalScope>;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl GlobalScopeHelpers<crate::DomTypeHolder> for GlobalScope {
|
||||
unsafe fn from_context(cx: *mut JSContext, realm: InRealm) -> DomRoot<Self> {
|
||||
GlobalScope::from_context(cx, realm)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue