script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
HTMLOListElementBinding.rs

1/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
2
3#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
6use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
7use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
8use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
9use crate::import::base::*;
10
11pub use self::HTMLOListElement_Binding::{Wrap, GetProtoObject, GetConstructorObject, DefineDOMInterface};
12pub mod HTMLOListElement_Binding {
13use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
14use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
15use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
16use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
17use crate::import::module::*;
18
19unsafe extern "C" fn _finalize<D: DomTypes>
20(_cx: *mut GCContext, obj: *mut JSObject){
21    wrap_panic(&mut || {
22
23        let this = native_from_object_static::<D::HTMLOListElement>(obj).unwrap();
24        finalize_common(this);
25    })
26}
27
28unsafe extern "C" fn _trace<D: DomTypes>
29(trc: *mut JSTracer, obj: *mut JSObject){
30    wrap_panic(&mut || {
31
32        let this = native_from_object_static::<D::HTMLOListElement>(obj).unwrap();
33        if this.is_null() { return; } // GC during obj creation
34        (*this).trace(trc);
35    })
36}
37
38
39static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
40
41pub(crate) fn init_class_ops<D: DomTypes>() {
42    CLASS_OPS.set(JSClassOps {
43        addProperty: None,
44        delProperty: None,
45        enumerate: None,
46        newEnumerate: None,
47        resolve: None,
48        mayResolve: None,
49        finalize: Some(_finalize::<D>),
50        call: None,
51        construct: None,
52        trace: Some(_trace::<D>),
53    });
54}
55
56pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
57
58pub(crate) fn init_domjs_class<D: DomTypes>() {
59    init_class_ops::<D>();
60    Class.set(DOMJSClass {
61        base: JSClass {
62            name: c"HTMLOListElement".as_ptr(),
63            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
64                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
65                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
66            cOps: unsafe { CLASS_OPS.get() },
67            spec: ptr::null(),
68            ext: ptr::null(),
69            oOps: ptr::null(),
70        },
71        dom_class:
72DOMClass {
73    interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::Node, PrototypeList::ID::Element, PrototypeList::ID::HTMLElement, PrototypeList::ID::HTMLOListElement, PrototypeList::ID::Last ],
74    depth: 4,
75    type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::Node(crate::codegen::InheritTypes::NodeTypeId::Element(crate::codegen::InheritTypes::ElementTypeId::HTMLElement(crate::codegen::InheritTypes::HTMLElementTypeId::HTMLOListElement)))) },
76    malloc_size_of: malloc_size_of_including_raw_self::<D::HTMLOListElement> as unsafe fn(&mut _, _) -> _,
77    global: Globals::EMPTY,
78},
79    });
80}
81
82#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
83(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::HTMLOListElement>, _can_gc: CanGc) -> DomRoot<D::HTMLOListElement>{
84
85    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
86
87    let scope = scope.reflector().get_jsobject();
88    assert!(!scope.get().is_null());
89    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
90    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
91
92    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
93    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
94    assert!(!canonical_proto.is_null());
95
96
97    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
98    if let Some(given) = given_proto {
99        proto.set(*given);
100        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
101            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
102        }
103    } else {
104        proto.set(*canonical_proto);
105    }
106    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
107        cx.raw_cx(),
108        &Class.get().base,
109        proto.handle(),
110    ));
111    assert!(!obj.is_null());
112    JS_SetReservedSlot(
113        obj.get(),
114        DOM_OBJECT_SLOT,
115        &PrivateValue(raw.as_ptr() as *const libc::c_void),
116    );
117
118    let root = raw.reflect_with(obj.get());
119
120
121
122    DomRoot::from_ref(&*root)
123}
124
125pub trait HTMLOListElementMethods<D: DomTypes> {
126}
127static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
128
129pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
130    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
131    JSPropertySpec {
132                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
133                    attributes_: (JSPROP_READONLY),
134                    kind_: (JSPropertySpec_Kind::Value),
135                    u: JSPropertySpec_AccessorsOrValue {
136                        value: JSPropertySpec_ValueWrapper {
137                            type_: JSPropertySpec_ValueWrapper_Type::String,
138                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
139                                string: c"HTMLOListElement".as_ptr(),
140                            }
141                        }
142                    }
143                }
144,
145    JSPropertySpec::ZERO]))[..]
146])));
147}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
148
149pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
150    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
151}
152pub fn GetProtoObject<D: DomTypes>
153(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
154    /* Get the interface prototype object for this class.  This will create the
155       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::HTMLOListElement), CreateInterfaceObjects::<D>, rval)
156}
157
158
159static PrototypeClass: JSClass = JSClass {
160    name: c"HTMLOListElementPrototype".as_ptr(),
161    flags:
162        // JSCLASS_HAS_RESERVED_SLOTS()
163        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
164    cOps: ptr::null(),
165    spec: ptr::null(),
166    ext: ptr::null(),
167    oOps: ptr::null(),
168};
169
170unsafe extern "C" fn _constructor<D: DomTypes>
171(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
172    let mut result = false;
173    wrap_panic(&mut || result = {
174        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
175        let args = CallArgs::from_vp(vp, argc);
176        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
177
178                        <D as DomHelpers<D>>::call_html_constructor::<D::HTMLOListElement>(
179                            SafeJSContext::from_ptr(cx.raw_cx()),
180                            &args,
181                            &global,
182                            PrototypeList::ID::HTMLOListElement,
183                            CreateInterfaceObjects::<D>,
184                            CanGc::note()
185                        )
186
187    });
188    result
189}
190
191
192static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
193
194pub(crate) fn init_interface_object<D: DomTypes>() {
195    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
196        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
197        b"function HTMLOListElement() {\n    [native code]\n}",
198        PrototypeList::ID::HTMLOListElement,
199        4,
200    ));
201}
202
203pub fn GetConstructorObject<D: DomTypes>
204(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
205    /* Get the interface object for this class.  This will create the object as
206       needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::HTMLOListElement), CreateInterfaceObjects::<D>, rval)
207}
208
209pub fn DefineDOMInterface<D: DomTypes>
210(cx: SafeJSContext, global: HandleObject){
211    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::HTMLOListElement),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
212}
213
214pub fn ConstructorEnabled<D: DomTypes>
215(aCx: SafeJSContext, aObj: HandleObject) -> bool{
216    is_exposed_in(aObj, Globals::WINDOW)
217}
218
219unsafe fn CreateInterfaceObjects<D: DomTypes>
220(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
221
222    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
223    HTMLElement_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
224    assert!(!prototype_proto.is_null());
225
226    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
227    create_interface_prototype_object::<D>(cx,
228                                      global,
229                                      prototype_proto.handle(),
230                                      &PrototypeClass,
231                                      &[],
232                                      sAttributes.get(),
233                                      &[],
234                                      &[],
235                                      prototype.handle_mut());
236    assert!(!prototype.is_null());
237    assert!((*cache)[PrototypeList::ID::HTMLOListElement as usize].is_null());
238    (*cache)[PrototypeList::ID::HTMLOListElement as usize] = prototype.get();
239    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::HTMLOListElement as isize),
240                                  ptr::null_mut(),
241                                  prototype.get());
242
243    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
244
245    HTMLElement_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
246
247    assert!(!interface_proto.is_null());
248
249    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
250    create_noncallback_interface_object::<D>(cx,
251                                        global,
252                                        interface_proto.handle(),
253                                        INTERFACE_OBJECT_CLASS.get(),
254                                        &[],
255                                        &[],
256                                        &[],
257                                        prototype.handle(),
258                                        c"HTMLOListElement",
259                                        0,
260                                        &[],
261                                        interface.handle_mut());
262    assert!(!interface.is_null());
263
264    assert!((*cache)[PrototypeList::Constructor::HTMLOListElement as usize].is_null());
265    (*cache)[PrototypeList::Constructor::HTMLOListElement as usize] = interface.get();
266    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::HTMLOListElement as isize),
267                                  ptr::null_mut(),
268                                  interface.get());
269
270}
271
272
273        pub(crate) fn init_statics<D: DomTypes>() {
274            init_interface_object::<D>();
275            init_domjs_class::<D>();
276
277
278
279
280            init_sAttributes_specs::<D>();
281init_sAttributes_prefs::<D>();
282        }
283        } // mod HTMLOListElement_Binding
284
285