Update SpiderMonkey bindings for Windows arm64 crash fix.

This commit is contained in:
Josh Matthews 2019-07-25 12:12:33 -04:00
parent c9dde3a4bb
commit 410d5bc772
3 changed files with 28 additions and 22 deletions

9
Cargo.lock generated
View file

@ -2886,25 +2886,26 @@ dependencies = [
[[package]] [[package]]
name = "mozjs" name = "mozjs"
version = "0.12.0" version = "0.12.0"
source = "git+https://github.com/servo/rust-mozjs#124e5243a02ddaa879f2988313cee738c435f8b1" source = "git+https://github.com/servo/rust-mozjs#07eec81ec4b6a81663acf29d567807eaf2a558a8"
dependencies = [ dependencies = [
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=b2f83932fe9d361face14efd03f2465b9262e687)", "mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=6dff1046a0d5e486f841d1b858da7b2ef33d801b)",
"num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "mozjs_sys" name = "mozjs_sys"
version = "0.67.0" version = "0.67.0"
source = "git+https://github.com/servo/mozjs?rev=b2f83932fe9d361face14efd03f2465b9262e687#b2f83932fe9d361face14efd03f2465b9262e687" source = "git+https://github.com/servo/mozjs?rev=6dff1046a0d5e486f841d1b858da7b2ef33d801b#6dff1046a0d5e486f841d1b858da7b2ef33d801b"
dependencies = [ dependencies = [
"bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)", "bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -5941,7 +5942,7 @@ dependencies = [
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f" "checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
"checksum mozangle 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c16c861307809350d6ebf120bb43fa081ddde85c32b1a8c205c7a2287ada24e7" "checksum mozangle 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c16c861307809350d6ebf120bb43fa081ddde85c32b1a8c205c7a2287ada24e7"
"checksum mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)" = "<none>" "checksum mozjs 0.12.0 (git+https://github.com/servo/rust-mozjs)" = "<none>"
"checksum mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=b2f83932fe9d361face14efd03f2465b9262e687)" = "<none>" "checksum mozjs_sys 0.67.0 (git+https://github.com/servo/mozjs?rev=6dff1046a0d5e486f841d1b858da7b2ef33d801b)" = "<none>"
"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
"checksum muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "451a9a05d2a32c566c897835e0ea95cf79ed2fdfe957924045a1721a36c9980f" "checksum muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "451a9a05d2a32c566c897835e0ea95cf79ed2fdfe957924045a1721a36c9980f"
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"

View file

@ -3036,8 +3036,9 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
if aliasedMembers: if aliasedMembers:
def defineAlias(alias): def defineAlias(alias):
if alias == "@@iterator": if alias == "@@iterator":
symbolJSID = "RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(*cx, SymbolCode::iterator))" symbolJSID = "RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(*cx, SymbolCode::iterator), \
getSymbolJSID = CGGeneric(fill("rooted!(in(*cx) let iteratorId = ${symbolJSID});", iteratorId.handle_mut())"
getSymbolJSID = CGGeneric(fill("rooted!(in(*cx) let mut iteratorId: jsid);\n${symbolJSID};\n",
symbolJSID=symbolJSID)) symbolJSID=symbolJSID))
defineFn = "JS_DefinePropertyById2" defineFn = "JS_DefinePropertyById2"
prop = "iteratorId.handle()" prop = "iteratorId.handle()"
@ -5197,8 +5198,9 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
body += dedent( body += dedent(
""" """
for i in 0..(*unwrapped_proxy).Length() { for i in 0..(*unwrapped_proxy).Length() {
rooted!(in(*cx) let rooted_jsid = int_to_jsid(i as i32)); rooted!(in(*cx) let mut rooted_jsid: jsid);
AppendToAutoIdVector(props, rooted_jsid.handle().get()); int_to_jsid(i as i32, rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle());
} }
""") """)
@ -5209,9 +5211,9 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
let cstring = CString::new(name).unwrap(); let cstring = CString::new(name).unwrap();
let jsstring = JS_AtomizeAndPinString(*cx, cstring.as_ptr()); let jsstring = JS_AtomizeAndPinString(*cx, cstring.as_ptr());
rooted!(in(*cx) let rooted = jsstring); rooted!(in(*cx) let rooted = jsstring);
let jsid = INTERNED_STRING_TO_JSID(*cx, rooted.handle().get()); rooted!(in(*cx) let mut rooted_jsid: jsid);
rooted!(in(*cx) let rooted_jsid = jsid); RUST_INTERNED_STRING_TO_JSID(*cx, rooted.handle().get(), rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle().get()); AppendToAutoIdVector(props, rooted_jsid.handle());
} }
""") """)
@ -5254,8 +5256,9 @@ class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod):
body += dedent( body += dedent(
""" """
for i in 0..(*unwrapped_proxy).Length() { for i in 0..(*unwrapped_proxy).Length() {
rooted!(in(*cx) let rooted_jsid = int_to_jsid(i as i32)); rooted!(in(*cx) let mut rooted_jsid: jsid);
AppendToAutoIdVector(props, rooted_jsid.handle().get()); int_to_jsid(i as i32, rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle());
} }
""") """)
@ -5800,7 +5803,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsapi::HandleValue as RawHandleValue', 'js::jsapi::HandleValue as RawHandleValue',
'js::jsapi::HandleValueArray', 'js::jsapi::HandleValueArray',
'js::jsapi::Heap', 'js::jsapi::Heap',
'js::jsapi::INTERNED_STRING_TO_JSID', 'js::rust::wrappers::RUST_INTERNED_STRING_TO_JSID',
'js::jsapi::IsCallable', 'js::jsapi::IsCallable',
'js::jsapi::JSAutoRealm', 'js::jsapi::JSAutoRealm',
'js::jsapi::JSCLASS_FOREGROUND_FINALIZE', 'js::jsapi::JSCLASS_FOREGROUND_FINALIZE',
@ -5884,7 +5887,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsval::PrivateValue', 'js::jsval::PrivateValue',
'js::jsval::UndefinedValue', 'js::jsval::UndefinedValue',
'js::jsapi::UndefinedHandleValue', 'js::jsapi::UndefinedHandleValue',
'js::glue::AppendToAutoIdVector', 'js::rust::wrappers::AppendToAutoIdVector',
'js::glue::CallJitGetterOp', 'js::glue::CallJitGetterOp',
'js::glue::CallJitMethodOp', 'js::glue::CallJitMethodOp',
'js::glue::CallJitSetterOp', 'js::glue::CallJitSetterOp',
@ -5895,8 +5898,8 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::glue::ProxyTraps', 'js::glue::ProxyTraps',
'js::glue::RUST_JSID_IS_INT', 'js::glue::RUST_JSID_IS_INT',
'js::glue::RUST_JSID_IS_STRING', 'js::glue::RUST_JSID_IS_STRING',
'js::glue::RUST_SYMBOL_TO_JSID', 'js::rust::wrappers::RUST_SYMBOL_TO_JSID',
'js::glue::int_to_jsid', 'js::rust::wrappers::int_to_jsid',
'js::glue::UnwrapObjectDynamic', 'js::glue::UnwrapObjectDynamic',
'js::panic::maybe_resume_unwind', 'js::panic::maybe_resume_unwind',
'js::panic::wrap_panic', 'js::panic::wrap_panic',

View file

@ -13,10 +13,10 @@ use crate::dom::bindings::utils::{
get_proto_or_iface_array, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT, get_proto_or_iface_array, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT,
}; };
use js::error::throw_type_error; use js::error::throw_type_error;
use js::glue::{UncheckedUnwrapObject, RUST_SYMBOL_TO_JSID}; use js::glue::UncheckedUnwrapObject;
use js::jsapi::HandleObject as RawHandleObject; use js::jsapi::HandleObject as RawHandleObject;
use js::jsapi::MutableHandleValue as RawMutableHandleValue; use js::jsapi::MutableHandleValue as RawMutableHandleValue;
use js::jsapi::{Class, ClassOps, RealmOptions}; use js::jsapi::{jsid, Class, ClassOps};
use js::jsapi::{GetNonCCWObjectGlobal, GetWellKnownSymbol}; use js::jsapi::{GetNonCCWObjectGlobal, GetWellKnownSymbol};
use js::jsapi::{JSAutoRealm, JSClass, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR}; use js::jsapi::{JSAutoRealm, JSClass, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR};
use js::jsapi::{JSPropertySpec, JSString, JSTracer, JS_AtomizeAndPinString}; use js::jsapi::{JSPropertySpec, JSString, JSTracer, JS_AtomizeAndPinString};
@ -27,12 +27,13 @@ use js::jsapi::{ObjectOps, OnNewGlobalHookOption, SymbolCode};
use js::jsapi::{TrueHandleValue, Value}; use js::jsapi::{TrueHandleValue, Value};
use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING}; use js::jsapi::{JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING};
use js::jsval::{JSVal, PrivateValue}; use js::jsval::{JSVal, PrivateValue};
use js::rust::wrappers::RUST_SYMBOL_TO_JSID;
use js::rust::wrappers::{JS_DefineProperty, JS_DefineProperty5}; use js::rust::wrappers::{JS_DefineProperty, JS_DefineProperty5};
use js::rust::wrappers::{JS_DefineProperty3, JS_DefineProperty4, JS_DefinePropertyById5}; use js::rust::wrappers::{JS_DefineProperty3, JS_DefineProperty4, JS_DefinePropertyById5};
use js::rust::wrappers::{JS_FireOnNewGlobalObject, JS_GetPrototype}; use js::rust::wrappers::{JS_FireOnNewGlobalObject, JS_GetPrototype};
use js::rust::wrappers::{JS_LinkConstructorAndPrototype, JS_NewObjectWithUniqueType}; use js::rust::wrappers::{JS_LinkConstructorAndPrototype, JS_NewObjectWithUniqueType};
use js::rust::{define_methods, define_properties, get_object_class}; use js::rust::{define_methods, define_properties, get_object_class};
use js::rust::{HandleObject, HandleValue, MutableHandleObject}; use js::rust::{HandleObject, HandleValue, MutableHandleObject, RealmOptions};
use std::convert::TryFrom; use std::convert::TryFrom;
use std::ptr; use std::ptr;
@ -145,7 +146,7 @@ pub unsafe fn create_global_object(
class, class,
ptr::null_mut(), ptr::null_mut(),
OnNewGlobalHookOption::DontFireOnNewGlobalHook, OnNewGlobalHookOption::DontFireOnNewGlobalHook,
&options, &*options,
)); ));
assert!(!rval.is_null()); assert!(!rval.is_null());
@ -208,7 +209,8 @@ pub unsafe fn create_interface_prototype_object(
let unscopable_symbol = GetWellKnownSymbol(cx, SymbolCode::unscopables); let unscopable_symbol = GetWellKnownSymbol(cx, SymbolCode::unscopables);
assert!(!unscopable_symbol.is_null()); assert!(!unscopable_symbol.is_null());
rooted!(in(cx) let unscopable_id = RUST_SYMBOL_TO_JSID(unscopable_symbol)); rooted!(in(cx) let mut unscopable_id: jsid);
RUST_SYMBOL_TO_JSID(unscopable_symbol, unscopable_id.handle_mut());
assert!(JS_DefinePropertyById5( assert!(JS_DefinePropertyById5(
cx, cx,
rval.handle(), rval.handle(),