script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
TestBindingSetlikeWithInterfaceBinding.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::EventTargetBinding::EventTarget_Binding;
6use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
7use crate::import::base::*;
8
9pub use self::TestBindingSetlikeWithInterface_Binding::{Wrap as TestBindingSetlikeWithInterfaceWrap, TestBindingSetlikeWithInterfaceMethods, GetProtoObject as TestBindingSetlikeWithInterfaceGetProtoObject, DefineDOMInterface as TestBindingSetlikeWithInterfaceDefineDOMInterface};
10pub mod TestBindingSetlikeWithInterface_Binding {
11use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
12use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
13use crate::import::module::*;
14
15unsafe extern "C" fn get_size<D: DomTypes>
16(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17    let mut result = false;
18    wrap_panic(&mut || result = (|| {
19        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
21        let result: u32 = this.Size();
22
23        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24        return true;
25    })());
26    result
27}
28
29
30static size_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
31
32pub(crate) fn init_size_getterinfo<D: DomTypes>() {
33    size_getterinfo.set(JSJitInfo {
34    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
35        getter: Some(get_size::<D>)
36    },
37    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
38        protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
39    },
40    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
41    _bitfield_align_1: [],
42    _bitfield_1: __BindgenBitfieldUnit::new(
43        new_jsjitinfo_bitfield_1!(
44            JSJitInfo_OpType::Getter as u8,
45            JSJitInfo_AliasSet::AliasEverything as u8,
46            JSValueType::JSVAL_TYPE_DOUBLE as u8,
47            true,
48            false,
49            false,
50            false,
51            false,
52            false,
53            0,
54        ).to_ne_bytes()
55    ),
56});
57}
58unsafe extern "C" fn entries<D: DomTypes>
59(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
60    let mut result = false;
61    wrap_panic(&mut || result = (|| {
62        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
63        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
64        let args = &*args;
65        let argc = args.argc_;
66        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
67        let result = crate::iterable::IterableIterator::new(this, IteratorType::Entries, InRealm::already(&realm));
68
69
70        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
71        return true;
72    })());
73    result
74}
75
76const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
77static entries_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
78
79pub(crate) fn init_entries_methodinfo<D: DomTypes>() {
80    entries_methodinfo.set(JSTypedMethodJitInfo {
81        base:   JSJitInfo {
82      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
83          method: Some(entries::<D>)
84      },
85      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
86          protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
87      },
88      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
89      _bitfield_align_1: [],
90      _bitfield_1: __BindgenBitfieldUnit::new(
91          new_jsjitinfo_bitfield_1!(
92              JSJitInfo_OpType::Method as u8,
93              JSJitInfo_AliasSet::AliasEverything as u8,
94              JSValueType::JSVAL_TYPE_OBJECT as u8,
95              false,
96              false,
97              false,
98              false,
99              false,
100              true,
101              0,
102          ).to_ne_bytes()
103      ),
104  },
105        argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
106    });
107}
108
109unsafe extern "C" fn keys<D: DomTypes>
110(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
111    let mut result = false;
112    wrap_panic(&mut || result = (|| {
113        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
114        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
115        let args = &*args;
116        let argc = args.argc_;
117        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
118        let result = crate::iterable::IterableIterator::new(this, IteratorType::Keys, InRealm::already(&realm));
119
120
121        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
122        return true;
123    })());
124    result
125}
126
127const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
128static keys_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
129
130pub(crate) fn init_keys_methodinfo<D: DomTypes>() {
131    keys_methodinfo.set(JSTypedMethodJitInfo {
132        base:   JSJitInfo {
133      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
134          method: Some(keys::<D>)
135      },
136      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
137          protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
138      },
139      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
140      _bitfield_align_1: [],
141      _bitfield_1: __BindgenBitfieldUnit::new(
142          new_jsjitinfo_bitfield_1!(
143              JSJitInfo_OpType::Method as u8,
144              JSJitInfo_AliasSet::AliasEverything as u8,
145              JSValueType::JSVAL_TYPE_OBJECT as u8,
146              false,
147              false,
148              false,
149              false,
150              false,
151              true,
152              0,
153          ).to_ne_bytes()
154      ),
155  },
156        argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
157    });
158}
159
160unsafe extern "C" fn values<D: DomTypes>
161(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
162    let mut result = false;
163    wrap_panic(&mut || result = (|| {
164        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
165        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
166        let args = &*args;
167        let argc = args.argc_;
168        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
169        let result = crate::iterable::IterableIterator::new(this, IteratorType::Values, InRealm::already(&realm));
170
171
172        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
173        return true;
174    })());
175    result
176}
177
178const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
179static values_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
180
181pub(crate) fn init_values_methodinfo<D: DomTypes>() {
182    values_methodinfo.set(JSTypedMethodJitInfo {
183        base:   JSJitInfo {
184      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
185          method: Some(values::<D>)
186      },
187      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
188          protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
189      },
190      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
191      _bitfield_align_1: [],
192      _bitfield_1: __BindgenBitfieldUnit::new(
193          new_jsjitinfo_bitfield_1!(
194              JSJitInfo_OpType::Method as u8,
195              JSJitInfo_AliasSet::AliasEverything as u8,
196              JSValueType::JSVAL_TYPE_OBJECT as u8,
197              false,
198              false,
199              false,
200              false,
201              false,
202              true,
203              0,
204          ).to_ne_bytes()
205      ),
206  },
207        argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
208    });
209}
210
211unsafe extern "C" fn forEach<D: DomTypes>
212(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
213    let mut result = false;
214    wrap_panic(&mut || result = (|| {
215        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
216        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
217        let args = &*args;
218        let argc = args.argc_;
219
220        if argc < 1 {
221            throw_type_error(cx.raw_cx(), "Not enough arguments to \"TestBindingSetlikeWithInterface.forEach\".");
222            return false;
223        }
224        let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
225            HandleValue::from_raw(args.get(0)).get().to_object()
226        } else {
227            throw_type_error(cx.raw_cx(), "Value is not an object.");
228            return false;
229
230        };
231        let arg1: HandleValue = if args.get(1).is_undefined() {
232            HandleValue::undefined()
233        } else {
234            HandleValue::from_raw(args.get(1))
235        };
236        if !IsCallable(arg0) {
237          throw_type_error(cx.raw_cx(), "Argument 1 of TestBindingSetlikeWithInterface.forEach is not callable.");
238          return false;
239        }
240        rooted!(&in(cx) let arg0 = ObjectValue(arg0));
241        rooted!(&in(cx) let mut call_arg1 = UndefinedValue());
242        rooted!(&in(cx) let mut call_arg2 = UndefinedValue());
243        rooted_vec!(let mut call_args);
244        call_args.push(UndefinedValue());
245        call_args.push(UndefinedValue());
246        call_args.push(ObjectValue(*_obj));
247        rooted!(&in(cx) let mut ignoredReturnVal = UndefinedValue());
248
249        // This has to be a while loop since get_iterable_length() may change during
250        // the callback, and we need to avoid iterator invalidation.
251        //
252        // It is possible for this to loop infinitely, but that matches the spec
253        // and other browsers.
254        //
255        // https://heycam.github.io/webidl/#es-forEach
256        let mut i = 0;
257        while i < (*this).get_iterable_length() {
258          (*this).get_value_at_index(i).to_jsval(cx.raw_cx(), call_arg1.handle_mut());
259          (*this).get_key_at_index(i).to_jsval(cx.raw_cx(), call_arg2.handle_mut());
260          call_args[0] = call_arg1.handle().get();
261          call_args[1] = call_arg2.handle().get();
262          let call_args_handle = HandleValueArray::from(&call_args);
263          if !Call(cx.raw_cx(), arg1, arg0.handle(), &call_args_handle,
264                   ignoredReturnVal.handle_mut()) {
265            return false;
266          }
267
268          i += 1;
269        }
270
271        let result = ();
272
273
274        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
275        return true;
276    })());
277    result
278}
279
280
281static forEach_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
282
283pub(crate) fn init_forEach_methodinfo<D: DomTypes>() {
284    forEach_methodinfo.set(JSJitInfo {
285    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
286        method: Some(forEach::<D>)
287    },
288    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
289        protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
290    },
291    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
292    _bitfield_align_1: [],
293    _bitfield_1: __BindgenBitfieldUnit::new(
294        new_jsjitinfo_bitfield_1!(
295            JSJitInfo_OpType::Method as u8,
296            JSJitInfo_AliasSet::AliasEverything as u8,
297            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
298            false,
299            false,
300            false,
301            false,
302            false,
303            false,
304            0,
305        ).to_ne_bytes()
306    ),
307});
308}
309unsafe extern "C" fn has<D: DomTypes>
310(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
311    let mut result = false;
312    wrap_panic(&mut || result = (|| {
313        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
314        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
315        let args = &*args;
316        let argc = args.argc_;
317
318        if argc < 1 {
319            throw_type_error(cx.raw_cx(), "Not enough arguments to \"TestBindingSetlikeWithInterface.has\".");
320            return false;
321        }
322        let arg0: DomRoot<D::TestBinding> = if HandleValue::from_raw(args.get(0)).get().is_object() {
323            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
324                Ok(val) => val,
325                Err(()) => {
326                    throw_type_error(cx.raw_cx(), "value does not implement interface TestBinding.");
327                    return false;
328
329                }
330            }
331
332        } else {
333            throw_type_error(cx.raw_cx(), "Value is not an object.");
334            return false;
335
336        };
337        let result = Setlike::has(this, arg0);
338
339
340        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
341        return true;
342    })());
343    result
344}
345
346const has_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::Object as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
347static has_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
348
349pub(crate) fn init_has_methodinfo<D: DomTypes>() {
350    has_methodinfo.set(JSTypedMethodJitInfo {
351        base:   JSJitInfo {
352      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
353          method: Some(has::<D>)
354      },
355      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
356          protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
357      },
358      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
359      _bitfield_align_1: [],
360      _bitfield_1: __BindgenBitfieldUnit::new(
361          new_jsjitinfo_bitfield_1!(
362              JSJitInfo_OpType::Method as u8,
363              JSJitInfo_AliasSet::AliasDOMSets as u8,
364              JSValueType::JSVAL_TYPE_BOOLEAN as u8,
365              false,
366              false,
367              false,
368              false,
369              false,
370              true,
371              0,
372          ).to_ne_bytes()
373      ),
374  },
375        argTypes: &has_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
376    });
377}
378
379unsafe extern "C" fn clear<D: DomTypes>
380(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
381    let mut result = false;
382    wrap_panic(&mut || result = (|| {
383        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
384        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
385        let args = &*args;
386        let argc = args.argc_;
387        let result = Setlike::clear(this);
388
389
390        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
391        return true;
392    })());
393    result
394}
395
396
397static clear_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
398
399pub(crate) fn init_clear_methodinfo<D: DomTypes>() {
400    clear_methodinfo.set(JSJitInfo {
401    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
402        method: Some(clear::<D>)
403    },
404    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
405        protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
406    },
407    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
408    _bitfield_align_1: [],
409    _bitfield_1: __BindgenBitfieldUnit::new(
410        new_jsjitinfo_bitfield_1!(
411            JSJitInfo_OpType::Method as u8,
412            JSJitInfo_AliasSet::AliasEverything as u8,
413            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
414            false,
415            false,
416            false,
417            false,
418            false,
419            false,
420            0,
421        ).to_ne_bytes()
422    ),
423});
424}
425unsafe extern "C" fn delete<D: DomTypes>
426(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
427    let mut result = false;
428    wrap_panic(&mut || result = (|| {
429        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
430        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
431        let args = &*args;
432        let argc = args.argc_;
433
434        if argc < 1 {
435            throw_type_error(cx.raw_cx(), "Not enough arguments to \"TestBindingSetlikeWithInterface.delete\".");
436            return false;
437        }
438        let arg0: DomRoot<D::TestBinding> = if HandleValue::from_raw(args.get(0)).get().is_object() {
439            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
440                Ok(val) => val,
441                Err(()) => {
442                    throw_type_error(cx.raw_cx(), "value does not implement interface TestBinding.");
443                    return false;
444
445                }
446            }
447
448        } else {
449            throw_type_error(cx.raw_cx(), "Value is not an object.");
450            return false;
451
452        };
453        let result = Setlike::delete(this, arg0);
454
455
456        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
457        return true;
458    })());
459    result
460}
461
462
463static delete_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
464
465pub(crate) fn init_delete_methodinfo<D: DomTypes>() {
466    delete_methodinfo.set(JSJitInfo {
467    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
468        method: Some(delete::<D>)
469    },
470    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
471        protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
472    },
473    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
474    _bitfield_align_1: [],
475    _bitfield_1: __BindgenBitfieldUnit::new(
476        new_jsjitinfo_bitfield_1!(
477            JSJitInfo_OpType::Method as u8,
478            JSJitInfo_AliasSet::AliasEverything as u8,
479            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
480            false,
481            false,
482            false,
483            false,
484            false,
485            false,
486            0,
487        ).to_ne_bytes()
488    ),
489});
490}
491unsafe extern "C" fn add<D: DomTypes>
492(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
493    let mut result = false;
494    wrap_panic(&mut || result = (|| {
495        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
496        let this = &*(this as *const D::TestBindingSetlikeWithInterface);
497        let args = &*args;
498        let argc = args.argc_;
499
500        if argc < 1 {
501            throw_type_error(cx.raw_cx(), "Not enough arguments to \"TestBindingSetlikeWithInterface.add\".");
502            return false;
503        }
504        let arg0: DomRoot<D::TestBinding> = if HandleValue::from_raw(args.get(0)).get().is_object() {
505            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
506                Ok(val) => val,
507                Err(()) => {
508                    throw_type_error(cx.raw_cx(), "value does not implement interface TestBinding.");
509                    return false;
510
511                }
512            }
513
514        } else {
515            throw_type_error(cx.raw_cx(), "Value is not an object.");
516            return false;
517
518        };
519        Setlike::add(this, arg0);
520        // Returns itself per https://webidl.spec.whatwg.org/#es-set-add
521        let result = this;
522
523
524        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
525        return true;
526    })());
527    result
528}
529
530
531static add_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
532
533pub(crate) fn init_add_methodinfo<D: DomTypes>() {
534    add_methodinfo.set(JSJitInfo {
535    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
536        method: Some(add::<D>)
537    },
538    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
539        protoID: PrototypeList::ID::TestBindingSetlikeWithInterface as u16,
540    },
541    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
542    _bitfield_align_1: [],
543    _bitfield_1: __BindgenBitfieldUnit::new(
544        new_jsjitinfo_bitfield_1!(
545            JSJitInfo_OpType::Method as u8,
546            JSJitInfo_AliasSet::AliasEverything as u8,
547            JSValueType::JSVAL_TYPE_OBJECT as u8,
548            false,
549            false,
550            false,
551            false,
552            false,
553            false,
554            0,
555        ).to_ne_bytes()
556    ),
557});
558}
559unsafe extern "C" fn _finalize<D: DomTypes>
560(_cx: *mut GCContext, obj: *mut JSObject){
561    wrap_panic(&mut || {
562
563        let this = native_from_object_static::<D::TestBindingSetlikeWithInterface>(obj).unwrap();
564        finalize_common(this);
565    })
566}
567
568unsafe extern "C" fn _trace<D: DomTypes>
569(trc: *mut JSTracer, obj: *mut JSObject){
570    wrap_panic(&mut || {
571
572        let this = native_from_object_static::<D::TestBindingSetlikeWithInterface>(obj).unwrap();
573        if this.is_null() { return; } // GC during obj creation
574        (*this).trace(trc);
575    })
576}
577
578
579static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
580
581pub(crate) fn init_class_ops<D: DomTypes>() {
582    CLASS_OPS.set(JSClassOps {
583        addProperty: None,
584        delProperty: None,
585        enumerate: None,
586        newEnumerate: None,
587        resolve: None,
588        mayResolve: None,
589        finalize: Some(_finalize::<D>),
590        call: None,
591        construct: None,
592        trace: Some(_trace::<D>),
593    });
594}
595
596pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
597
598pub(crate) fn init_domjs_class<D: DomTypes>() {
599    init_class_ops::<D>();
600    Class.set(DOMJSClass {
601        base: JSClass {
602            name: c"TestBindingSetlikeWithInterface".as_ptr(),
603            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
604                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
605                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
606            cOps: unsafe { CLASS_OPS.get() },
607            spec: ptr::null(),
608            ext: ptr::null(),
609            oOps: ptr::null(),
610        },
611        dom_class:
612DOMClass {
613    interface_chain: [ PrototypeList::ID::TestBindingSetlikeWithInterface, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
614    depth: 0,
615    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
616    malloc_size_of: malloc_size_of_including_raw_self::<D::TestBindingSetlikeWithInterface> as unsafe fn(&mut _, _) -> _,
617    global: Globals::EMPTY,
618},
619    });
620}
621
622#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
623(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::TestBindingSetlikeWithInterface>, _can_gc: CanGc) -> DomRoot<D::TestBindingSetlikeWithInterface>{
624
625    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
626
627    let scope = scope.reflector().get_jsobject();
628    assert!(!scope.get().is_null());
629    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
630    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
631
632    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
633    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
634    assert!(!canonical_proto.is_null());
635
636
637    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
638    if let Some(given) = given_proto {
639        proto.set(*given);
640        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
641            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
642        }
643    } else {
644        proto.set(*canonical_proto);
645    }
646    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
647        cx.raw_cx(),
648        &Class.get().base,
649        proto.handle(),
650    ));
651    assert!(!obj.is_null());
652    JS_SetReservedSlot(
653        obj.get(),
654        DOM_OBJECT_SLOT,
655        &PrivateValue(raw.as_ptr() as *const libc::c_void),
656    );
657
658    let root = raw.reflect_with(obj.get());
659
660
661
662    DomRoot::from_ref(&*root)
663}
664
665pub trait TestBindingSetlikeWithInterfaceMethods<D: DomTypes> {
666    fn Size(&self, ) -> u32;
667    fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc) -> Fallible<DomRoot<D::TestBindingSetlikeWithInterface>>;
668}
669static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
670
671pub(crate) fn init_sMethods_specs<D: DomTypes>() {
672    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
673    JSFunctionSpec {
674        name: JSPropertySpec_Name { string_: c"entries".as_ptr() },
675        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { entries_methodinfo.get() } as *const _ as *const JSJitInfo },
676        nargs: 0,
677        flags: (JSPROP_ENUMERATE) as u16,
678        selfHostedName: ptr::null()
679    },
680    JSFunctionSpec {
681        name: JSPropertySpec_Name { string_: c"keys".as_ptr() },
682        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { keys_methodinfo.get() } as *const _ as *const JSJitInfo },
683        nargs: 0,
684        flags: (JSPROP_ENUMERATE) as u16,
685        selfHostedName: ptr::null()
686    },
687    JSFunctionSpec {
688        name: JSPropertySpec_Name { string_: c"values".as_ptr() },
689        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { values_methodinfo.get() } as *const _ as *const JSJitInfo },
690        nargs: 0,
691        flags: (JSPROP_ENUMERATE) as u16,
692        selfHostedName: ptr::null()
693    },
694    JSFunctionSpec {
695        name: JSPropertySpec_Name { string_: c"forEach".as_ptr() },
696        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { forEach_methodinfo.get() } as *const _ as *const JSJitInfo },
697        nargs: 1,
698        flags: (JSPROP_ENUMERATE) as u16,
699        selfHostedName: ptr::null()
700    },
701    JSFunctionSpec {
702        name: JSPropertySpec_Name { string_: c"has".as_ptr() },
703        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
704        nargs: 1,
705        flags: (JSPROP_ENUMERATE) as u16,
706        selfHostedName: ptr::null()
707    },
708    JSFunctionSpec {
709        name: JSPropertySpec_Name { string_: c"clear".as_ptr() },
710        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { clear_methodinfo.get() } as *const _ as *const JSJitInfo },
711        nargs: 0,
712        flags: (JSPROP_ENUMERATE) as u16,
713        selfHostedName: ptr::null()
714    },
715    JSFunctionSpec {
716        name: JSPropertySpec_Name { string_: c"delete".as_ptr() },
717        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { delete_methodinfo.get() } as *const _ as *const JSJitInfo },
718        nargs: 1,
719        flags: (JSPROP_ENUMERATE) as u16,
720        selfHostedName: ptr::null()
721    },
722    JSFunctionSpec {
723        name: JSPropertySpec_Name { string_: c"add".as_ptr() },
724        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { add_methodinfo.get() } as *const _ as *const JSJitInfo },
725        nargs: 1,
726        flags: (JSPROP_ENUMERATE) as u16,
727        selfHostedName: ptr::null()
728    },
729    JSFunctionSpec {
730        name: JSPropertySpec_Name { string_: ptr::null() },
731        call: JSNativeWrapper { op: None, info: ptr::null() },
732        nargs: 0,
733        flags: 0,
734        selfHostedName: ptr::null()
735    }]))[..]
736])));
737}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
738
739pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
740    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])])));
741}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
742
743pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
744    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
745    JSPropertySpec {
746                    name: JSPropertySpec_Name { string_: c"size".as_ptr() },
747                    attributes_: (JSPROP_ENUMERATE),
748                    kind_: (JSPropertySpec_Kind::NativeAccessor),
749                    u: JSPropertySpec_AccessorsOrValue {
750                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
751                            getter: JSPropertySpec_Accessor {
752                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { size_getterinfo.get() } },
753                            },
754                            setter: JSPropertySpec_Accessor {
755                                native: JSNativeWrapper { op: None, info: ptr::null() },
756                            }
757                        }
758                    }
759                }
760,
761    JSPropertySpec::ZERO]))[..]
762,
763&Box::leak(Box::new([
764    JSPropertySpec {
765                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
766                    attributes_: (JSPROP_READONLY),
767                    kind_: (JSPropertySpec_Kind::Value),
768                    u: JSPropertySpec_AccessorsOrValue {
769                        value: JSPropertySpec_ValueWrapper {
770                            type_: JSPropertySpec_ValueWrapper_Type::String,
771                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
772                                string: c"TestBindingSetlikeWithInterface".as_ptr(),
773                            }
774                        }
775                    }
776                }
777,
778    JSPropertySpec::ZERO]))[..]
779])));
780}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
781
782pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
783    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]),
784    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
785}
786pub fn GetProtoObject<D: DomTypes>
787(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
788    /* Get the interface prototype object for this class.  This will create the
789       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::TestBindingSetlikeWithInterface), CreateInterfaceObjects::<D>, rval)
790}
791
792
793static PrototypeClass: JSClass = JSClass {
794    name: c"TestBindingSetlikeWithInterfacePrototype".as_ptr(),
795    flags:
796        // JSCLASS_HAS_RESERVED_SLOTS()
797        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
798    cOps: ptr::null(),
799    spec: ptr::null(),
800    ext: ptr::null(),
801    oOps: ptr::null(),
802};
803
804unsafe extern "C" fn _constructor<D: DomTypes>
805(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
806    let mut result = false;
807    wrap_panic(&mut || result = {
808        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
809        let args = CallArgs::from_vp(vp, argc);
810        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
811
812                    call_default_constructor::<D>(
813                        SafeJSContext::from_ptr(cx.raw_cx()),
814                        &args,
815                        &global,
816                        PrototypeList::ID::TestBindingSetlikeWithInterface,
817                        "TestBindingSetlikeWithInterface",
818                        CreateInterfaceObjects::<D>,
819                        |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
820                            let result: Result<DomRoot<D::TestBindingSetlikeWithInterface>, Error> = <D::TestBindingSetlikeWithInterface>::Constructor(global, Some(desired_proto), CanGc::note());
821        let result = match result {
822            Ok(result) => result,
823            Err(e) => {
824                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
825                return false;
826            },
827        };
828
829        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
830        return true;
831                        }
832                    )
833
834    });
835    result
836}
837
838
839static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
840
841pub(crate) fn init_interface_object<D: DomTypes>() {
842    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
843        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
844        b"function TestBindingSetlikeWithInterface() {\n    [native code]\n}",
845        PrototypeList::ID::TestBindingSetlikeWithInterface,
846        0,
847    ));
848}
849
850pub fn DefineDOMInterface<D: DomTypes>
851(cx: SafeJSContext, global: HandleObject){
852    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::TestBindingSetlikeWithInterface),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
853}
854
855pub fn ConstructorEnabled<D: DomTypes>
856(aCx: SafeJSContext, aObj: HandleObject) -> bool{
857    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
858    pref!(dom_testbinding_enabled)
859}
860
861unsafe fn CreateInterfaceObjects<D: DomTypes>
862(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
863
864    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
865    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
866    assert!(!prototype_proto.is_null());
867
868    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
869    create_interface_prototype_object::<D>(cx,
870                                      global,
871                                      prototype_proto.handle(),
872                                      &PrototypeClass,
873                                      sMethods.get(),
874                                      sAttributes.get(),
875                                      &[],
876                                      &[],
877                                      prototype.handle_mut());
878    assert!(!prototype.is_null());
879    assert!((*cache)[PrototypeList::ID::TestBindingSetlikeWithInterface as usize].is_null());
880    (*cache)[PrototypeList::ID::TestBindingSetlikeWithInterface as usize] = prototype.get();
881    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::TestBindingSetlikeWithInterface as isize),
882                                  ptr::null_mut(),
883                                  prototype.get());
884
885    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
886    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
887
888    assert!(!interface_proto.is_null());
889
890    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
891    create_noncallback_interface_object::<D>(cx,
892                                        global,
893                                        interface_proto.handle(),
894                                        INTERFACE_OBJECT_CLASS.get(),
895                                        &[],
896                                        &[],
897                                        &[],
898                                        prototype.handle(),
899                                        c"TestBindingSetlikeWithInterface",
900                                        0,
901                                        &[],
902                                        interface.handle_mut());
903    assert!(!interface.is_null());
904    // Set up aliases on the interface prototype object we just created.
905
906    rooted!(&in(cx) let mut aliasedVal = UndefinedValue());
907
908    assert!(JS_GetProperty(cx.raw_cx(), prototype.handle(),
909                           c"values".as_ptr() as *const u8 as *const _,
910                           aliasedVal.handle_mut()));
911    rooted!(&in(cx) let mut iteratorId: jsid);
912    RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(cx.raw_cx(), SymbolCode::iterator),                                   iteratorId.handle_mut());
913
914    assert!(JS_DefinePropertyById2(cx.raw_cx(), prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
915
916}
917
918
919        pub(crate) fn init_statics<D: DomTypes>() {
920            init_interface_object::<D>();
921            init_domjs_class::<D>();
922            crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_entries_methodinfo::<D>();
923crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_keys_methodinfo::<D>();
924crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_values_methodinfo::<D>();
925crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_forEach_methodinfo::<D>();
926crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_has_methodinfo::<D>();
927crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_clear_methodinfo::<D>();
928crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_delete_methodinfo::<D>();
929crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterface_Binding::init_add_methodinfo::<D>();
930            init_size_getterinfo::<D>();
931
932
933            init_sMethods_specs::<D>();
934init_sMethods_prefs::<D>();
935init_sAttributes_specs::<D>();
936init_sAttributes_prefs::<D>();
937        }
938        } // mod TestBindingSetlikeWithInterface_Binding
939
940
941pub use self::TestBindingSetlikeWithInterfaceSetlike_Binding::{Wrap as TestBindingSetlikeWithInterfaceSetlikeWrap, TestBindingSetlikeWithInterfaceSetlikeMethods, GetProtoObject as TestBindingSetlikeWithInterfaceSetlikeGetProtoObject};
942pub mod TestBindingSetlikeWithInterfaceSetlike_Binding {
943use crate::import::module::*;
944
945unsafe extern "C" fn next<D: DomTypes>
946(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
947    let mut result = false;
948    wrap_panic(&mut || result = (|| {
949        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
950        let this = &*(this as *const crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>);
951        let args = &*args;
952        let argc = args.argc_;
953        let result: Result<NonNull<JSObject>, Error> = this.Next(SafeJSContext::from_ptr(cx.raw_cx()));
954        let result = match result {
955            Ok(result) => result,
956            Err(e) => {
957                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
958                return false;
959            },
960        };
961
962        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
963        return true;
964    })());
965    result
966}
967
968
969static next_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
970
971pub(crate) fn init_next_methodinfo<D: DomTypes>() {
972    next_methodinfo.set(JSJitInfo {
973    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
974        method: Some(next::<D>)
975    },
976    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
977        protoID: PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike as u16,
978    },
979    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
980    _bitfield_align_1: [],
981    _bitfield_1: __BindgenBitfieldUnit::new(
982        new_jsjitinfo_bitfield_1!(
983            JSJitInfo_OpType::Method as u8,
984            JSJitInfo_AliasSet::AliasEverything as u8,
985            JSValueType::JSVAL_TYPE_OBJECT as u8,
986            false,
987            false,
988            false,
989            false,
990            false,
991            false,
992            0,
993        ).to_ne_bytes()
994    ),
995});
996}
997unsafe extern "C" fn _finalize<D: DomTypes>
998(_cx: *mut GCContext, obj: *mut JSObject){
999    wrap_panic(&mut || {
1000
1001        let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>>(obj).unwrap();
1002        finalize_common(this);
1003    })
1004}
1005
1006unsafe extern "C" fn _trace<D: DomTypes>
1007(trc: *mut JSTracer, obj: *mut JSObject){
1008    wrap_panic(&mut || {
1009
1010        let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>>(obj).unwrap();
1011        if this.is_null() { return; } // GC during obj creation
1012        (*this).trace(trc);
1013    })
1014}
1015
1016
1017static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1018
1019pub(crate) fn init_class_ops<D: DomTypes>() {
1020    CLASS_OPS.set(JSClassOps {
1021        addProperty: None,
1022        delProperty: None,
1023        enumerate: None,
1024        newEnumerate: None,
1025        resolve: None,
1026        mayResolve: None,
1027        finalize: Some(_finalize::<D>),
1028        call: None,
1029        construct: None,
1030        trace: Some(_trace::<D>),
1031    });
1032}
1033
1034pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1035
1036pub(crate) fn init_domjs_class<D: DomTypes>() {
1037    init_class_ops::<D>();
1038    Class.set(DOMJSClass {
1039        base: JSClass {
1040            name: c"TestBindingSetlikeWithInterfaceSetlike".as_ptr(),
1041            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1042                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1043                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
1044            cOps: unsafe { CLASS_OPS.get() },
1045            spec: ptr::null(),
1046            ext: ptr::null(),
1047            oOps: ptr::null(),
1048        },
1049        dom_class:
1050DOMClass {
1051    interface_chain: [ PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1052    depth: 0,
1053    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
1054    malloc_size_of: malloc_size_of_including_raw_self::<crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>> as unsafe fn(&mut _, _) -> _,
1055    global: Globals::EMPTY,
1056},
1057    });
1058}
1059
1060#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1061(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>>, _can_gc: CanGc) -> DomRoot<crate::iterable::IterableIterator<D, D::TestBindingSetlikeWithInterface>>{
1062
1063    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1064
1065    let scope = scope.reflector().get_jsobject();
1066    assert!(!scope.get().is_null());
1067    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1068    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1069
1070    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1071    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1072    assert!(!canonical_proto.is_null());
1073
1074
1075    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1076    if let Some(given) = given_proto {
1077        proto.set(*given);
1078        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1079            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1080        }
1081    } else {
1082        proto.set(*canonical_proto);
1083    }
1084    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1085        cx.raw_cx(),
1086        &Class.get().base,
1087        proto.handle(),
1088    ));
1089    assert!(!obj.is_null());
1090    JS_SetReservedSlot(
1091        obj.get(),
1092        DOM_OBJECT_SLOT,
1093        &PrivateValue(raw.as_ptr() as *const libc::c_void),
1094    );
1095
1096    let root = raw.reflect_with(obj.get());
1097
1098
1099
1100    DomRoot::from_ref(&*root)
1101}
1102
1103pub trait TestBindingSetlikeWithInterfaceSetlikeMethods<D: DomTypes> {
1104    fn Next(&self, r#cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
1105}
1106static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1107
1108pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1109    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1110    JSFunctionSpec {
1111        name: JSPropertySpec_Name { string_: c"next".as_ptr() },
1112        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { next_methodinfo.get() } as *const _ as *const JSJitInfo },
1113        nargs: 0,
1114        flags: (JSPROP_ENUMERATE) as u16,
1115        selfHostedName: ptr::null()
1116    },
1117    JSFunctionSpec {
1118        name: JSPropertySpec_Name { string_: ptr::null() },
1119        call: JSNativeWrapper { op: None, info: ptr::null() },
1120        nargs: 0,
1121        flags: 0,
1122        selfHostedName: ptr::null()
1123    }]))[..]
1124])));
1125}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1126
1127pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1128    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])])));
1129}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1130
1131pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1132    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1133    JSPropertySpec {
1134                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1135                    attributes_: (JSPROP_READONLY),
1136                    kind_: (JSPropertySpec_Kind::Value),
1137                    u: JSPropertySpec_AccessorsOrValue {
1138                        value: JSPropertySpec_ValueWrapper {
1139                            type_: JSPropertySpec_ValueWrapper_Type::String,
1140                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1141                                string: c"TestBindingSetlikeWithInterface Setlike".as_ptr(),
1142                            }
1143                        }
1144                    }
1145                }
1146,
1147    JSPropertySpec::ZERO]))[..]
1148])));
1149}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1150
1151pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1152    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
1153}
1154pub fn GetProtoObject<D: DomTypes>
1155(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1156    /* Get the interface prototype object for this class.  This will create the
1157       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike), CreateInterfaceObjects::<D>, rval)
1158}
1159
1160
1161static PrototypeClass: JSClass = JSClass {
1162    name: c"TestBindingSetlikeWithInterfaceSetlikePrototype".as_ptr(),
1163    flags:
1164        // JSCLASS_HAS_RESERVED_SLOTS()
1165        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1166    cOps: ptr::null(),
1167    spec: ptr::null(),
1168    ext: ptr::null(),
1169    oOps: ptr::null(),
1170};
1171
1172unsafe fn CreateInterfaceObjects<D: DomTypes>
1173(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1174
1175    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1176    prototype_proto.set(GetRealmIteratorPrototype(cx.raw_cx()));
1177    assert!(!prototype_proto.is_null());
1178
1179    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1180    create_interface_prototype_object::<D>(cx,
1181                                      global,
1182                                      prototype_proto.handle(),
1183                                      &PrototypeClass,
1184                                      sMethods.get(),
1185                                      sAttributes.get(),
1186                                      &[],
1187                                      &[],
1188                                      prototype.handle_mut());
1189    assert!(!prototype.is_null());
1190    assert!((*cache)[PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike as usize].is_null());
1191    (*cache)[PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike as usize] = prototype.get();
1192    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::TestBindingSetlikeWithInterfaceSetlike as isize),
1193                                  ptr::null_mut(),
1194                                  prototype.get());
1195
1196}
1197
1198
1199        pub(crate) fn init_statics<D: DomTypes>() {
1200
1201            init_domjs_class::<D>();
1202            crate::codegen::GenericBindings::TestBindingSetlikeWithInterfaceBinding::TestBindingSetlikeWithInterfaceSetlike_Binding::init_next_methodinfo::<D>();
1203
1204
1205
1206            init_sMethods_specs::<D>();
1207init_sMethods_prefs::<D>();
1208init_sAttributes_specs::<D>();
1209init_sAttributes_prefs::<D>();
1210        }
1211        } // mod TestBindingSetlikeWithInterfaceSetlike_Binding
1212
1213