mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +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
|
@ -3331,9 +3331,23 @@ unsafe fn global_scope_from_global_static(global: *mut JSObject) -> DomRoot<Glob
|
|||
root_from_object_static(global).unwrap()
|
||||
}
|
||||
|
||||
/// Operations that must be invoked from the generated bindings.
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) trait GlobalScopeHelpers<D: crate::DomTypes> {
|
||||
unsafe fn from_context(cx: *mut JSContext, realm: InRealm) -> DomRoot<D::GlobalScope>;
|
||||
fn get_cx() -> SafeJSContext;
|
||||
unsafe fn from_object(obj: *mut JSObject) -> DomRoot<D::GlobalScope>;
|
||||
fn from_reflector(
|
||||
reflector: &impl DomObject,
|
||||
realm: &AlreadyInRealm,
|
||||
) -> DomRoot<D::GlobalScope>;
|
||||
|
||||
unsafe fn from_object_maybe_wrapped(
|
||||
obj: *mut JSObject,
|
||||
cx: *mut JSContext,
|
||||
) -> DomRoot<D::GlobalScope>;
|
||||
|
||||
fn origin(&self) -> &MutableOrigin;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -3341,4 +3355,24 @@ impl GlobalScopeHelpers<crate::DomTypeHolder> for GlobalScope {
|
|||
unsafe fn from_context(cx: *mut JSContext, realm: InRealm) -> DomRoot<Self> {
|
||||
GlobalScope::from_context(cx, realm)
|
||||
}
|
||||
|
||||
fn get_cx() -> SafeJSContext {
|
||||
GlobalScope::get_cx()
|
||||
}
|
||||
|
||||
unsafe fn from_object(obj: *mut JSObject) -> DomRoot<Self> {
|
||||
GlobalScope::from_object(obj)
|
||||
}
|
||||
|
||||
fn from_reflector(reflector: &impl DomObject, realm: &AlreadyInRealm) -> DomRoot<Self> {
|
||||
GlobalScope::from_reflector(reflector, realm)
|
||||
}
|
||||
|
||||
unsafe fn from_object_maybe_wrapped(obj: *mut JSObject, cx: *mut JSContext) -> DomRoot<Self> {
|
||||
GlobalScope::from_object_maybe_wrapped(obj, cx)
|
||||
}
|
||||
|
||||
fn origin(&self) -> &MutableOrigin {
|
||||
GlobalScope::origin(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue