Update to SpiderMonkey 66.

This commit is contained in:
Josh Matthews 2019-05-06 11:38:34 -04:00
parent d0d3401361
commit 4328713f71
31 changed files with 150 additions and 144 deletions

View file

@ -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,
)