mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix invalid rooting for PropertyDescriptor (#34018)
* Clean up unnecessary uses of RootedGuard. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
884732dfb2
commit
1070f7ac12
4 changed files with 15 additions and 16 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -4093,7 +4093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4518,7 +4518,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "mozjs"
|
||||
version = "0.14.1"
|
||||
source = "git+https://github.com/servo/mozjs#a02aaf1e11fd275f2f129d0c7ca80a9d07460036"
|
||||
source = "git+https://github.com/servo/mozjs#118aae2bcdb39617473b2cfe9fc680274ebbb9fc"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
@ -4530,8 +4530,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mozjs_sys"
|
||||
version = "0.128.3-0"
|
||||
source = "git+https://github.com/servo/mozjs#a02aaf1e11fd275f2f129d0c7ca80a9d07460036"
|
||||
version = "0.128.3-1"
|
||||
source = "git+https://github.com/servo/mozjs#118aae2bcdb39617473b2cfe9fc680274ebbb9fc"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
|
|
@ -3205,7 +3205,7 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
|
|||
args = [Argument('*mut JSContext', 'cx'),
|
||||
Argument('RawHandleObject', 'obj'),
|
||||
Argument('*mut libc::c_void', 'this'),
|
||||
Argument('&RootedGuard<*mut JSObject>', 'result')]
|
||||
Argument('HandleObject', 'result')]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'CollectJSONAttributes',
|
||||
'bool', args, pub=True, unsafe=True)
|
||||
self.toJSONMethod = toJSONMethod
|
||||
|
@ -3232,7 +3232,7 @@ let global = incumbent_global.reflector().get_jsobject();\n"""
|
|||
if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) {
|
||||
return false;
|
||||
}
|
||||
if !JS_DefineProperty(cx, result.handle(),
|
||||
if !JS_DefineProperty(cx, result,
|
||||
${nameAsArray},
|
||||
temp.handle(), JSPROP_ENUMERATE as u32) {
|
||||
return false;
|
||||
|
@ -4118,7 +4118,7 @@ class CGDefaultToJSONMethod(CGSpecializedMethod):
|
|||
|
||||
parents = len(jsonDescriptors) - 1
|
||||
form = """
|
||||
if !${parentclass}CollectJSONAttributes(cx, _obj, this, &result) {
|
||||
if !${parentclass}CollectJSONAttributes(cx, _obj, this, result.handle()) {
|
||||
return false;
|
||||
}
|
||||
"""
|
||||
|
@ -6250,13 +6250,13 @@ let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
|
|||
if len(self.exposureSet) == 1:
|
||||
args = [
|
||||
f"global.downcast::<dom::types::{list(self.exposureSet)[0]}>().unwrap()",
|
||||
"Some(desired_proto.handle())",
|
||||
"Some(desired_proto)",
|
||||
"CanGc::note()"
|
||||
]
|
||||
else:
|
||||
args = [
|
||||
"global",
|
||||
"Some(desired_proto.handle())",
|
||||
"Some(desired_proto)",
|
||||
"CanGc::note()"
|
||||
]
|
||||
|
||||
|
@ -6265,11 +6265,11 @@ let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
|
|||
call_default_constructor(
|
||||
cx,
|
||||
&args,
|
||||
global,
|
||||
&global,
|
||||
PrototypeList::ID::{MakeNativeName(self.descriptor.name)},
|
||||
\"{ctorName}\",
|
||||
CreateInterfaceObjects,
|
||||
|cx, args, global, desired_proto| {{
|
||||
|cx: SafeJSContext, args: &CallArgs, global: &GlobalScope, desired_proto: HandleObject| {{
|
||||
{constructor.define()}
|
||||
}}
|
||||
)
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::ptr;
|
|||
use html5ever::interface::QualName;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName};
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::gc::RootedGuard;
|
||||
use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
|
||||
use js::jsapi::{CallArgs, CurrentGlobalOrNull, JSAutoRealm, JSObject};
|
||||
use js::rust::wrappers::{JS_SetPrototype, JS_WrapObject};
|
||||
|
@ -406,11 +405,11 @@ pub unsafe fn call_html_constructor<T: DerivedFrom<Element> + DomObject>(
|
|||
pub unsafe fn call_default_constructor(
|
||||
cx: JSContext,
|
||||
args: &CallArgs,
|
||||
global: DomRoot<GlobalScope>,
|
||||
global: &GlobalScope,
|
||||
proto_id: PrototypeList::ID,
|
||||
ctor_name: &str,
|
||||
creator: unsafe fn(JSContext, HandleObject, *mut ProtoOrIfaceArray),
|
||||
constructor: impl FnOnce(JSContext, &CallArgs, &GlobalScope, RootedGuard<*mut JSObject>) -> bool,
|
||||
constructor: impl FnOnce(JSContext, &CallArgs, &GlobalScope, HandleObject) -> bool,
|
||||
) -> bool {
|
||||
if !args.is_constructing() {
|
||||
throw_constructor_without_new(*cx, ctor_name);
|
||||
|
@ -423,5 +422,5 @@ pub unsafe fn call_default_constructor(
|
|||
return false;
|
||||
}
|
||||
|
||||
constructor(cx, args, &global, desired_proto)
|
||||
constructor(cx, args, global, desired_proto.handle())
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ pub mod module {
|
|||
};
|
||||
pub use js::rust::{
|
||||
get_context_realm, get_object_class, get_object_realm, CustomAutoRooterGuard, GCMethods,
|
||||
Handle, MutableHandle, RootedGuard,
|
||||
Handle, MutableHandle,
|
||||
};
|
||||
pub use js::typedarray::{
|
||||
ArrayBuffer, ArrayBufferView, Float32Array, Float64Array, Uint8Array, Uint8ClampedArray,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue