Update SpiderMonkey

This commit is contained in:
Anthony Ramine 2020-03-02 11:16:46 +01:00
parent 813be91926
commit 5a4f8cf93f
34 changed files with 279 additions and 230 deletions

99
Cargo.lock generated
View file

@ -17,9 +17,9 @@ checksum = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
[[package]]
name = "aho-corasick"
version = "0.7.3"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
checksum = "d5e63fd144e18ba274ae7095c0197a870a7b9468abc801dd62f190d80817d2ec"
dependencies = [
"memchr",
]
@ -257,9 +257,9 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.51.1"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75"
checksum = "99de13bb6361e01e493b3db7928085dcc474b7ba4f5481818e53a89d76b8393f"
dependencies = [
"bitflags",
"cexpr",
@ -268,6 +268,7 @@ dependencies = [
"clap",
"env_logger",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2 1.0.1",
@ -572,9 +573,9 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.3.3"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b"
checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
dependencies = [
"nom",
]
@ -1342,10 +1343,28 @@ dependencies = [
]
[[package]]
name = "encoding_rs"
version = "0.8.12"
name = "encoding_c"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca20350a7cb5aab5b9034731123d6d412caf3e92d4985e739e411ba0955fd0eb"
checksum = "1891d977f814fd638c3b964987778665b5d1dc8690f46c4c7adc91466ad1c78a"
dependencies = [
"encoding_rs",
]
[[package]]
name = "encoding_c_mem"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d32d28c32ff61236b8ea2678c6e43e63bf9690122cb53e9eca7dcefcc4ccb0c"
dependencies = [
"encoding_rs",
]
[[package]]
name = "encoding_rs"
version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28"
dependencies = [
"cfg-if",
]
@ -1415,9 +1434,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.6.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime",
@ -2556,9 +2575,9 @@ checksum = "7b6288d7db100340ca12873fd4d08ad1b8f206a9457798dfb17c018a33fee540"
[[package]]
name = "humantime"
version = "1.1.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
@ -3237,9 +3256,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.6"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
dependencies = [
"cfg-if",
]
@ -3395,9 +3414,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.2.0"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "memmap"
@ -3573,8 +3592,8 @@ dependencies = [
[[package]]
name = "mozjs"
version = "0.12.1"
source = "git+https://github.com/servo/rust-mozjs#9b0d063ba062f4cc60c3bab9250218d6935d647b"
version = "0.13.0"
source = "git+https://github.com/servo/rust-mozjs?branch=smup#a09ebb19ee0f1b7d20716b60b19c590fa28a9e1b"
dependencies = [
"cc",
"lazy_static",
@ -3586,11 +3605,13 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.67.1"
source = "git+https://github.com/servo/mozjs?rev=59065889ec7726b767d70b8702b43b4e4776cbfe#59065889ec7726b767d70b8702b43b4e4776cbfe"
version = "0.68.0"
source = "git+https://github.com/servo/mozjs?rev=aabcc9ba889b2755f1e4e83f28323a60415a790f#aabcc9ba889b2755f1e4e83f28323a60415a790f"
dependencies = [
"bindgen",
"cc",
"encoding_c",
"encoding_c_mem",
"libc",
"libz-sys",
"walkdir",
@ -4470,25 +4491,21 @@ checksum = "825740057197b7d43025e7faf6477eaabc03434e153233da02d1f44602f71527"
[[package]]
name = "regex"
version = "1.1.6"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58"
checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
"utf8-ranges",
]
[[package]]
name = "regex-syntax"
version = "0.6.6"
version = "0.6.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96"
dependencies = [
"ucd-util",
]
checksum = "1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1"
[[package]]
name = "relevant"
@ -4565,9 +4582,9 @@ dependencies = [
[[package]]
name = "rust-webvr"
version = "0.18.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "593fdfff23790ead23b7921b9b69cdfdb69ce7374dc8363f011c02a4cc7c7e14"
checksum = "a965d7b934fef625349e5f21774046da180000911140898235576a91dfbbe633"
dependencies = [
"bindgen",
"euclid",
@ -5882,9 +5899,9 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thread_local"
version = "0.3.6"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [
"lazy_static",
]
@ -6195,12 +6212,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4fa6e588762366f1eb4991ce59ad1b93651d0b769dfb4e4d1c5c4b943d1159"
[[package]]
name = "ucd-util"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
[[package]]
name = "uluru"
version = "0.4.0"
@ -6311,12 +6322,6 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
[[package]]
name = "utf8-ranges"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
[[package]]
name = "uuid"
version = "0.8.0"
@ -6643,7 +6648,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#720a479bc21ff123569c26a47a5eb7c7cfa07fd6"
source = "git+https://github.com/servo/webxr#a1afba096c9797c3663727de58f54eae898f3050"
dependencies = [
"bindgen",
"euclid",
@ -6664,7 +6669,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#720a479bc21ff123569c26a47a5eb7c7cfa07fd6"
source = "git+https://github.com/servo/webxr#a1afba096c9797c3663727de58f54eae898f3050"
dependencies = [
"euclid",
"ipc-channel",

View file

@ -31,7 +31,7 @@ net_traits = {path = "../net_traits"}
num-traits = "0.2"
pixels = {path = "../pixels", optional = true}
profile_traits = {path = "../profile_traits"}
rust-webvr = {version = "0.18", features = ["mock", "openvr", "vrexternal"]}
rust-webvr = {version = "0.19", features = ["mock", "openvr", "vrexternal"]}
script_traits = {path = "../script_traits"}
servo_geometry = {path = "../geometry"}
servo-media = {git = "https://github.com/servo/media"}

View file

@ -385,7 +385,6 @@ mod gen {
level: i64,
},
},
high_water_mark: i64,
max: i64,
},
native_regex: {

View file

@ -63,7 +63,7 @@ indexmap = "1.0.2"
ipc-channel = "0.14"
itertools = "0.8"
jstraceable_derive = {path = "../jstraceable_derive"}
js = {package = "mozjs", git = "https://github.com/servo/rust-mozjs"}
js = {package = "mozjs", git = "https://github.com/servo/rust-mozjs", branch = "smup"}
keyboard-types = "0.4.4"
lazy_static = "1"
libc = "0.2"

View file

@ -1654,7 +1654,7 @@ class MethodDefiner(PropertyDefiner):
if any(m.isGetter() and m.isIndexed() for m in methods):
self.regular.append({"name": '@@iterator',
"methodInfo": False,
"selfHostedName": "ArrayValues",
"selfHostedName": "$ArrayValues",
"length": 0,
"flags": "0", # Not enumerable, per spec.
"condition": "Condition::Satisfied"})
@ -1678,7 +1678,7 @@ class MethodDefiner(PropertyDefiner):
self.regular.append({
"name": "values",
"methodInfo": False,
"selfHostedName": "ArrayValues",
"selfHostedName": "$ArrayValues",
"length": 0,
"flags": "JSPROP_ENUMERATE",
"condition": PropertyDefiner.getControllingCondition(m,
@ -1731,7 +1731,7 @@ class MethodDefiner(PropertyDefiner):
selfHostedName = '%s as *const u8 as *const libc::c_char' % str_to_const_array(m["selfHostedName"])
assert not m.get("methodInfo", True)
accessor = "None"
jitinfo = "0 as *const JSJitInfo"
jitinfo = "ptr::null()"
else:
selfHostedName = "0 as *const libc::c_char"
if m.get("methodInfo", True):
@ -1743,28 +1743,30 @@ class MethodDefiner(PropertyDefiner):
jitinfo = "&%s_methodinfo as *const _ as *const JSJitInfo" % identifier
accessor = "Some(generic_method)"
else:
jitinfo = "0 as *const JSJitInfo"
jitinfo = "ptr::null()"
accessor = 'Some(%s)' % m.get("nativeName", m["name"])
if m["name"].startswith("@@"):
return ('(SymbolCode::%s as i32 + 1)'
% m["name"][2:], accessor, jitinfo, m["length"], flags, selfHostedName)
return (str_to_const_array(m["name"]), accessor, jitinfo, m["length"], flags, selfHostedName)
name = 'JSPropertySpec_Name { symbol_: SymbolCode::%s as usize + 1 }' % m["name"][2:]
else:
name = ('JSPropertySpec_Name { string_: %s as *const u8 as *const libc::c_char }'
% str_to_const_array(m["name"]))
return (name, accessor, jitinfo, m["length"], flags, selfHostedName)
return self.generateGuardedArray(
array, name,
' JSFunctionSpec {\n'
' name: %s as *const u8 as *const libc::c_char,\n'
' name: %s,\n'
' call: JSNativeWrapper { op: %s, info: %s },\n'
' nargs: %s,\n'
' flags: (%s) as u16,\n'
' selfHostedName: %s\n'
' }',
' JSFunctionSpec {\n'
' name: 0 as *const libc::c_char,\n'
' call: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },\n'
' name: JSPropertySpec_Name { string_: ptr::null() },\n'
' call: JSNativeWrapper { op: None, info: ptr::null() },\n'
' nargs: 0,\n'
' flags: 0,\n'
' selfHostedName: 0 as *const libc::c_char\n'
' selfHostedName: ptr::null()\n'
' }',
'JSFunctionSpec',
condition, specData)
@ -1834,14 +1836,14 @@ class AttrDefiner(PropertyDefiner):
return self.generateGuardedArray(
array, name,
' JSPropertySpec {\n'
' name: %s as *const u8 as *const libc::c_char,\n'
' name: JSPropertySpec_Name { string_: %s as *const u8 as *const libc::c_char },\n'
' flags: (%s) as u8,\n'
' __bindgen_anon_1: JSPropertySpec__bindgen_ty_1 {\n'
' accessors: JSPropertySpec__bindgen_ty_1__bindgen_ty_1 {\n'
' getter: JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {\n'
' u: JSPropertySpec_AccessorsOrValue {\n'
' accessors: JSPropertySpec_AccessorsOrValue_Accessors {\n'
' getter: JSPropertySpec_Accessor {\n'
' native: %s,\n'
' },\n'
' setter: JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_2 {\n'
' setter: JSPropertySpec_Accessor {\n'
' native: %s,\n'
' }\n'
' }\n'
@ -2203,7 +2205,9 @@ static Class: DOMJSClass = DOMJSClass {
(((%(slots)s) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
/* JSCLASS_HAS_RESERVED_SLOTS(%(slots)s) */,
cOps: &CLASS_OPS,
reserved: [0 as *mut _; 3],
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: %(domClass)s
};
@ -2274,7 +2278,9 @@ static PrototypeClass: JSClass = JSClass {
// JSCLASS_HAS_RESERVED_SLOTS(%(slotCount)s)
(%(slotCount)s & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
reserved: [0 as *mut os::raw::c_void; 3]
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
""" % {'name': name, 'slotCount': slotCount}
@ -2916,9 +2922,9 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
Generate the CollectJSONAttributes method for an interface descriptor
"""
def __init__(self, descriptor, toJSONMethod):
args = [Argument('SafeJSContext', 'cx'),
Argument('HandleObject', 'obj'),
Argument('*const %s' % descriptor.concreteType, 'this'),
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', 'obj'),
Argument('*mut libc::c_void', 'this'),
Argument('&RootedGuard<*mut JSObject>', 'result')]
CGAbstractMethod.__init__(self, descriptor, 'CollectJSONAttributes',
'bool', args, pub=True, unsafe=True)
@ -2932,11 +2938,11 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
name = m.identifier.name
ret += fill(
"""
rooted!(in(*cx) let mut temp = UndefinedValue());
rooted!(in(cx) let mut temp = UndefinedValue());
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
return false;
}
if !JS_DefineProperty(*cx, result.handle().into(),
if !JS_DefineProperty(cx, result.handle().into(),
${nameAsArray} as *const u8 as *const libc::c_char,
temp.handle(), JSPROP_ENUMERATE as u32) {
return false;
@ -3668,8 +3674,9 @@ class CGSpecializedMethod(CGAbstractExternMethod):
def __init__(self, descriptor, method):
self.method = method
name = method.identifier.name
args = [Argument('SafeJSContext', 'cx'), Argument('HandleObject', '_obj'),
Argument('*const %s' % descriptor.concreteType, 'this'),
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', '_obj'),
Argument('*mut libc::c_void', 'this'),
Argument('*const JSJitMethodCallArgs', 'args')]
CGAbstractExternMethod.__init__(self, descriptor, name, 'bool', args)
@ -3678,7 +3685,8 @@ class CGSpecializedMethod(CGAbstractExternMethod):
self.method)
return CGWrapper(CGMethodCall([], nativeName, self.method.isStatic(),
self.descriptor, self.method),
pre="let this = &*this;\n"
pre="let cx = SafeJSContext::from_ptr(cx);\n" +
("let this = &*(this as *const %s);\n" % self.descriptor.concreteType) +
"let args = &*args;\n"
"let argc = args.argc_;\n")
@ -3701,7 +3709,7 @@ class CGDefaultToJSONMethod(CGSpecializedMethod):
def definition_body(self):
ret = dedent("""
use crate::dom::bindings::inheritance::HasParent;
rooted!(in(*cx) let result = JS_NewPlainObject(*cx));
rooted!(in(cx) let result = JS_NewPlainObject(cx));
if result.is_null() {
return false;
}
@ -3717,17 +3725,16 @@ class CGDefaultToJSONMethod(CGSpecializedMethod):
parents = len(jsonDescriptors) - 1
form = """
if !${parentclass}CollectJSONAttributes(cx, _obj, this${asparent}, &result) {
if !${parentclass}CollectJSONAttributes(cx, _obj, this, &result) {
return false;
}
"""
# Iterate the array in reverse: oldest ancestor first
for descriptor in jsonDescriptors[:0:-1]:
ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::",
asparent=".as_ref().unwrap()" + ".as_parent()" * parents)
ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::")
parents -= 1
ret += fill(form, parentclass="", asparent="")
ret += fill(form, parentclass="")
ret += ('(*args).rval().set(ObjectValue(*result));\n'
'return true;\n')
return CGGeneric(ret)
@ -3759,9 +3766,9 @@ class CGSpecializedGetter(CGAbstractExternMethod):
def __init__(self, descriptor, attr):
self.attr = attr
name = 'get_' + descriptor.internalNameFor(attr.identifier.name)
args = [Argument('SafeJSContext', 'cx'),
Argument('HandleObject', '_obj'),
Argument('*const %s' % descriptor.concreteType, 'this'),
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', '_obj'),
Argument('*mut libc::c_void', 'this'),
Argument('JSJitGetterCallArgs', 'args')]
CGAbstractExternMethod.__init__(self, descriptor, name, "bool", args)
@ -3771,7 +3778,8 @@ class CGSpecializedGetter(CGAbstractExternMethod):
return CGWrapper(CGGetterCall([], self.attr.type, nativeName,
self.descriptor, self.attr),
pre="let this = &*this;\n")
pre="let cx = SafeJSContext::from_ptr(cx);\n" +
("let this = &*(this as *const %s);\n" % self.descriptor.concreteType))
@staticmethod
def makeNativeName(descriptor, attr):
@ -3815,9 +3823,9 @@ class CGSpecializedSetter(CGAbstractExternMethod):
def __init__(self, descriptor, attr):
self.attr = attr
name = 'set_' + descriptor.internalNameFor(attr.identifier.name)
args = [Argument('SafeJSContext', 'cx'),
Argument('HandleObject', 'obj'),
Argument('*const %s' % descriptor.concreteType, 'this'),
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', 'obj'),
Argument('*mut libc::c_void', 'this'),
Argument('JSJitSetterCallArgs', 'args')]
CGAbstractExternMethod.__init__(self, descriptor, name, "bool", args)
@ -3826,7 +3834,8 @@ class CGSpecializedSetter(CGAbstractExternMethod):
self.attr)
return CGWrapper(CGSetterCall([], self.attr.type, nativeName,
self.descriptor, self.attr),
pre="let this = &*this;\n")
pre="let cx = SafeJSContext::from_ptr(cx);\n" +
("let this = &*(this as *const %s);\n" % self.descriptor.concreteType))
@staticmethod
def makeNativeName(descriptor, attr):
@ -3875,8 +3884,9 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter):
assert all(ord(c) < 128 for c in attrName)
assert all(ord(c) < 128 for c in forwardToAttrName)
return CGGeneric("""\
let cx = SafeJSContext::from_ptr(cx);
rooted!(in(*cx) let mut v = UndefinedValue());
if !JS_GetProperty(*cx, obj, %s as *const u8 as *const libc::c_char, v.handle_mut()) {
if !JS_GetProperty(*cx, HandleObject::from_raw(obj), %s as *const u8 as *const libc::c_char, v.handle_mut()) {
return false;
}
if !v.is_object() {
@ -3901,7 +3911,7 @@ class CGSpecializedReplaceableSetter(CGSpecializedSetter):
# JS_DefineProperty can only deal with ASCII.
assert all(ord(c) < 128 for c in name)
return CGGeneric("""\
JS_DefineProperty(*cx, obj, %s as *const u8 as *const libc::c_char,
JS_DefineProperty(cx, HandleObject::from_raw(obj), %s as *const u8 as *const libc::c_char,
HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE as u32)""" % name)
@ -3931,27 +3941,34 @@ class CGMemberJITInfo(CGThing):
initializer = fill(
"""
JSJitInfo {
call: ${opName} as *const os::raw::c_void,
protoID: PrototypeList::ID::${name} as u16,
depth: ${depth},
_bitfield_1: new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::${opType} as u8,
JSJitInfo_AliasSet::${aliasSet} as u8,
JSValueType::${returnType} as u8,
${isInfallible},
${isMovable},
${isEliminatable},
${isAlwaysInSlot},
${isLazilyCachedInSlot},
${isTypedMethod},
${slotIndex},
),
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
${opKind}: Some(${opName})
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::${name} as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: ${depth} },
_bitfield_1: unsafe {
mem::transmute(new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::${opType} as u8,
JSJitInfo_AliasSet::${aliasSet} as u8,
JSValueType::${returnType} as u8,
${isInfallible},
${isMovable},
${isEliminatable},
${isAlwaysInSlot},
${isLazilyCachedInSlot},
${isTypedMethod},
${slotIndex},
))
},
}
""",
opName=opName,
name=self.descriptor.name,
depth=self.descriptor.interface.inheritanceDepth(),
opType=opType,
opKind=opType.lower(),
aliasSet=aliasSet,
returnType=functools.reduce(CGMemberJITInfo.getSingleReturnType, returnTypes,
""),
@ -4211,7 +4228,7 @@ class CGMemberJITInfo(CGThing):
return "JSJitInfo_ArgType::Object as i32"
if t.isUnion():
u = t.unroll()
type = "JSJitInfo::Null as i32" if u.hasNullableType else ""
type = "JSJitInfo_ArgType::Null as i32" if u.hasNullableType else ""
return functools.reduce(CGMemberJITInfo.getSingleArgType,
u.flatMemberTypes, type)
if t.isDictionary():
@ -5311,7 +5328,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
def __init__(self, descriptor):
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', 'proxy'),
Argument('*mut AutoIdVector', 'props')]
Argument('RawMutableHandleIdVector', 'props')]
CGAbstractExternMethod.__init__(self, descriptor, "own_property_keys", "bool", args)
self.descriptor = descriptor
@ -5328,7 +5345,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
for i in 0..(*unwrapped_proxy).Length() {
rooted!(in(*cx) let mut rooted_jsid: jsid);
int_to_jsid(i as i32, rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle());
AppendToIdVector(props, rooted_jsid.handle());
}
""")
@ -5341,7 +5358,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
rooted!(in(*cx) let rooted = jsstring);
rooted!(in(*cx) let mut rooted_jsid: jsid);
RUST_INTERNED_STRING_TO_JSID(*cx, rooted.handle().get(), rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle());
AppendToIdVector(props, rooted_jsid.handle());
}
""")
@ -5369,7 +5386,7 @@ class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod):
descriptor.interface.getExtendedAttribute("LegacyUnenumerableNamedProperties"))
args = [Argument('*mut JSContext', 'cx'),
Argument('RawHandleObject', 'proxy'),
Argument('*mut AutoIdVector', 'props')]
Argument('RawMutableHandleIdVector', 'props')]
CGAbstractExternMethod.__init__(self, descriptor,
"getOwnEnumerablePropertyKeys", "bool", args)
self.descriptor = descriptor
@ -5387,7 +5404,7 @@ class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod):
for i in 0..(*unwrapped_proxy).Length() {
rooted!(in(*cx) let mut rooted_jsid: jsid);
int_to_jsid(i as i32, rooted_jsid.handle_mut());
AppendToAutoIdVector(props, rooted_jsid.handle());
AppendToIdVector(props, rooted_jsid.handle());
}
""")
@ -5917,11 +5934,9 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::JS_CALLEE',
'js::error::throw_type_error',
'js::error::throw_internal_error',
'js::jsapi::AutoIdVector',
'js::rust::wrappers::Call',
'js::jsapi::CallArgs',
'js::jsapi::CurrentGlobalOrNull',
'js::jsapi::FreeOp',
'js::rust::wrappers::GetPropertyKeys',
'js::jsapi::GetWellKnownSymbol',
'js::rust::Handle',
@ -5948,6 +5963,9 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsapi::JSITER_SYMBOLS',
'js::jsapi::JSJitGetterCallArgs',
'js::jsapi::JSJitInfo',
'js::jsapi::JSJitInfo__bindgen_ty_1',
'js::jsapi::JSJitInfo__bindgen_ty_2',
'js::jsapi::JSJitInfo__bindgen_ty_3',
'js::jsapi::JSJitInfo_AliasSet',
'js::jsapi::JSJitInfo_ArgType',
'js::jsapi::JSJitInfo_OpType',
@ -5960,10 +5978,10 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsapi::JSPROP_PERMANENT',
'js::jsapi::JSPROP_READONLY',
'js::jsapi::JSPropertySpec',
'js::jsapi::JSPropertySpec__bindgen_ty_1',
'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1',
'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1',
'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_2',
'js::jsapi::JSPropertySpec_Accessor',
'js::jsapi::JSPropertySpec_AccessorsOrValue',
'js::jsapi::JSPropertySpec_AccessorsOrValue_Accessors',
'js::jsapi::JSPropertySpec_Name',
'js::jsapi::JSString',
'js::jsapi::JSTracer',
'js::jsapi::JSType',
@ -6005,6 +6023,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsapi::MutableHandleObject as RawMutableHandleObject',
'js::rust::MutableHandleValue',
'js::jsapi::MutableHandleValue as RawMutableHandleValue',
'js::jsapi::MutableHandleIdVector as RawMutableHandleIdVector',
'js::jsapi::ObjectOpResult',
'js::jsapi::PropertyDescriptor',
'js::jsapi::Rooted',
@ -6020,7 +6039,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::jsval::PrivateValue',
'js::jsval::UndefinedValue',
'js::jsapi::UndefinedHandleValue',
'js::rust::wrappers::AppendToAutoIdVector',
'js::rust::wrappers::AppendToIdVector',
'js::glue::CallJitGetterOp',
'js::glue::CallJitMethodOp',
'js::glue::CallJitSetterOp',

View file

@ -19,6 +19,7 @@ use crate::script_runtime::JSContext as SafeJSContext;
#[cfg(feature = "js_backtrace")]
use backtrace::Backtrace;
use js::error::{throw_range_error, throw_type_error};
use js::jsapi::ExceptionStackBehavior;
use js::jsapi::JSContext;
use js::jsapi::JS_ClearPendingException;
use js::jsapi::JS_IsExceptionPending;
@ -161,7 +162,7 @@ pub fn throw_dom_exception(cx: SafeJSContext, global: &GlobalScope, result: Erro
let exception = DOMException::new(global, code);
rooted!(in(*cx) let mut thrown = UndefinedValue());
exception.to_jsval(*cx, thrown.handle_mut());
JS_SetPendingException(*cx, thrown.handle());
JS_SetPendingException(*cx, thrown.handle(), ExceptionStackBehavior::Capture);
}
}

View file

@ -15,8 +15,8 @@ use js::error::throw_type_error;
use js::glue::UncheckedUnwrapObject;
use js::jsapi::GetWellKnownSymbol;
use js::jsapi::HandleObject as RawHandleObject;
use js::jsapi::{jsid, Class, ClassOps};
use js::jsapi::{JSAutoRealm, JSClass, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR};
use js::jsapi::{jsid, JSClass, JSClassOps};
use js::jsapi::{JSAutoRealm, JSContext, JSFunctionSpec, JSObject, JSFUN_CONSTRUCTOR};
use js::jsapi::{JSPropertySpec, JSString, JSTracer, JS_AtomizeAndPinString};
use js::jsapi::{JS_GetFunctionObject, JS_NewFunction, JS_NewGlobalObject};
use js::jsapi::{JS_NewObject, JS_NewPlainObject};
@ -38,8 +38,8 @@ use std::ptr;
/// The class of a non-callback interface object.
#[derive(Clone, Copy)]
pub struct NonCallbackInterfaceObjectClass {
/// The SpiderMonkey Class structure.
pub class: Class,
/// The SpiderMonkey class structure.
pub class: JSClass,
/// The prototype id of that interface, used in the hasInstance hook.
pub proto_id: PrototypeList::ID,
/// The prototype depth of that interface, used in the hasInstance hook.
@ -59,7 +59,7 @@ impl NonCallbackInterfaceObjectClass {
proto_depth: u16,
) -> NonCallbackInterfaceObjectClass {
NonCallbackInterfaceObjectClass {
class: Class {
class: JSClass {
name: b"Function\0" as *const _ as *const libc::c_char,
flags: 0,
cOps: &constructor_behavior.0,
@ -84,12 +84,12 @@ pub type ConstructorClassHook =
unsafe extern "C" fn(cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool;
/// The constructor behavior of a non-callback interface object.
pub struct InterfaceConstructorBehavior(ClassOps);
pub struct InterfaceConstructorBehavior(JSClassOps);
impl InterfaceConstructorBehavior {
/// An interface constructor that unconditionally throws a type error.
pub const fn throw() -> Self {
InterfaceConstructorBehavior(ClassOps {
InterfaceConstructorBehavior(JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
@ -106,7 +106,7 @@ impl InterfaceConstructorBehavior {
/// An interface constructor that calls a native Rust function.
pub const fn call(hook: ConstructorClassHook) -> Self {
InterfaceConstructorBehavior(ClassOps {
InterfaceConstructorBehavior(JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,

View file

@ -9,6 +9,7 @@ use crate::dom::bindings::interface::{create_object, define_on_global_object};
use crate::script_runtime::JSContext;
use js::jsapi::{JSClass, JSFunctionSpec};
use js::rust::{HandleObject, MutableHandleObject};
use std::ptr;
/// The class of a namespace object.
#[derive(Clone, Copy)]
@ -23,7 +24,9 @@ impl NamespaceObjectClass {
name: name as *const _ as *const libc::c_char,
flags: 0,
cOps: 0 as *mut _,
reserved: [0 as *mut _; 3],
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
})
}
}

View file

@ -55,7 +55,11 @@ pub unsafe extern "C" fn shadow_check_callback(
/// Initialize the infrastructure for DOM proxy objects.
pub unsafe fn init() {
SetDOMProxyInformation(GetProxyHandlerFamily(), Some(shadow_check_callback));
SetDOMProxyInformation(
GetProxyHandlerFamily(),
Some(shadow_check_callback),
ptr::null(),
);
}
/// Defines an expando on the given `proxy`.

View file

@ -120,12 +120,12 @@ where
}
rooted!(in(cx) let object = value.to_object());
let ids = IdVector::new(cx);
let mut ids = IdVector::new(cx);
if !GetPropertyKeys(
cx,
object.handle(),
JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS,
ids.get(),
ids.handle_mut(),
) {
return Err(());
}

View file

@ -361,6 +361,9 @@ pub fn read(
JS_STRUCTURED_CLONE_VERSION,
StructuredCloneScope::DifferentProcess,
rval,
CloneDataPolicy {
sharedArrayBuffer_: false,
},
&STRUCTURED_CLONE_CALLBACKS,
sc_holder_ptr as *mut raw::c_void,
);

View file

@ -23,8 +23,9 @@ use js::glue::{
};
use js::jsapi::HandleId as RawHandleId;
use js::jsapi::HandleObject as RawHandleObject;
use js::jsapi::MutableHandleIdVector as RawMutableHandleIdVector;
use js::jsapi::MutableHandleObject as RawMutableHandleObject;
use js::jsapi::{AutoIdVector, CallArgs, DOMCallbacks, GetNonCCWObjectGlobal};
use js::jsapi::{CallArgs, DOMCallbacks, GetNonCCWObjectGlobal};
use js::jsapi::{Heap, JSAutoRealm, JSContext, JS_FreezeObject};
use js::jsapi::{JSJitInfo, JSObject, JSTracer, JSWrapObjectCallbacks};
use js::jsapi::{JS_EnumerateStandardClasses, JS_GetLatin1StringCharsAndLength};
@ -375,7 +376,7 @@ pub unsafe fn trace_global(tracer: *mut JSTracer, obj: *mut JSObject) {
pub unsafe extern "C" fn enumerate_global(
cx: *mut JSContext,
obj: RawHandleObject,
_props: *mut AutoIdVector,
_props: RawMutableHandleIdVector,
_enumerable_only: bool,
) -> bool {
assert!(JS_IsGlobalObject(obj.get()));
@ -439,6 +440,7 @@ unsafe extern "C" fn wrap(
unsafe extern "C" fn pre_wrap(
cx: *mut JSContext,
_scope: RawHandleObject,
_orig_obj: RawHandleObject,
obj: RawHandleObject,
_object_passed_to_wrap: RawHandleObject,
rval: RawMutableHandleObject,
@ -482,7 +484,7 @@ unsafe fn generic_call(
let args = CallArgs::from_vp(vp, argc);
let info = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
let proto_id = (*info).protoID;
let proto_id = (*info).__bindgen_anon_2.protoID;
let thisobj = args.thisv();
if !thisobj.get().is_null_or_undefined() && !thisobj.get().is_object() {
@ -495,7 +497,7 @@ unsafe fn generic_call(
} else {
GetNonCCWObjectGlobal(JS_CALLEE(cx, vp).to_object_or_null())
});
let depth = (*info).depth;
let depth = (*info).__bindgen_anon_3.depth;
let proto_check =
|class: &'static DOMClass| class.interface_chain[depth as usize] as u16 == proto_id;
let this = match private_from_proto_check(obj.get(), cx, proto_check) {
@ -582,7 +584,7 @@ pub unsafe extern "C" fn generic_lenient_setter(
}
unsafe extern "C" fn instance_class_has_proto_at_depth(
clasp: *const js::jsapi::Class,
clasp: *const js::jsapi::JSClass,
proto_id: u32,
depth: u32,
) -> bool {

View file

@ -37,9 +37,9 @@ use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::realms::{enter_realm, InRealm};
use dom_struct::dom_struct;
use fnv::FnvHasher;
use js::jsapi::{JSFunction, JS_GetFunctionObject, SourceText};
use js::jsapi::{JS_GetFunctionObject, SourceText};
use js::rust::wrappers::CompileFunction;
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
use js::rust::{CompileOptionsWrapper, RootedObjectVectorWrapper};
use libc::c_char;
use servo_atoms::Atom;
use servo_url::ServoUrl;
@ -51,7 +51,6 @@ use std::hash::BuildHasherDefault;
use std::marker::PhantomData;
use std::mem;
use std::ops::{Deref, DerefMut};
use std::ptr;
use std::rc::Rc;
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
@ -491,9 +490,10 @@ impl EventTarget {
// source text, we handle parse errors later
// Step 3.8 TODO: settings objects not implemented
let window = document.window();
let _ac = enter_realm(&*window);
// Step 3.9
let window = document.window();
let url_serialized = CString::new(handler.url.to_string()).unwrap();
let name = CString::new(&**ty).unwrap();
@ -517,10 +517,12 @@ impl EventTarget {
};
let cx = window.get_cx();
let options = CompileOptionsWrapper::new(*cx, url_serialized.as_ptr(), handler.line as u32);
let options = unsafe {
CompileOptionsWrapper::new(*cx, url_serialized.as_ptr(), handler.line as u32)
};
// Step 3.9, subsection Scope steps 1-6
let scopechain = AutoObjectVectorWrapper::new(*cx);
let scopechain = RootedObjectVectorWrapper::new(*cx);
if let Some(element) = element {
scopechain.append(document.reflector().get_jsobject().get());
@ -530,12 +532,10 @@ impl EventTarget {
scopechain.append(element.reflector().get_jsobject().get());
}
let _ac = enter_realm(&*window); // TODO 3.8 should replace this
rooted!(in(*cx) let mut handler = ptr::null_mut::<JSFunction>());
let rv = unsafe {
rooted!(in(*cx) let mut handler = unsafe {
CompileFunction(
*cx,
scopechain.ptr,
scopechain.handle(),
options.ptr,
name.as_ptr(),
args.len() as u32,
@ -546,10 +546,9 @@ impl EventTarget {
ownsUnits_: false,
_phantom_0: PhantomData,
},
handler.handle_mut().into(),
)
};
if !rv || handler.get().is_null() {
});
if handler.get().is_null() {
// Step 3.7
unsafe {
let ar = enter_realm(&*self);

View file

@ -65,13 +65,12 @@ use embedder_traits::EmbedderMsg;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use js::glue::{IsWrapper, UnwrapObjectDynamic};
use js::jsapi::JSContext;
use js::jsapi::JSObject;
use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal};
use js::jsapi::{HandleObject, Heap};
use js::jsapi::{JSContext, JSObject, SourceText};
use js::jsval::{JSVal, UndefinedValue};
use js::panic::maybe_resume_unwind;
use js::rust::wrappers::EvaluateUtf8;
use js::rust::wrappers::Evaluate2;
use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime};
use js::rust::{HandleValue, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
@ -98,6 +97,7 @@ use std::cell::{Cell, RefCell, RefMut};
use std::collections::hash_map::Entry;
use std::collections::{HashMap, VecDeque};
use std::ffi::CString;
use std::marker::PhantomData;
use std::mem;
use std::ops::Index;
use std::rc::Rc;
@ -2158,15 +2158,20 @@ impl GlobalScope {
let ar = enter_realm(&*self);
let _aes = AutoEntryScript::new(self);
let options = CompileOptionsWrapper::new(*cx, filename.as_ptr(), line_number);
let options =
unsafe { CompileOptionsWrapper::new(*cx, filename.as_ptr(), line_number) };
debug!("evaluating Dom string");
let result = unsafe {
EvaluateUtf8(
Evaluate2(
*cx,
options.ptr,
code.as_ptr() as *const _,
code.len() as libc::size_t,
&mut SourceText {
units_: code.as_ptr() as *const _,
length_: code.len() as u32,
ownsUnits_: false,
_phantom_0: PhantomData,
},
rval,
)
};

View file

@ -91,7 +91,7 @@ impl Promise {
pub fn new_in_current_realm(global: &GlobalScope, _comp: InRealm) -> Rc<Promise> {
let cx = global.get_cx();
rooted!(in(*cx) let mut obj = ptr::null_mut::<JSObject>());
Promise::create_js_promise(cx, HandleObject::null(), obj.handle_mut());
Promise::create_js_promise(cx, obj.handle_mut());
Promise::new_with_js_promise(obj.handle(), cx)
}
@ -117,7 +117,7 @@ impl Promise {
}
#[allow(unsafe_code)]
fn create_js_promise(cx: SafeJSContext, proto: HandleObject, mut obj: MutableHandleObject) {
fn create_js_promise(cx: SafeJSContext, mut obj: MutableHandleObject) {
unsafe {
let do_nothing_func = JS_NewFunction(
*cx,
@ -129,7 +129,7 @@ impl Promise {
assert!(!do_nothing_func.is_null());
rooted!(in(*cx) let do_nothing_obj = JS_GetFunctionObject(do_nothing_func));
assert!(!do_nothing_obj.is_null());
obj.set(NewPromiseObject(*cx, do_nothing_obj.handle(), proto));
obj.set(NewPromiseObject(*cx, do_nothing_obj.handle()));
assert!(!obj.is_null());
}
}

View file

@ -82,6 +82,7 @@ fn typedarray_elem_size(typeid: Type) -> usize {
Type::Int16 | Type::Uint16 => 2,
Type::Int32 | Type::Uint32 | Type::Float32 => 4,
Type::Int64 | Type::Float64 => 8,
Type::BigInt64 | Type::BigUint64 => 8,
Type::MaxTypedArrayViewType => unreachable!(),
}
}

View file

@ -4,6 +4,7 @@
#![feature(box_into_raw_non_null)]
#![feature(const_fn)]
#![feature(const_transmute)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(inner_deref)]

View file

@ -39,22 +39,24 @@ use encoding_rs::UTF_8;
use hyper_serde::Serde;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::glue::{AppendToAutoObjectVector, CreateAutoObjectVector};
use js::jsapi::Handle as RawHandle;
use js::jsapi::HandleObject;
use js::jsapi::HandleValue as RawHandleValue;
use js::jsapi::{AutoObjectVector, JSAutoRealm, JSObject, JSString};
use js::jsapi::{GetModuleResolveHook, JSRuntime, SetModuleResolveHook};
use js::jsapi::{
CompileModule, ExceptionStackBehavior, GetModuleResolveHook, JSRuntime, SetModuleResolveHook,
};
use js::jsapi::{GetRequestedModules, SetModuleMetadataHook};
use js::jsapi::{GetWaitForAllPromise, ModuleEvaluate, ModuleInstantiate, SourceText};
use js::jsapi::{Heap, JSContext, JS_ClearPendingException, SetModulePrivate};
use js::jsapi::{JSAutoRealm, JSObject, JSString};
use js::jsapi::{SetModuleDynamicImportHook, SetScriptPrivateReferenceHooks};
use js::jsval::{JSVal, PrivateValue, UndefinedValue};
use js::rust::jsapi_wrapped::{CompileModule, JS_GetArrayLength, JS_GetElement};
use js::rust::jsapi_wrapped::{GetRequestedModuleSpecifier, JS_GetPendingException};
use js::rust::jsapi_wrapped::{JS_GetArrayLength, JS_GetElement};
use js::rust::wrappers::JS_SetPendingException;
use js::rust::CompileOptionsWrapper;
use js::rust::IntoHandle;
use js::rust::RootedObjectVectorWrapper;
use js::rust::{Handle, HandleValue};
use mime::Mime;
use net_traits::request::{CredentialsMode, Destination, ParserMetadata};
@ -67,7 +69,6 @@ use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::ffi;
use std::marker::PhantomData;
use std::ptr;
use std::rc::Rc;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
@ -364,19 +365,19 @@ impl ModuleTree {
let _ac = JSAutoRealm::new(*global.get_cx(), *global.reflector().get_jsobject());
let compile_options = CompileOptionsWrapper::new(*global.get_cx(), url_cstr.as_ptr(), 1);
rooted!(in(*global.get_cx()) let mut module_script = ptr::null_mut::<JSObject>());
let compile_options =
unsafe { CompileOptionsWrapper::new(*global.get_cx(), url_cstr.as_ptr(), 1) };
let mut source = get_source_text(&module);
unsafe {
if !CompileModule(
rooted!(in(*global.get_cx()) let mut module_script = CompileModule(
*global.get_cx(),
compile_options.ptr,
&mut source,
&mut module_script.handle_mut(),
) {
));
if module_script.is_null() {
warn!("fail to compile module script of {}", url);
rooted!(in(*global.get_cx()) let mut exception = UndefinedValue());
@ -399,16 +400,16 @@ impl ModuleTree {
module_script.get(),
&PrivateValue(Box::into_raw(module_script_data) as *const _),
);
debug!("module script of {} compile done", url);
self.resolve_requested_module_specifiers(
&global,
module_script.handle().into_handle(),
url.clone(),
)
.map(|_| ModuleObject(Heap::boxed(*module_script)))
}
debug!("module script of {} compile done", url);
self.resolve_requested_module_specifiers(
&global,
module_script.handle().into_handle(),
url.clone(),
)
.map(|_| ModuleObject(Heap::boxed(*module_script)))
}
#[allow(unsafe_code)]
@ -477,7 +478,11 @@ impl ModuleTree {
if let Some(exception) = &*module_error {
unsafe {
let ar = enter_realm(&*global);
JS_SetPendingException(*global.get_cx(), exception.handle());
JS_SetPendingException(
*global.get_cx(),
exception.handle(),
ExceptionStackBehavior::Capture,
);
report_pending_exception(*global.get_cx(), true, InRealm::Entered(&ar));
}
}
@ -1338,16 +1343,16 @@ fn fetch_module_descendants_and_link(
AlreadyInRealm::assert(&*global);
let _ais = AutoIncumbentScript::new(&*global);
let abv = CreateAutoObjectVector(*global.get_cx());
let abv = RootedObjectVectorWrapper::new(*global.get_cx());
for descendant in descendants {
assert!(AppendToAutoObjectVector(
abv as *mut AutoObjectVector,
descendant.promise_obj().get()
));
assert!(abv.append(descendant.promise_obj().get()));
}
rooted!(in(*global.get_cx()) let raw_promise_all = GetWaitForAllPromise(*global.get_cx(), abv));
rooted!(
in(*global.get_cx())
let raw_promise_all = GetWaitForAllPromise(*global.get_cx(), abv.handle())
);
let promise_all =
Promise::new_with_js_promise(raw_promise_all.handle(), global.get_cx());

View file

@ -225,6 +225,7 @@ unsafe extern "C" fn enqueue_promise_job(
/// https://html.spec.whatwg.org/multipage/#the-hostpromiserejectiontracker-implementation
unsafe extern "C" fn promise_rejection_tracker(
cx: *mut RawJSContext,
_muted_errors: bool,
promise: HandleObject,
state: PromiseRejectionHandlingState,
_data: *mut c_void,
@ -507,8 +508,16 @@ unsafe fn new_rt_and_cx_with_parent(
// Enable or disable the JITs.
let cx_opts = &mut *ContextOptionsRef(cx);
cx_opts.set_baseline_(pref!(js.baseline.enabled));
cx_opts.set_ion_(pref!(js.ion.enabled));
JS_SetGlobalJitCompilerOption(
cx,
JSJitCompilerOption::JSJITCOMPILER_BASELINE_ENABLE,
pref!(js.baseline.enabled) as u32,
);
JS_SetGlobalJitCompilerOption(
cx,
JSJitCompilerOption::JSJITCOMPILER_ION_ENABLE,
pref!(js.ion.enabled) as u32,
);
cx_opts.set_asmJS_(pref!(js.asmjs.enabled));
let wasm_enabled = pref!(js.wasm.enabled);
cx_opts.set_wasm_(wasm_enabled);
@ -523,7 +532,11 @@ unsafe fn new_rt_and_cx_with_parent(
cx_opts.set_extraWarnings_(pref!(js.strict.enabled));
// TODO: handle js.strict.debug.enabled
// TODO: handle js.throw_on_asmjs_validation_failure (needs new Spidermonkey)
cx_opts.set_nativeRegExp_(pref!(js.native_regex.enabled));
JS_SetGlobalJitCompilerOption(
cx,
JSJitCompilerOption::JSJITCOMPILER_NATIVE_REGEXP_ENABLE,
pref!(js.native_regex.enabled) as u32,
);
JS_SetParallelParsingEnabled(cx, pref!(js.parallel_parsing.enabled));
JS_SetOffthreadIonCompilationEnabled(cx, pref!(js.offthread_compilation.enabled));
JS_SetGlobalJitCompilerOption(
@ -550,11 +563,6 @@ unsafe fn new_rt_and_cx_with_parent(
// TODO: handle js.dump_stack_on_debugee_would_run (needs new Spidermonkey)
cx_opts.set_werror_(pref!(js.werror.enabled));
// TODO: handle js.shared_memory.enabled
JS_SetGCParameter(
cx,
JSGCParamKey::JSGC_MAX_MALLOC_BYTES,
(pref!(js.mem.high_water_mark) * 1024 * 1024) as u32,
);
JS_SetGCParameter(
cx,
JSGCParamKey::JSGC_MAX_BYTES,
@ -572,7 +580,7 @@ unsafe fn new_rt_and_cx_with_parent(
};
JS_SetGCParameter(cx, JSGCParamKey::JSGC_MODE, js_gc_mode as u32);
if let Some(val) = in_range(pref!(js.mem.gc.incremental.slice_ms), 0, 100_000) {
JS_SetGCParameter(cx, JSGCParamKey::JSGC_SLICE_TIME_BUDGET, val as u32);
JS_SetGCParameter(cx, JSGCParamKey::JSGC_SLICE_TIME_BUDGET_MS, val as u32);
}
JS_SetGCParameter(
cx,
@ -617,22 +625,14 @@ unsafe fn new_rt_and_cx_with_parent(
JS_SetGCParameter(cx, JSGCParamKey::JSGC_HIGH_FREQUENCY_HIGH_LIMIT, val as u32);
}
if let Some(val) = in_range(pref!(js.mem.gc.allocation_threshold_factor), 0, 10_000) {
JS_SetGCParameter(
cx,
JSGCParamKey::JSGC_ALLOCATION_THRESHOLD_FACTOR,
val as u32,
);
JS_SetGCParameter(cx, JSGCParamKey::JSGC_NON_INCREMENTAL_FACTOR, val as u32);
}
if let Some(val) = in_range(
pref!(js.mem.gc.allocation_threshold_avoid_interrupt_factor),
0,
10_000,
) {
JS_SetGCParameter(
cx,
JSGCParamKey::JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT,
val as u32,
);
JS_SetGCParameter(cx, JSGCParamKey::JSGC_AVOID_INTERRUPT_FACTOR, val as u32);
}
if let Some(val) = in_range(pref!(js.mem.gc.empty_chunk_count_min), 0, 10_000) {
JS_SetGCParameter(cx, JSGCParamKey::JSGC_MIN_EMPTY_CHUNK_COUNT, val as u32);
@ -836,6 +836,7 @@ unsafe fn set_gc_zeal_options(cx: *mut RawJSContext) {
unsafe fn set_gc_zeal_options(_: *mut RawJSContext) {}
#[derive(Clone, Copy)]
#[repr(transparent)]
pub struct JSContext(*mut RawJSContext);
#[allow(unsafe_code)]

View file

@ -37,6 +37,7 @@ use crate::dom::node::{window_from_node, Node, ShadowIncluding};
use crate::dom::nodelist::NodeList;
use crate::dom::window::Window;
use crate::dom::xmlserializer::XMLSerializer;
use crate::realms::enter_realm;
use crate::script_runtime::JSContext as SafeJSContext;
use crate::script_thread::{Documents, ScriptThread};
use cookie::Cookie;
@ -160,6 +161,7 @@ pub unsafe fn jsval_to_webdriver(
global_scope: &GlobalScope,
val: HandleValue,
) -> WebDriverJSResult {
let _ac = enter_realm(global_scope);
if val.get().is_undefined() {
Ok(WebDriverJSValue::Undefined)
} else if val.get().is_null() {
@ -996,7 +998,9 @@ pub fn handle_get_property(
reply
.send(
find_node_by_unique_id(documents, pipeline, node_id).and_then(|node| {
let cx = documents.find_document(pipeline).unwrap().window().get_cx();
let document = documents.find_document(pipeline).unwrap();
let _ac = enter_realm(&*document);
let cx = document.window().get_cx();
rooted!(in(*cx) let mut property = UndefinedValue());
match unsafe {

View file

@ -52,7 +52,7 @@ debugger = {path = "../debugger"}
devtools = {path = "../devtools"}
devtools_traits = {path = "../devtools_traits"}
embedder_traits = {path = "../embedder_traits"}
env_logger = "0.6"
env_logger = "0.7"
euclid = "0.20"
gfx = {path = "../gfx"}
gleam = "0.9"

View file

@ -81,7 +81,7 @@ void = "1.0.2"
[build-dependencies]
lazy_static = "1"
log = "0.4"
bindgen = {version = "0.51", optional = true, default-features = false}
bindgen = {version = "0.53", optional = true, default-features = false}
regex = {version = "1.1", optional = true}
walkdir = "2.1.4"
toml = {version = "0.5", optional = true, default-features = false}

View file

@ -22,7 +22,7 @@ euclid = "0.20"
ipc-channel = "0.14"
log = "0.4"
msg = {path = "../msg"}
rust-webvr = {version = "0.18", features = ["mock", "openvr", "vrexternal"]}
rust-webvr = {version = "0.19", features = ["mock", "openvr", "vrexternal"]}
rust-webvr-api = "0.17"
servo_config = {path = "../config"}
sparkle = "0.1"

View file

@ -59,7 +59,7 @@ lazy_static = "1"
libservo = {path = "../../components/servo"}
libc = "0.2"
log = "0.4"
rust-webvr = { version = "0.18", features = ["glwindow"] }
rust-webvr = { version = "0.19", features = ["glwindow"] }
servo-media = {git = "https://github.com/servo/media"}
shellwords = "1.0.0"
tinyfiledialogs = "3.0"

View file

@ -20,7 +20,7 @@ layout-2020 = ["simpleservo/layout-2020"]
[dependencies]
libservo = { path = "../../components/servo", features = ["no_static_freetype"] }
simpleservo = { path = "../libsimpleservo/api", features = ["no_static_freetype"] }
rust-webvr = { version = "0.18", features = ["magicleap"] }
rust-webvr = { version = "0.19", features = ["magicleap"] }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] }
libc = "0.2"

View file

@ -16,7 +16,7 @@ bench = false
simpleservo = { path = "../api" }
log = "0.4"
lazy_static = "1"
env_logger = "0.6"
env_logger = "0.7"
backtrace = "0.3"
[target.'cfg(target_os = "windows")'.dependencies]

View file

@ -65,7 +65,6 @@
"js.mem.gc.per_zone.enabled": false,
"js.mem.gc.zeal.frequency": 100,
"js.mem.gc.zeal.level": 0,
"js.mem.high_water_mark": 128,
"js.mem.max": -1,
"js.native_regex.enabled": true,
"js.offthread_compilation.enabled": true,

View file

@ -1,5 +0,0 @@
[structured_clone_bigint.html]
expected: ERROR
[2.7 Safe passing of structured data]
expected: FAIL

View file

@ -1,5 +0,0 @@
[css-module-worker-test.html]
expected: TIMEOUT
[A dynamic import CSS Module within a web worker should not load.]
expected: TIMEOUT

View file

@ -1,5 +0,0 @@
[inactive-context-import.html]
type: testharness
[dynamic import from inactive context should not crash]
expected: FAIL

View file

@ -0,0 +1,5 @@
[localeCompare.html]
bug: https://github.com/servo/servo/issues/25802
[localeCompare should return the same as other browsers, even though it's implementation-dependent]
expected: FAIL

View file

@ -10971,7 +10971,7 @@
[]
],
"interfaces.js": [
"689016240d603459ee1b633a5e80009291376396",
"1b841f053a231bf78d29ffe68e59455363c61502",
[]
],
"nested_asap_script.js": [

View file

@ -0,0 +1,5 @@
[localeCompare.html]
bug: https://github.com/servo/servo/issues/25802
[localeCompare should return the same as other browsers, even though it's implementation-dependent]
expected: FAIL

View file

@ -6,6 +6,9 @@ function test_interfaces(interfaceNamesInGlobalScope) {
"Array",
"ArrayBuffer",
"Atomics",
"BigInt",
"BigInt64Array",
"BigUint64Array",
"Boolean",
"BroadcastChannel",
"Crypto",