script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
DOMStringListBinding.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::import::base::*;
6
7pub use self::DOMStringList_Binding::{Wrap, DOMStringListMethods, GetProtoObject, DefineDOMInterface};
8pub mod DOMStringList_Binding {
9use crate::import::module::*;
10
11unsafe extern "C" fn get_length<D: DomTypes>
12(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
13    let mut result = false;
14    wrap_panic(&mut || result = (|| {
15        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16        let this = &*(this as *const D::DOMStringList);
17        let result: u32 = this.Length();
18
19        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20        return true;
21    })());
22    result
23}
24
25
26static length_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
27
28pub(crate) fn init_length_getterinfo<D: DomTypes>() {
29    length_getterinfo.set(JSJitInfo {
30    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
31        getter: Some(get_length::<D>)
32    },
33    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
34        protoID: PrototypeList::ID::DOMStringList as u16,
35    },
36    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
37    _bitfield_align_1: [],
38    _bitfield_1: __BindgenBitfieldUnit::new(
39        new_jsjitinfo_bitfield_1!(
40            JSJitInfo_OpType::Getter as u8,
41            JSJitInfo_AliasSet::AliasEverything as u8,
42            JSValueType::JSVAL_TYPE_DOUBLE as u8,
43            true,
44            false,
45            false,
46            false,
47            false,
48            false,
49            0,
50        ).to_ne_bytes()
51    ),
52});
53}
54unsafe extern "C" fn item<D: DomTypes>
55(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
56    let mut result = false;
57    wrap_panic(&mut || result = (|| {
58        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
59        let this = &*(this as *const D::DOMStringList);
60        let args = &*args;
61        let argc = args.argc_;
62
63        if argc < 1 {
64            throw_type_error(cx.raw_cx(), "Not enough arguments to \"DOMStringList.item\".");
65            return false;
66        }
67        let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
68            Ok(ConversionResult::Success(value)) => value,
69            Ok(ConversionResult::Failure(error)) => {
70                throw_type_error(cx.raw_cx(), &error);
71        return false;
72
73            }
74            _ => {
75                return false;
76
77            },
78        }
79        ;
80        let result: Option<DOMString> = this.Item(arg0);
81
82        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
83        return true;
84    })());
85    result
86}
87
88
89static item_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
90
91pub(crate) fn init_item_methodinfo<D: DomTypes>() {
92    item_methodinfo.set(JSJitInfo {
93    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
94        method: Some(item::<D>)
95    },
96    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
97        protoID: PrototypeList::ID::DOMStringList as u16,
98    },
99    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
100    _bitfield_align_1: [],
101    _bitfield_1: __BindgenBitfieldUnit::new(
102        new_jsjitinfo_bitfield_1!(
103            JSJitInfo_OpType::Method as u8,
104            JSJitInfo_AliasSet::AliasEverything as u8,
105            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
106            false,
107            false,
108            false,
109            false,
110            false,
111            false,
112            0,
113        ).to_ne_bytes()
114    ),
115});
116}
117unsafe extern "C" fn contains<D: DomTypes>
118(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
119    let mut result = false;
120    wrap_panic(&mut || result = (|| {
121        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
122        let this = &*(this as *const D::DOMStringList);
123        let args = &*args;
124        let argc = args.argc_;
125
126        if argc < 1 {
127            throw_type_error(cx.raw_cx(), "Not enough arguments to \"DOMStringList.contains\".");
128            return false;
129        }
130        let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
131            Ok(ConversionResult::Success(value)) => value,
132            Ok(ConversionResult::Failure(error)) => {
133                throw_type_error(cx.raw_cx(), &error);
134        return false;
135
136            }
137            _ => {
138                return false;
139
140            },
141        }
142        ;
143        let result: bool = this.Contains(arg0);
144
145        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
146        return true;
147    })());
148    result
149}
150
151
152static contains_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
153
154pub(crate) fn init_contains_methodinfo<D: DomTypes>() {
155    contains_methodinfo.set(JSJitInfo {
156    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
157        method: Some(contains::<D>)
158    },
159    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
160        protoID: PrototypeList::ID::DOMStringList as u16,
161    },
162    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
163    _bitfield_align_1: [],
164    _bitfield_1: __BindgenBitfieldUnit::new(
165        new_jsjitinfo_bitfield_1!(
166            JSJitInfo_OpType::Method as u8,
167            JSJitInfo_AliasSet::AliasEverything as u8,
168            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
169            false,
170            false,
171            false,
172            false,
173            false,
174            false,
175            0,
176        ).to_ne_bytes()
177    ),
178});
179}
180unsafe extern "C" fn _finalize<D: DomTypes>
181(_cx: *mut GCContext, obj: *mut JSObject){
182    wrap_panic(&mut || {
183
184        let this = native_from_object_static::<D::DOMStringList>(obj).unwrap();
185        finalize_common(this);
186    })
187}
188
189unsafe extern "C" fn _trace<D: DomTypes>
190(trc: *mut JSTracer, obj: *mut JSObject){
191    wrap_panic(&mut || {
192
193        let this = native_from_object_static::<D::DOMStringList>(obj).unwrap();
194        if this.is_null() { return; } // GC during obj creation
195        (*this).trace(trc);
196    })
197}
198
199pub unsafe fn DefineProxyHandler<D: DomTypes>
200() -> *const libc::c_void{
201
202    init_proxy_handler_dom_class::<D>();
203
204    let traps = ProxyTraps {
205        enter: None,
206        getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor::<D>),
207        defineProperty: Some(proxyhandler::define_property),
208        ownPropertyKeys: Some(own_property_keys::<D>),
209        delete_: Some(proxyhandler::delete),
210        enumerate: None,
211        getPrototypeIfOrdinary: Some(proxyhandler::get_prototype_if_ordinary),
212        getPrototype: None,
213        setPrototype: None,
214        setImmutablePrototype: None,
215        preventExtensions: Some(proxyhandler::prevent_extensions),
216        isExtensible: Some(proxyhandler::is_extensible),
217        has: None,
218        get: Some(get::<D>),
219        set: None,
220        call: None,
221        construct: None,
222        hasOwn: Some(hasOwn::<D>),
223        getOwnEnumerablePropertyKeys: Some(own_property_keys::<D>),
224        nativeCall: None,
225        objectClassIs: None,
226        className: Some(className),
227        fun_toString: None,
228        boxedValue_unbox: None,
229        defaultValue: None,
230        trace: Some(_trace::<D>),
231        finalize: Some(_finalize::<D>),
232        objectMoved: None,
233        isCallable: None,
234        isConstructor: None,
235    };
236
237    CreateProxyHandler(&traps, unsafe { Class.get() }.as_void_ptr())
238}
239
240#[inline] unsafe fn UnwrapProxy<D: DomTypes>
241(obj: RawHandleObject) -> *const D::DOMStringList{
242
243            let mut slot = UndefinedValue();
244            GetProxyReservedSlot(obj.get(), 0, &mut slot);
245            let box_ = slot.to_private() as *const D::DOMStringList;
246    return box_;
247}
248
249
250pub static Class: ThreadUnsafeOnceLock<DOMClass> = ThreadUnsafeOnceLock::new();
251
252pub(crate) fn init_proxy_handler_dom_class<D: DomTypes>() {
253    Class.set(
254DOMClass {
255    interface_chain: [ PrototypeList::ID::DOMStringList, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
256    depth: 0,
257    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
258    malloc_size_of: malloc_size_of_including_raw_self::<D::DOMStringList> as unsafe fn(&mut _, _) -> _,
259    global: Globals::EMPTY,
260});
261}
262
263unsafe extern "C" fn own_property_keys<D: DomTypes>
264(cx: *mut RawJSContext, proxy: RawHandleObject, props: RawMutableHandleIdVector) -> bool{
265    let mut result = false;
266    wrap_panic(&mut || result = (|| {
267        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
268        let mut cx = CurrentRealm::assert(&mut cx);
269        let cx = &mut cx;
270        let unwrapped_proxy = UnwrapProxy::<D>(proxy);
271        for i in 0..(*unwrapped_proxy).Length() {
272            rooted!(&in(cx) let mut rooted_jsid: jsid);
273            int_to_jsid(i as i32, rooted_jsid.handle_mut());
274            AppendToIdVector(props, rooted_jsid.handle());
275        }
276        rooted!(&in(cx) let mut expando = ptr::null_mut::<JSObject>());
277        get_expando_object(proxy, expando.handle_mut());
278        if !expando.is_null() &&
279            !GetPropertyKeys(cx.raw_cx(), expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props) {
280            return false;
281        }
282
283        true
284
285    })());
286    result
287}
288
289unsafe extern "C" fn getOwnPropertyDescriptor<D: DomTypes>
290(cx: *mut RawJSContext, proxy: RawHandleObject, id: RawHandleId, mut desc: RawMutableHandle<PropertyDescriptor>, is_none: *mut bool) -> bool{
291    let mut result = false;
292    wrap_panic(&mut || result = (|| {
293        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
294        let mut cx = CurrentRealm::assert(&mut cx);
295        let cx = &mut cx;
296        let index = get_array_index_from_id(Handle::from_raw(id));
297        if let Some(index) = index {
298            let this = UnwrapProxy::<D>(proxy);
299            let this = &*this;
300            let result: Option<DOMString> = this.IndexedGetter(index);
301
302            if let Some(result) = result {
303                rooted!(&in(cx) let mut rval = UndefinedValue());
304                (result).to_jsval(cx.raw_cx(), rval.handle_mut());
305                set_property_descriptor(
306                    MutableHandle::from_raw(desc),
307                    rval.handle(),
308                    (JSPROP_ENUMERATE | JSPROP_READONLY) as u32,
309                    &mut *is_none
310                );
311                return true;
312            }
313        }
314        rooted!(&in(cx) let mut expando = ptr::null_mut::<JSObject>());
315        get_expando_object(proxy, expando.handle_mut());
316        //if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
317        let proxy_lt = Handle::from_raw(proxy);
318        let id_lt = Handle::from_raw(id);
319        if !expando.is_null() {
320            rooted!(&in(cx) let mut ignored = ptr::null_mut::<JSObject>());
321            if !JS_GetPropertyDescriptorById(cx.raw_cx(), expando.handle().into(), id, desc, ignored.handle_mut().into(), is_none) {
322                return false;
323            }
324            if !*is_none {
325                // Pretend the property lives on the wrapper.
326                return true;
327            }
328        }
329        true
330    })());
331    result
332}
333
334unsafe extern "C" fn className(cx: *mut RawJSContext, _proxy: RawHandleObject) -> *const libc::c_char{
335    c"DOMStringList".as_ptr()
336}
337
338unsafe extern "C" fn get<D: DomTypes>
339(cx: *mut RawJSContext, proxy: RawHandleObject, receiver: RawHandleValue, id: RawHandleId, vp: RawMutableHandleValue) -> bool{
340    let mut result = false;
341    wrap_panic(&mut || result = (|| {
342
343        //MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
344        //"Should not have a XrayWrapper here");
345        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
346        let mut cx = CurrentRealm::assert(&mut cx);
347        let cx = &mut cx;
348
349
350
351        let proxy_lt = Handle::from_raw(proxy);
352        let mut vp_lt = MutableHandle::from_raw(vp);
353        let id_lt = Handle::from_raw(id);
354        let receiver_lt = Handle::from_raw(receiver);
355
356        let index = get_array_index_from_id(id_lt);
357        if let Some(index) = index {
358            let this = UnwrapProxy::<D>(proxy);
359            let this = &*this;
360            let result: Option<DOMString> = this.IndexedGetter(index);
361
362            if let Some(result) = result {
363
364                (result).to_jsval(cx.raw_cx(), vp_lt);
365                return true;
366            }
367            // Even if we don't have this index, we don't forward the
368            // get on to our expando object.
369        } else {
370            rooted!(&in(cx) let mut expando = ptr::null_mut::<JSObject>());
371            get_expando_object(proxy, expando.handle_mut());
372            if !expando.is_null() {
373                let mut hasProp = false;
374                if !JS_HasPropertyById(cx.raw_cx(), expando.handle().into(), id, &mut hasProp) {
375                    return false;
376                }
377
378                if hasProp {
379                    return JS_ForwardGetPropertyTo(cx.raw_cx(), expando.handle().into(), id, receiver, vp);
380                }
381            }
382        }
383
384        let mut found = false;
385        if !get_property_on_prototype(cx.raw_cx(), proxy_lt, receiver_lt, id_lt, &mut found, vp_lt.reborrow()) {
386            return false;
387        }
388
389        if found {
390            return true;
391        }
392
393        vp.set(UndefinedValue());
394        true
395    })());
396    result
397}
398
399unsafe extern "C" fn hasOwn<D: DomTypes>
400(cx: *mut RawJSContext, proxy: RawHandleObject, id: RawHandleId, bp: *mut bool) -> bool{
401    let mut result = false;
402    wrap_panic(&mut || result = (|| {
403        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
404        let mut cx = CurrentRealm::assert(&mut cx);
405        let cx = &mut cx;
406        let index = get_array_index_from_id(Handle::from_raw(id));
407        if let Some(index) = index {
408            let this = UnwrapProxy::<D>(proxy);
409            let this = &*this;
410            let result: Option<DOMString> = this.IndexedGetter(index);
411
412            *bp = result.is_some();
413            return true;
414        }
415
416        rooted!(&in(cx) let mut expando = ptr::null_mut::<JSObject>());
417        let proxy_lt = Handle::from_raw(proxy);
418        let id_lt = Handle::from_raw(id);
419        get_expando_object(proxy, expando.handle_mut());
420        if !expando.is_null() {
421            let ok = JS_HasPropertyById(cx.raw_cx(), expando.handle().into(), id, bp);
422            if !ok || *bp {
423                return ok;
424            }
425        }
426        *bp = false;
427        true
428    })());
429    result
430}
431
432#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
433(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::DOMStringList>, _can_gc: CanGc) -> DomRoot<D::DOMStringList>{
434
435    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
436
437    let scope = scope.reflector().get_jsobject();
438    assert!(!scope.get().is_null());
439    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
440    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
441
442    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
443    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
444    assert!(!canonical_proto.is_null());
445
446
447    let handler: *const libc::c_void =
448        RegisterBindings::proxy_handlers::DOMStringList
449        .load(std::sync::atomic::Ordering::Acquire);
450    rooted!(&in(cx) let obj = NewProxyObject(
451        cx.raw_cx(),
452        handler,
453        Handle::from_raw(UndefinedHandleValue),
454        canonical_proto.get(),
455        ptr::null(),
456        false,
457    ));
458    assert!(!obj.is_null());
459    SetProxyReservedSlot(
460        obj.get(),
461        0,
462        &PrivateValue(raw.as_ptr() as *const libc::c_void),
463    );
464
465    let root = raw.reflect_with(obj.get());
466
467
468
469    DomRoot::from_ref(&*root)
470}
471
472pub trait DOMStringListMethods<D: DomTypes> {
473    fn Length(&self, ) -> u32;
474    fn Item(&self, r#index: u32) -> Option<DOMString>;
475    fn Contains(&self, r#string: DOMString) -> bool;
476    fn IndexedGetter(&self, r#index: u32) -> Option<DOMString>;
477}
478static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
479
480pub(crate) fn init_sMethods_specs<D: DomTypes>() {
481    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
482    JSFunctionSpec {
483        name: JSPropertySpec_Name { string_: c"item".as_ptr() },
484        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { item_methodinfo.get() } as *const _ as *const JSJitInfo },
485        nargs: 1,
486        flags: (JSPROP_ENUMERATE) as u16,
487        selfHostedName: ptr::null()
488    },
489    JSFunctionSpec {
490        name: JSPropertySpec_Name { string_: c"contains".as_ptr() },
491        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { contains_methodinfo.get() } as *const _ as *const JSJitInfo },
492        nargs: 1,
493        flags: (JSPROP_ENUMERATE) as u16,
494        selfHostedName: ptr::null()
495    },
496    JSFunctionSpec {
497        name: JSPropertySpec_Name { string_: ptr::null() },
498        call: JSNativeWrapper { op: None, info: ptr::null() },
499        nargs: 0,
500        flags: 0,
501        selfHostedName: ptr::null()
502    }]))[..]
503,
504&Box::leak(Box::new([
505    JSFunctionSpec {
506        name: JSPropertySpec_Name { symbol_: SymbolCode::iterator as usize + 1 },
507        call: JSNativeWrapper { op: None, info: ptr::null() },
508        nargs: 0,
509        flags: 0,
510        selfHostedName: c"$ArrayValues".as_ptr()
511    },
512    JSFunctionSpec {
513        name: JSPropertySpec_Name { string_: ptr::null() },
514        call: JSNativeWrapper { op: None, info: ptr::null() },
515        nargs: 0,
516        flags: 0,
517        selfHostedName: ptr::null()
518    }]))[..]
519])));
520}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
521
522pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
523    sMethods.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0]),
524    Guard::new(&[Condition::Satisfied], (unsafe { sMethods_specs.get() })[1])])));
525}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
526
527pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
528    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
529    JSPropertySpec {
530                    name: JSPropertySpec_Name { string_: c"length".as_ptr() },
531                    attributes_: (JSPROP_ENUMERATE),
532                    kind_: (JSPropertySpec_Kind::NativeAccessor),
533                    u: JSPropertySpec_AccessorsOrValue {
534                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
535                            getter: JSPropertySpec_Accessor {
536                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { length_getterinfo.get() } },
537                            },
538                            setter: JSPropertySpec_Accessor {
539                                native: JSNativeWrapper { op: None, info: ptr::null() },
540                            }
541                        }
542                    }
543                }
544,
545    JSPropertySpec::ZERO]))[..]
546,
547&Box::leak(Box::new([
548    JSPropertySpec {
549                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
550                    attributes_: (JSPROP_READONLY),
551                    kind_: (JSPropertySpec_Kind::Value),
552                    u: JSPropertySpec_AccessorsOrValue {
553                        value: JSPropertySpec_ValueWrapper {
554                            type_: JSPropertySpec_ValueWrapper_Type::String,
555                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
556                                string: c"DOMStringList".as_ptr(),
557                            }
558                        }
559                    }
560                }
561,
562    JSPropertySpec::ZERO]))[..]
563])));
564}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
565
566pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
567    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
568    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
569}
570pub fn GetProtoObject<D: DomTypes>
571(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
572    /* Get the interface prototype object for this class.  This will create the
573       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::DOMStringList), CreateInterfaceObjects::<D>, rval)
574}
575
576
577static PrototypeClass: JSClass = JSClass {
578    name: c"DOMStringListPrototype".as_ptr(),
579    flags:
580        // JSCLASS_HAS_RESERVED_SLOTS()
581        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
582    cOps: ptr::null(),
583    spec: ptr::null(),
584    ext: ptr::null(),
585    oOps: ptr::null(),
586};
587
588
589static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
590
591pub(crate) fn init_interface_object<D: DomTypes>() {
592    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
593        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
594        b"function DOMStringList() {\n    [native code]\n}",
595        PrototypeList::ID::DOMStringList,
596        0,
597    ));
598}
599
600pub fn DefineDOMInterface<D: DomTypes>
601(cx: SafeJSContext, global: HandleObject){
602    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::DOMStringList),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
603}
604
605pub fn ConstructorEnabled<D: DomTypes>
606(aCx: SafeJSContext, aObj: HandleObject) -> bool{
607    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW)
608}
609
610unsafe fn CreateInterfaceObjects<D: DomTypes>
611(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
612
613    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
614    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
615    assert!(!prototype_proto.is_null());
616
617    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
618    create_interface_prototype_object::<D>(cx,
619                                      global,
620                                      prototype_proto.handle(),
621                                      &PrototypeClass,
622                                      sMethods.get(),
623                                      sAttributes.get(),
624                                      &[],
625                                      &[],
626                                      prototype.handle_mut());
627    assert!(!prototype.is_null());
628    assert!((*cache)[PrototypeList::ID::DOMStringList as usize].is_null());
629    (*cache)[PrototypeList::ID::DOMStringList as usize] = prototype.get();
630    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::DOMStringList as isize),
631                                  ptr::null_mut(),
632                                  prototype.get());
633
634    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
635    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
636
637    assert!(!interface_proto.is_null());
638
639    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
640    create_noncallback_interface_object::<D>(cx,
641                                        global,
642                                        interface_proto.handle(),
643                                        INTERFACE_OBJECT_CLASS.get(),
644                                        &[],
645                                        &[],
646                                        &[],
647                                        prototype.handle(),
648                                        c"DOMStringList",
649                                        0,
650                                        &[],
651                                        interface.handle_mut());
652    assert!(!interface.is_null());
653}
654
655
656        pub(crate) fn init_statics<D: DomTypes>() {
657            init_interface_object::<D>();
658
659            crate::codegen::GenericBindings::DOMStringListBinding::DOMStringList_Binding::init_item_methodinfo::<D>();
660crate::codegen::GenericBindings::DOMStringListBinding::DOMStringList_Binding::init_contains_methodinfo::<D>();
661            init_length_getterinfo::<D>();
662
663
664            init_sMethods_specs::<D>();
665init_sMethods_prefs::<D>();
666init_sAttributes_specs::<D>();
667init_sAttributes_prefs::<D>();
668        }
669        } // mod DOMStringList_Binding
670
671