Use MozTools 4 and update mozjs (#30326)

* Update mozjs

* moztools4 in bootstrap

* no autoconf

* tidy

* switch to servo-build-deps

* update mozjs for real

* glue mozjs

* fmt

* move to servo/mozjs
This commit is contained in:
Samson 2023-09-11 10:23:05 +02:00 committed by GitHub
parent 9b1247b20f
commit 59d134133f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 46 additions and 20 deletions

View file

@ -356,7 +356,7 @@ pub fn is_dom_proxy(obj: *mut JSObject) -> bool {
use js::glue::IsProxyHandlerFamily;
unsafe {
let clasp = get_object_class(obj);
((*clasp).flags & js::JSCLASS_IS_PROXY) != 0 && IsProxyHandlerFamily(obj) != 0
((*clasp).flags & js::JSCLASS_IS_PROXY) != 0 && IsProxyHandlerFamily(obj)
}
}
@ -422,7 +422,7 @@ pub(crate) unsafe fn private_from_proto_check(
let dom_class = get_dom_class(obj).or_else(|_| {
if IsWrapper(obj) {
trace!("found wrapper");
obj = UnwrapObjectDynamic(obj, cx, /* stopAtWindowProxy = */ 0);
obj = UnwrapObjectDynamic(obj, cx, /* stopAtWindowProxy = */ false);
if obj.is_null() {
trace!("unwrapping security wrapper failed");
Err(())

View file

@ -113,7 +113,7 @@ unsafe fn html_constructor(
// The new_target might be a cross-compartment wrapper. Get the underlying object
// so we can do the spec's object-identity checks.
rooted!(in(*cx) let new_target_unwrapped = UnwrapObjectDynamic(call_args.new_target().to_object(), *cx, 1));
rooted!(in(*cx) let new_target_unwrapped = UnwrapObjectDynamic(call_args.new_target().to_object(), *cx, true));
if new_target_unwrapped.is_null() {
throw_dom_exception(cx, global, Error::Type("new.target is null".to_owned()));
return Err(());

View file

@ -431,7 +431,7 @@ pub fn define_guarded_properties(
/// be exposed in the global object `obj`.
pub fn is_exposed_in(object: HandleObject, globals: Globals) -> bool {
unsafe {
let unwrapped = UncheckedUnwrapObject(object.get(), /* stopAtWindowProxy = */ 0);
let unwrapped = UncheckedUnwrapObject(object.get(), /* stopAtWindowProxy = */ false);
let dom_class = get_dom_class(unwrapped).unwrap();
globals.contains(dom_class.global)
}

View file

@ -278,7 +278,7 @@ pub unsafe fn find_enum_value<'a, T>(
/// <https://heycam.github.io/webidl/#dfn-platform-object>
pub fn is_platform_object_dynamic(obj: *mut JSObject, cx: *mut JSContext) -> bool {
is_platform_object(obj, &|o| unsafe {
UnwrapObjectDynamic(o, cx, /* stopAtWindowProxy = */ 0)
UnwrapObjectDynamic(o, cx, /* stopAtWindowProxy = */ false)
})
}

View file

@ -2174,7 +2174,7 @@ impl GlobalScope {
cx: *mut JSContext,
) -> DomRoot<Self> {
if IsWrapper(obj) {
obj = UnwrapObjectDynamic(obj, cx, /* stopAtWindowProxy = */ 0);
obj = UnwrapObjectDynamic(obj, cx, /* stopAtWindowProxy = */ false);
assert!(!obj.is_null());
}
GlobalScope::from_object(obj)

View file

@ -37,6 +37,7 @@ use crate::script_thread::trace_thread;
use crate::task::TaskBox;
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::{TaskSource, TaskSourceName};
use core::ffi::c_char;
use js::glue::{CollectServoSizes, CreateJobQueue, DeleteJobQueue, DispatchableRun};
use js::glue::{JobQueueTraps, RUST_js_GetErrorMessage, SetBuildId, StreamConsumerConsumeChunk};
use js::glue::{
@ -836,7 +837,7 @@ unsafe extern "C" fn trace_rust_roots(tr: *mut JSTracer, _data: *mut os::raw::c_
#[allow(unsafe_code)]
unsafe extern "C" fn servo_build_id(build_id: *mut BuildIdCharVector) -> bool {
let servo_id = b"Servo\0";
SetBuildId(build_id, &servo_id[0], servo_id.len())
SetBuildId(build_id, servo_id[0] as *const c_char, servo_id.len())
}
#[allow(unsafe_code)]