Update to SpiderMonkey 137.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-05-22 00:48:46 -04:00
parent 0774025d89
commit b9238c5025
9 changed files with 115 additions and 47 deletions

View file

@ -113,9 +113,22 @@ unsafe extern "C" fn instance_class_has_proto_at_depth(
domclass.dom_class.interface_chain[depth as usize] as u32 == proto_id
}
/// <https://searchfox.org/mozilla-central/rev/c18faaae88b30182e487fa3341bc7d923e22f23a/xpcom/base/CycleCollectedJSRuntime.cpp#792>
unsafe extern "C" fn instance_class_is_error(clasp: *const js::jsapi::JSClass) -> bool {
if !is_dom_class(&*clasp) {
return false;
}
let domclass: *const DOMJSClass = clasp as *const _;
let domclass = &*domclass;
let root_interface = domclass.dom_class.interface_chain[0] as u32;
// TODO: support checking bare Exception prototype as well.
root_interface == PrototypeList::ID::DOMException as u32
}
#[allow(missing_docs)] // FIXME
pub(crate) const DOM_CALLBACKS: DOMCallbacks = DOMCallbacks {
instanceClassMatchesProto: Some(instance_class_has_proto_at_depth),
instanceClassIsError: Some(instance_class_is_error),
};
/// Eagerly define all relevant WebIDL interface constructors on the

View file

@ -14,12 +14,10 @@ use std::rc::Rc;
use deny_public_fields::DenyPublicFields;
use dom_struct::dom_struct;
use fnv::FnvHasher;
use js::jsapi::JS_GetFunctionObject;
use js::jsapi::JS::CompileFunction;
use js::jsapi::{JS_GetFunctionObject, SupportUnscopables};
use js::jsval::JSVal;
use js::rust::wrappers::CompileFunction;
use js::rust::{
CompileOptionsWrapper, HandleObject, RootedObjectVectorWrapper, transform_u16_to_source_text,
};
use js::rust::{CompileOptionsWrapper, HandleObject, transform_u16_to_source_text};
use libc::c_char;
use servo_url::ServoUrl;
use style::str::HTML_SPACE_CHARACTERS;
@ -646,7 +644,8 @@ impl EventTarget {
};
// Step 3.9, subsection Scope steps 1-6
let scopechain = RootedObjectVectorWrapper::new(*cx);
//let scopechain = RootedObjectVectorWrapper::new(*cx);
let scopechain = js::rust::EnvironmentChain::new(*cx, SupportUnscopables::Yes);
if let Some(element) = element {
scopechain.append(document.reflector().get_jsobject().get());
@ -659,7 +658,7 @@ impl EventTarget {
rooted!(in(*cx) let mut handler = unsafe {
CompileFunction(
*cx,
scopechain.handle(),
scopechain.get(),
options.ptr,
name.as_ptr(),
args.len() as u32,

View file

@ -30,7 +30,7 @@ use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use js::glue::{IsWrapper, UnwrapObjectDynamic};
use js::jsapi::{
Compile1, CurrentGlobalOrNull, GetNonCCWObjectGlobal, HandleObject, Heap,
Compile1, CurrentGlobalOrNull, DelazificationOption, GetNonCCWObjectGlobal, HandleObject, Heap,
InstantiateGlobalStencil, InstantiateOptions, JSContext, JSObject, JSScript, SetScriptPrivate,
};
use js::jsval::{PrivateValue, UndefinedValue};
@ -2802,6 +2802,7 @@ impl GlobalScope {
skipFilenameValidation: false,
hideScriptFromDebugger: false,
deferDebugMetadata: false,
eagerDelazificationStrategy_: DelazificationOption::OnDemandOnly,
};
let script = InstantiateGlobalStencil(
*cx,