aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/globalscope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r--components/script/dom/globalscope.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index 33458bf2ece..f803d6228b7 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -42,11 +42,11 @@ use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use js::glue::{IsWrapper, UnwrapObject};
use js::jsapi::JSObject;
-use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
+use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal};
use js::jsapi::{HandleObject, Heap};
-use js::jsapi::{JSAutoCompartment, JSContext};
+use js::jsapi::{JSAutoRealm, JSContext};
use js::panic::maybe_resume_unwind;
-use js::rust::wrappers::Evaluate2;
+use js::rust::wrappers::EvaluateUtf8;
use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
use js::rust::{HandleValue, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
@@ -230,7 +230,7 @@ impl GlobalScope {
#[allow(unsafe_code)]
pub unsafe fn from_object(obj: *mut JSObject) -> DomRoot<Self> {
assert!(!obj.is_null());
- let global = GetGlobalForObjectCrossCompartment(obj);
+ let global = GetNonCCWObjectGlobal(obj);
global_scope_from_global(global)
}
@@ -540,19 +540,18 @@ impl GlobalScope {
|| {
let cx = self.get_cx();
let globalhandle = self.reflector().get_jsobject();
- let code: Vec<u16> = code.encode_utf16().collect();
let filename = CString::new(filename).unwrap();
- let _ac = JSAutoCompartment::new(cx, globalhandle.get());
+ let _ac = JSAutoRealm::new(cx, globalhandle.get());
let _aes = AutoEntryScript::new(self);
let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), line_number);
debug!("evaluating Dom string");
let result = unsafe {
- Evaluate2(
+ EvaluateUtf8(
cx,
options.ptr,
- code.as_ptr(),
+ code.as_ptr() as *const _,
code.len() as libc::size_t,
rval,
)