aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorAnthony Ramine <nox@nox.paris>2020-03-02 11:16:46 +0100
committerAnthony Ramine <nox@nox.paris>2020-03-06 11:13:28 +0100
commit5a4f8cf93f9f674a164a0a3cfc586accef3d06f9 (patch)
treec50ce5a7663486939177dbd928acdd985aa0197c /components
parent813be919269f632ba23746e4700e8a18bdd4ae07 (diff)
downloadservo-5a4f8cf93f9f674a164a0a3cfc586accef3d06f9.tar.gz
servo-5a4f8cf93f9f674a164a0a3cfc586accef3d06f9.zip
Update SpiderMonkey
Diffstat (limited to 'components')
-rw-r--r--components/compositing/Cargo.toml2
-rw-r--r--components/config/prefs.rs1
-rw-r--r--components/script/Cargo.toml2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py157
-rw-r--r--components/script/dom/bindings/error.rs3
-rw-r--r--components/script/dom/bindings/interface.rs16
-rw-r--r--components/script/dom/bindings/namespace.rs5
-rw-r--r--components/script/dom/bindings/proxyhandler.rs6
-rw-r--r--components/script/dom/bindings/record.rs4
-rw-r--r--components/script/dom/bindings/structuredclone.rs3
-rw-r--r--components/script/dom/bindings/utils.rs12
-rw-r--r--components/script/dom/eventtarget.rs25
-rw-r--r--components/script/dom/globalscope.rs19
-rw-r--r--components/script/dom/promise.rs6
-rw-r--r--components/script/dom/webgl2renderingcontext.rs1
-rw-r--r--components/script/lib.rs1
-rw-r--r--components/script/script_module.rs57
-rw-r--r--components/script/script_runtime.rs39
-rw-r--r--components/script/webdriver_handlers.rs6
-rw-r--r--components/servo/Cargo.toml2
-rw-r--r--components/style/Cargo.toml2
-rw-r--r--components/webvr/Cargo.toml2
22 files changed, 209 insertions, 162 deletions
diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml
index 70f40e3b568..e8ec781bcfd 100644
--- a/components/compositing/Cargo.toml
+++ b/components/compositing/Cargo.toml
@@ -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"}
diff --git a/components/config/prefs.rs b/components/config/prefs.rs
index 841e244d51c..cf38b88b776 100644
--- a/components/config/prefs.rs
+++ b/components/config/prefs.rs
@@ -385,7 +385,6 @@ mod gen {
level: i64,
},
},
- high_water_mark: i64,
max: i64,
},
native_regex: {
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index dfcb331fcc5..48c3adb6c65 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -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"
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 7f56c3b2f15..a06414c306e 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -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',
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index b88a6cabed3..f678611423b 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -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);
}
}
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs
index 2097769cb31..d0b3771890e 100644
--- a/components/script/dom/bindings/interface.rs
+++ b/components/script/dom/bindings/interface.rs
@@ -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,
diff --git a/components/script/dom/bindings/namespace.rs b/components/script/dom/bindings/namespace.rs
index 82b7bd8834e..64b7b0b2626 100644
--- a/components/script/dom/bindings/namespace.rs
+++ b/components/script/dom/bindings/namespace.rs
@@ -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(),
})
}
}
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index a4b5f418cd2..11913c03642 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -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`.
diff --git a/components/script/dom/bindings/record.rs b/components/script/dom/bindings/record.rs
index 86453b59fc3..c54a2403d70 100644
--- a/components/script/dom/bindings/record.rs
+++ b/components/script/dom/bindings/record.rs
@@ -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(());
}
diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs
index dbf852907a8..511b8d1650e 100644
--- a/components/script/dom/bindings/structuredclone.rs
+++ b/components/script/dom/bindings/structuredclone.rs
@@ -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,
);
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 56b2112e498..21f82be9cee 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -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 {
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 4020f938b24..90e533c8cc3 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -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);
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index 8eed617d0fa..9e55f593f59 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -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,
)
};
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs
index 37baedcc663..5e60507f8fc 100644
--- a/components/script/dom/promise.rs
+++ b/components/script/dom/promise.rs
@@ -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());
}
}
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index 9f0bfcd89c3..ec2741c44dd 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -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!(),
}
}
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 1a3ba6a2557..1962e9602d6 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -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)]
diff --git a/components/script/script_module.rs b/components/script/script_module.rs
index b9eda4c2ee6..61f6405062b 100644
--- a/components/script/script_module.rs
+++ b/components/script/script_module.rs
@@ -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);
+ 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)))
+ 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());
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 3aa1d79c2d9..3cce6291d63 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -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(
@@ -552,11 +565,6 @@ unsafe fn new_rt_and_cx_with_parent(
// 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,
in_range(pref!(js.mem.max), 1, 0x100)
.map(|val| (val * 1024 * 1024) as u32)
@@ -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)]
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index f177f8e4c30..1e094ec086c 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -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 {
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml
index c8d77f56683..ffcb3b83f2c 100644
--- a/components/servo/Cargo.toml
+++ b/components/servo/Cargo.toml
@@ -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"
diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml
index d6f685048a3..59f231e11b3 100644
--- a/components/style/Cargo.toml
+++ b/components/style/Cargo.toml
@@ -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}
diff --git a/components/webvr/Cargo.toml b/components/webvr/Cargo.toml
index ca0e209ef60..fc5e81e6360 100644
--- a/components/webvr/Cargo.toml
+++ b/components/webvr/Cargo.toml
@@ -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"