fix: Replace callargs_is_constructing with is_constructing method (#33101)

Signed-off-by: Koki Saito <saitoto828@gmail.com>
Co-authored-by: kokisaito <kosaito@indeed.com>
This commit is contained in:
Koki Saito 2024-08-18 10:48:39 +09:00 committed by GitHub
parent 20273b062a
commit db312319ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 15 deletions

4
Cargo.lock generated
View file

@ -4319,7 +4319,7 @@ dependencies = [
[[package]]
name = "mozjs"
version = "0.14.1"
source = "git+https://github.com/servo/mozjs#dae748dee6fb8c1db771364bd12101db1ed34614"
source = "git+https://github.com/servo/mozjs#4f0724dd3b9b58120903ff6a1043e71e7c7b9eb1"
dependencies = [
"bindgen",
"cc",
@ -4332,7 +4332,7 @@ dependencies = [
[[package]]
name = "mozjs_sys"
version = "0.128.0-8"
source = "git+https://github.com/servo/mozjs#dae748dee6fb8c1db771364bd12101db1ed34614"
source = "git+https://github.com/servo/mozjs#4f0724dd3b9b58120903ff6a1043e71e7c7b9eb1"
dependencies = [
"bindgen",
"cc",

View file

@ -6283,7 +6283,7 @@ let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
else:
ctorName = GetConstructorNameForReporting(self.descriptor, self.constructor)
preamble += """
if !callargs_is_constructing(&args) {
if !args.is_constructing() {
throw_constructor_without_new(*cx, "%s");
return false;
}

View file

@ -135,11 +135,11 @@ pub mod module {
pub use crate::dom::bindings::root::{Dom, DomSlice, MaybeUnreflectedDom, Root};
pub use crate::dom::bindings::trace::JSTraceable;
pub use crate::dom::bindings::utils::{
callargs_is_constructing, enumerate_global, exception_to_promise, generic_getter,
generic_lenient_getter, generic_lenient_setter, generic_method, generic_setter,
generic_static_promise_method, get_array_index_from_id, get_property_on_prototype,
has_property_on_prototype, resolve_global, trace_global, AsVoidPtr, DOMClass, DOMJSClass,
ProtoOrIfaceArray, DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL,
enumerate_global, exception_to_promise, generic_getter, generic_lenient_getter,
generic_lenient_setter, generic_method, generic_setter, generic_static_promise_method,
get_array_index_from_id, get_property_on_prototype, has_property_on_prototype,
resolve_global, trace_global, AsVoidPtr, DOMClass, DOMJSClass, ProtoOrIfaceArray,
DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL,
};
pub use crate::dom::bindings::weakref::{WeakReferenceable, DOM_WEAK_SLOT};
pub use crate::dom::types::{AnalyserNode, AudioNode, BaseAudioContext, EventTarget};

View file

@ -40,8 +40,7 @@ use crate::dom::bindings::conversions::{get_dom_class, DOM_OBJECT_SLOT};
use crate::dom::bindings::guard::Guard;
use crate::dom::bindings::principals::ServoJSPrincipals;
use crate::dom::bindings::utils::{
callargs_is_constructing, get_proto_or_iface_array, DOMJSClass, ProtoOrIfaceArray,
DOM_PROTOTYPE_SLOT, JSCLASS_DOM_GLOBAL,
get_proto_or_iface_array, DOMJSClass, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT, JSCLASS_DOM_GLOBAL,
};
use crate::script_runtime::JSContext as SafeJSContext;
@ -611,7 +610,7 @@ pub fn get_desired_proto(
// https://heycam.github.io/webidl/#internally-create-a-new-object-implementing-the-interface
// step 3.
assert!(callargs_is_constructing(args));
assert!(args.is_constructing());
// The desired prototype depends on the actual constructor that was invoked,
// which is passed to us as the newTarget in the callargs. We want to do

View file

@ -625,10 +625,6 @@ impl AsCCharPtrPtr for [u8] {
}
}
pub unsafe fn callargs_is_constructing(args: &CallArgs) -> bool {
(*args.argv_.offset(-1)).is_magic()
}
/// https://searchfox.org/mozilla-central/rev/7279a1df13a819be254fd4649e07c4ff93e4bd45/dom/bindings/BindingUtils.cpp#3300
pub unsafe extern "C" fn generic_static_promise_method(
cx: *mut JSContext,