Make GlobalScope.get_cx a static method.

This commit is contained in:
Josh Matthews 2023-02-16 23:09:50 -05:00
parent 4998c65c42
commit f79e1e327d
39 changed files with 132 additions and 127 deletions

View file

@ -11,9 +11,9 @@ pub struct AlreadyInRealm(());
impl AlreadyInRealm {
#![allow(unsafe_code)]
pub fn assert(global: &GlobalScope) -> AlreadyInRealm {
pub fn assert(_global: &GlobalScope) -> AlreadyInRealm {
unsafe {
assert!(!GetCurrentRealmOrNull(*global.get_cx()).is_null());
assert!(!GetCurrentRealmOrNull(*GlobalScope::get_cx()).is_null());
}
AlreadyInRealm(())
}
@ -44,7 +44,7 @@ impl<'a> InRealm<'a> {
pub fn enter_realm(object: &impl DomObject) -> JSAutoRealm {
JSAutoRealm::new(
*object.global().get_cx(),
*GlobalScope::get_cx(),
object.reflector().get_jsobject().get(),
)
}