diff options
author | Koki Saito <saitoto828@gmail.com> | 2024-08-18 10:48:39 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-18 01:48:39 +0000 |
commit | db312319ae89989a94d2047b04d3d58809e8887b (patch) | |
tree | 20edea4a501af7ed259929574d2ca80efd2002bf /components | |
parent | 20273b062af969152635306c3df2a3a1364ac4d1 (diff) | |
download | servo-db312319ae89989a94d2047b04d3d58809e8887b.tar.gz servo-db312319ae89989a94d2047b04d3d58809e8887b.zip |
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>
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/import.rs | 10 | ||||
-rw-r--r-- | components/script/dom/bindings/interface.rs | 5 | ||||
-rw-r--r-- | components/script/dom/bindings/utils.rs | 4 |
4 files changed, 8 insertions, 13 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 154ec01c7ae..475bde75d06 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -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; } diff --git a/components/script/dom/bindings/import.rs b/components/script/dom/bindings/import.rs index 44823aa30cd..f33f4c4c51b 100644 --- a/components/script/dom/bindings/import.rs +++ b/components/script/dom/bindings/import.rs @@ -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}; diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 1986b08b052..ce2f7e275b6 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -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 diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 07424ff6d3f..eb1da6617e1 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -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, |