pub trait GlobalScopeHelpers<D: DomTypes> {
// Required methods
unsafe fn from_context(
cx: *mut RawJSContext,
realm: InRealm<'_>,
) -> DomRoot<D::GlobalScope>;
fn get_cx() -> JSContext;
unsafe fn from_object(obj: *mut JSObject) -> DomRoot<D::GlobalScope>;
fn from_reflector(
reflector: &impl DomObject,
realm: InRealm<'_>,
) -> DomRoot<D::GlobalScope>;
unsafe fn from_object_maybe_wrapped(
obj: *mut JSObject,
cx: *mut RawJSContext,
) -> DomRoot<D::GlobalScope>;
fn origin(&self) -> &MutableOrigin;
fn incumbent() -> Option<DomRoot<D::GlobalScope>>;
fn perform_a_microtask_checkpoint(&self, can_gc: CanGc);
fn get_url(&self) -> ServoUrl;
fn is_secure_context(&self) -> bool;
}
Expand description
Operations that must be invoked from the generated bindings.
Required Methods§
Sourceunsafe fn from_context(
cx: *mut RawJSContext,
realm: InRealm<'_>,
) -> DomRoot<D::GlobalScope>
unsafe fn from_context( cx: *mut RawJSContext, realm: InRealm<'_>, ) -> DomRoot<D::GlobalScope>
§Safety
cx
must point to a valid, non-null RawJSContext.
fn get_cx() -> JSContext
Sourceunsafe fn from_object(obj: *mut JSObject) -> DomRoot<D::GlobalScope>
unsafe fn from_object(obj: *mut JSObject) -> DomRoot<D::GlobalScope>
§Safety
obj
must point to a valid, non-null JSObject.
fn from_reflector( reflector: &impl DomObject, realm: InRealm<'_>, ) -> DomRoot<D::GlobalScope>
Sourceunsafe fn from_object_maybe_wrapped(
obj: *mut JSObject,
cx: *mut RawJSContext,
) -> DomRoot<D::GlobalScope>
unsafe fn from_object_maybe_wrapped( obj: *mut JSObject, cx: *mut RawJSContext, ) -> DomRoot<D::GlobalScope>
§Safety
obj
must point to a valid, non-null JSObject.
cx
must point to a valid, non-null RawJSContext.
fn origin(&self) -> &MutableOrigin
fn incumbent() -> Option<DomRoot<D::GlobalScope>>
fn perform_a_microtask_checkpoint(&self, can_gc: CanGc)
fn get_url(&self) -> ServoUrl
fn is_secure_context(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.