diff --git a/js/rust/src/ar.rs b/js/rust/src/ar.rs index cfd5e8b82e45..b79bb739f345 100644 --- a/js/rust/src/ar.rs +++ b/js/rust/src/ar.rs @@ -3,19 +3,19 @@ use jsapi::root::*; use std::ptr; #[derive(Debug)] -pub struct AutoCompartment(JSAutoRealmAllowCCW); +pub struct AutoRealm(JSAutoRealmAllowCCW); -impl AutoCompartment { +impl AutoRealm { #[cfg(feature = "debugmozjs")] pub unsafe fn with_obj(cx: *mut JSContext, target: *mut JSObject) - -> AutoCompartment + -> AutoRealm { let mut notifier = mozilla::detail::GuardObjectNotifier { mStatementDone: ptr::null_mut(), }; - AutoCompartment( + AutoRealm( JSAutoRealmAllowCCW::new( cx, target, @@ -25,21 +25,21 @@ impl AutoCompartment { #[cfg(not(feature = "debugmozjs"))] pub unsafe fn with_obj(cx: *mut JSContext, target: *mut JSObject) - -> AutoCompartment + -> AutoRealm { - AutoCompartment(JSAutoRealmAllowCCW::new(cx, target)) + AutoRealm(JSAutoRealmAllowCCW::new(cx, target)) } #[cfg(feature = "debugmozjs")] pub unsafe fn with_script(cx: *mut JSContext, target: *mut JSScript) - -> AutoCompartment + -> AutoRealm { let mut notifier = mozilla::detail::GuardObjectNotifier { mStatementDone: ptr::null_mut(), }; - AutoCompartment( + AutoRealm( JSAutoRealmAllowCCW::new1( cx, target, @@ -49,8 +49,8 @@ impl AutoCompartment { #[cfg(not(feature = "debugmozjs"))] pub unsafe fn with_script(cx: *mut JSContext, target: *mut JSScript) - -> AutoCompartment + -> AutoRealm { - AutoCompartment(JSAutoRealmAllowCCW::new1(cx, target)) + AutoRealm(JSAutoRealmAllowCCW::new1(cx, target)) } } diff --git a/js/rust/src/rust.rs b/js/rust/src/rust.rs index 22c3cc6c04b8..b8ba11e383a1 100644 --- a/js/rust/src/rust.rs +++ b/js/rust/src/rust.rs @@ -4,7 +4,7 @@ //! Rust wrappers around the raw JS apis -use ar::AutoCompartment; +use ar::AutoRealm; use libc::c_uint; use std::cell::{Cell, UnsafeCell}; use std::char; @@ -231,7 +231,7 @@ impl Runtime { }; assert!(!ptr.is_null()); unsafe { - let _ac = AutoCompartment::with_obj(self.cx(), glob.get()); + let _ar = AutoRealm::with_obj(self.cx(), glob.get()); let options = CompileOptionsWrapper::new(self.cx(), filename_cstr.as_ptr(), line_num); let mut srcBuf = JS::SourceBufferHolder { diff --git a/js/rust/tests/callback.rs b/js/rust/tests/callback.rs index 585c06b55007..df4be69ad355 100644 --- a/js/rust/tests/callback.rs +++ b/js/rust/tests/callback.rs @@ -6,7 +6,7 @@ extern crate js; extern crate libc; -use js::ar::AutoCompartment; +use js::ar::AutoRealm; use js::jsapi::root::JS::CallArgs; use js::jsapi::root::JS::RealmOptions; use js::jsapi::root::JSContext; @@ -34,7 +34,7 @@ fn callback() { let global = JS_NewGlobalObject(context, &SIMPLE_GLOBAL_CLASS, ptr::null_mut(), h_option, &c_option); rooted!(in(context) let global_root = global); let global = global_root.handle(); - let _ac = AutoCompartment::with_obj(context, global.get()); + let _ar = AutoRealm::with_obj(context, global.get()); let function = JS_DefineFunction(context, global, b"puts\0".as_ptr() as *const libc::c_char, Some(puts), 1, 0); assert!(!function.is_null()); diff --git a/js/rust/tests/panic.rs b/js/rust/tests/panic.rs index d20417b3fefc..0de0350f4a2d 100644 --- a/js/rust/tests/panic.rs +++ b/js/rust/tests/panic.rs @@ -25,7 +25,7 @@ fn panic() { ptr::null_mut(), h_option, &c_option); rooted!(in(context) let global_root = global); let global = global_root.handle(); - let _ac = js::ar::AutoCompartment::with_obj(context, global.get()); + let _ar = js::ar::AutoRealm::with_obj(context, global.get()); let function = JS_DefineFunction(context, global, b"test\0".as_ptr() as *const _, Some(test), 0, 0); diff --git a/js/rust/tests/rooting.rs b/js/rust/tests/rooting.rs index 3f0dc5838795..90909716a0d6 100644 --- a/js/rust/tests/rooting.rs +++ b/js/rust/tests/rooting.rs @@ -29,7 +29,7 @@ fn rooting() { ptr::null_mut(), h_option, &c_option)); - let _ac = js::ar::AutoCompartment::with_obj(cx, global.get()); + let _ar = js::ar::AutoRealm::with_obj(cx, global.get()); rooted!(in(cx) let prototype_proto = JS::GetRealmObjectPrototype(cx)); rooted!(in(cx) let proto = JS_NewObjectWithUniqueType(cx, &CLASS as *const _, diff --git a/js/rust/tests/runtime.rs b/js/rust/tests/runtime.rs index 157143707f6d..b26bdf460cff 100644 --- a/js/rust/tests/runtime.rs +++ b/js/rust/tests/runtime.rs @@ -24,7 +24,7 @@ fn runtime() { ptr::null_mut(), h_option, &c_option)); - let _ac = js::ar::AutoCompartment::with_obj(cx, global.get()); + let _ar = js::ar::AutoRealm::with_obj(cx, global.get()); rooted!(in(cx) let _object = JS_NewObject(cx, &CLASS as *const _)); } diff --git a/js/rust/tests/typedarray.rs b/js/rust/tests/typedarray.rs index 6da9e6d3277e..fc253988093f 100644 --- a/js/rust/tests/typedarray.rs +++ b/js/rust/tests/typedarray.rs @@ -24,7 +24,7 @@ fn typedarray() { &JS::RealmOptions::default()) ); - let _ac = js::ar::AutoCompartment::with_obj(cx, global.get()); + let _ar = js::ar::AutoRealm::with_obj(cx, global.get()); rooted!(in(cx) let mut rval = UndefinedValue()); assert!(rt.evaluate_script(global.handle(), "new Uint8Array([0, 2, 4])", @@ -82,7 +82,7 @@ fn typedarray_update_panic() { &JS::RealmOptions::default()) ); - let _ac = js::ar::AutoCompartment::with_obj(cx, global.get()); + let _ar = js::ar::AutoRealm::with_obj(cx, global.get()); rooted!(in(cx) let mut rval = ptr::null_mut()); let _ = Uint32Array::create(cx, CreateWith::Slice(&[1, 2, 3, 4, 5]), rval.handle_mut()); typedarray!(in(cx) let mut array: Uint32Array = rval.get()); diff --git a/js/rust/tests/vec_conversion.rs b/js/rust/tests/vec_conversion.rs index 643560b5fbcb..a09b2b6ec0ce 100644 --- a/js/rust/tests/vec_conversion.rs +++ b/js/rust/tests/vec_conversion.rs @@ -5,7 +5,7 @@ #[macro_use] extern crate js; -use js::ar::AutoCompartment; +use js::ar::AutoRealm; use js::conversions::ConversionBehavior; use js::conversions::ConversionResult; use js::conversions::FromJSValConvertible; @@ -42,7 +42,7 @@ fn vec_conversion() { rooted!(in(cx) let global_root = global); let global = global_root.handle(); - let _ac = AutoCompartment::with_obj(cx, global.get()); + let _ar = AutoRealm::with_obj(cx, global.get()); assert!(InitRealmStandardClasses(cx)); rooted!(in(cx) let mut rval = UndefinedValue());