script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
IDBCursorBinding.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::import::base::*;
7
8
9#[repr(usize)]
10#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
11pub enum IDBCursorDirection {
12    Next,
13    Nextunique,
14    Prev,
15    Prevunique
16}
17pub mod IDBCursorDirectionValues {
18
19    use crate::utils::find_enum_value;
20    use js::conversions::ConversionResult;
21    use js::conversions::FromJSValConvertible;
22    use js::conversions::ToJSValConvertible;
23    use js::context::RawJSContext;
24    use js::rust::HandleValue;
25    use js::rust::MutableHandleValue;
26    use js::jsval::JSVal;
27
28    pub(crate) const pairs: &[(&str, super::IDBCursorDirection)] = &[
29        ("next", super::IDBCursorDirection::Next),
30        ("nextunique", super::IDBCursorDirection::Nextunique),
31        ("prev", super::IDBCursorDirection::Prev),
32        ("prevunique", super::IDBCursorDirection::Prevunique),
33    ];
34
35    impl super::IDBCursorDirection {
36        pub fn as_str(&self) -> &'static str {
37            pairs[*self as usize].0
38        }
39    }
40
41    impl Default for super::IDBCursorDirection {
42        fn default() -> super::IDBCursorDirection {
43            pairs[0].1
44        }
45    }
46
47    impl std::str::FromStr for super::IDBCursorDirection {
48        type Err = ();
49
50        fn from_str(s: &str) -> Result<Self, Self::Err> {
51            pairs
52                .iter()
53                .find(|&&(key, _)| s == key)
54                .map(|&(_, ev)| ev)
55                .ok_or(())
56        }
57    }
58
59    impl ToJSValConvertible for super::IDBCursorDirection {
60        unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
61            pairs[*self as usize].0.to_jsval(cx, rval);
62        }
63    }
64
65    impl FromJSValConvertible for super::IDBCursorDirection {
66        type Config = ();
67        unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
68                             -> Result<ConversionResult<super::IDBCursorDirection>, ()> {
69            match find_enum_value(cx, value, pairs) {
70                Err(_) => Err(()),
71                Ok((None, search)) => {
72                    Ok(ConversionResult::Failure(
73                        format!("'{}' is not a valid enum value for enumeration 'IDBCursorDirection'.", search).into()
74                    ))
75                }
76                Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
77            }
78        }
79    }
80        } // mod IDBCursorDirectionValues
81
82pub use self::IDBCursor_Binding::{Wrap, IDBCursorMethods, GetProtoObject, GetConstructorObject, DefineDOMInterface};
83pub mod IDBCursor_Binding {
84use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
85use crate::codegen::GenericBindings::IDBCursorBinding::IDBCursorDirection;
86use crate::codegen::GenericBindings::IDBCursorBinding::IDBCursorDirectionValues;
87use crate::import::module::*;
88
89unsafe extern "C" fn get_source<D: DomTypes>
90(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
91    let mut result = false;
92    wrap_panic(&mut || result = (|| {
93        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
94        let this = &*(this as *const D::IDBCursor);
95        let result: GenericUnionTypes::IDBObjectStoreOrIDBIndex::<D> = this.Source();
96
97        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
98        return true;
99    })());
100    result
101}
102
103
104static source_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
105
106pub(crate) fn init_source_getterinfo<D: DomTypes>() {
107    source_getterinfo.set(JSJitInfo {
108    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
109        getter: Some(get_source::<D>)
110    },
111    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
112        protoID: PrototypeList::ID::IDBCursor as u16,
113    },
114    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
115    _bitfield_align_1: [],
116    _bitfield_1: __BindgenBitfieldUnit::new(
117        new_jsjitinfo_bitfield_1!(
118            JSJitInfo_OpType::Getter as u8,
119            JSJitInfo_AliasSet::AliasEverything as u8,
120            JSValueType::JSVAL_TYPE_OBJECT as u8,
121            true,
122            false,
123            false,
124            false,
125            false,
126            false,
127            0,
128        ).to_ne_bytes()
129    ),
130});
131}
132unsafe extern "C" fn get_direction<D: DomTypes>
133(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
134    let mut result = false;
135    wrap_panic(&mut || result = (|| {
136        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
137        let this = &*(this as *const D::IDBCursor);
138        let result: IDBCursorDirection = this.Direction();
139
140        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
141        return true;
142    })());
143    result
144}
145
146
147static direction_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
148
149pub(crate) fn init_direction_getterinfo<D: DomTypes>() {
150    direction_getterinfo.set(JSJitInfo {
151    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
152        getter: Some(get_direction::<D>)
153    },
154    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
155        protoID: PrototypeList::ID::IDBCursor as u16,
156    },
157    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
158    _bitfield_align_1: [],
159    _bitfield_1: __BindgenBitfieldUnit::new(
160        new_jsjitinfo_bitfield_1!(
161            JSJitInfo_OpType::Getter as u8,
162            JSJitInfo_AliasSet::AliasEverything as u8,
163            JSValueType::JSVAL_TYPE_STRING as u8,
164            true,
165            false,
166            false,
167            false,
168            false,
169            false,
170            0,
171        ).to_ne_bytes()
172    ),
173});
174}
175unsafe extern "C" fn get_key<D: DomTypes>
176(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
177    let mut result = false;
178    wrap_panic(&mut || result = (|| {
179        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
180        let this = &*(this as *const D::IDBCursor);
181        rooted!(&in(cx) let mut retval: JSVal);
182        let result: () = this.Key(SafeJSContext::from_ptr(cx.raw_cx()), CanGc::note(), retval.handle_mut());
183
184        (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
185        return true;
186    })());
187    result
188}
189
190
191static key_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
192
193pub(crate) fn init_key_getterinfo<D: DomTypes>() {
194    key_getterinfo.set(JSJitInfo {
195    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
196        getter: Some(get_key::<D>)
197    },
198    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
199        protoID: PrototypeList::ID::IDBCursor as u16,
200    },
201    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
202    _bitfield_align_1: [],
203    _bitfield_1: __BindgenBitfieldUnit::new(
204        new_jsjitinfo_bitfield_1!(
205            JSJitInfo_OpType::Getter as u8,
206            JSJitInfo_AliasSet::AliasEverything as u8,
207            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
208            true,
209            false,
210            false,
211            false,
212            false,
213            false,
214            0,
215        ).to_ne_bytes()
216    ),
217});
218}
219unsafe extern "C" fn get_primaryKey<D: DomTypes>
220(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
221    let mut result = false;
222    wrap_panic(&mut || result = (|| {
223        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
224        let this = &*(this as *const D::IDBCursor);
225        rooted!(&in(cx) let mut retval: JSVal);
226        let result: () = this.PrimaryKey(SafeJSContext::from_ptr(cx.raw_cx()), CanGc::note(), retval.handle_mut());
227
228        (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
229        return true;
230    })());
231    result
232}
233
234
235static primaryKey_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
236
237pub(crate) fn init_primaryKey_getterinfo<D: DomTypes>() {
238    primaryKey_getterinfo.set(JSJitInfo {
239    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
240        getter: Some(get_primaryKey::<D>)
241    },
242    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
243        protoID: PrototypeList::ID::IDBCursor as u16,
244    },
245    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
246    _bitfield_align_1: [],
247    _bitfield_1: __BindgenBitfieldUnit::new(
248        new_jsjitinfo_bitfield_1!(
249            JSJitInfo_OpType::Getter as u8,
250            JSJitInfo_AliasSet::AliasEverything as u8,
251            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
252            true,
253            false,
254            false,
255            false,
256            false,
257            false,
258            0,
259        ).to_ne_bytes()
260    ),
261});
262}
263unsafe extern "C" fn get_request<D: DomTypes>
264(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> 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 this = &*(this as *const D::IDBCursor);
269        let result: DomRoot<D::IDBRequest> = this.Request();
270
271        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
272        return true;
273    })());
274    result
275}
276
277
278static request_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
279
280pub(crate) fn init_request_getterinfo<D: DomTypes>() {
281    request_getterinfo.set(JSJitInfo {
282    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
283        getter: Some(get_request::<D>)
284    },
285    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
286        protoID: PrototypeList::ID::IDBCursor as u16,
287    },
288    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
289    _bitfield_align_1: [],
290    _bitfield_1: __BindgenBitfieldUnit::new(
291        new_jsjitinfo_bitfield_1!(
292            JSJitInfo_OpType::Getter as u8,
293            JSJitInfo_AliasSet::AliasNone as u8,
294            JSValueType::JSVAL_TYPE_OBJECT as u8,
295            true,
296            true,
297            false,
298            false,
299            false,
300            false,
301            0,
302        ).to_ne_bytes()
303    ),
304});
305}
306unsafe extern "C" fn _finalize<D: DomTypes>
307(_cx: *mut GCContext, obj: *mut JSObject){
308    wrap_panic(&mut || {
309
310        let this = native_from_object_static::<D::IDBCursor>(obj).unwrap();
311        finalize_common(this);
312    })
313}
314
315unsafe extern "C" fn _trace<D: DomTypes>
316(trc: *mut JSTracer, obj: *mut JSObject){
317    wrap_panic(&mut || {
318
319        let this = native_from_object_static::<D::IDBCursor>(obj).unwrap();
320        if this.is_null() { return; } // GC during obj creation
321        (*this).trace(trc);
322    })
323}
324
325
326static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
327
328pub(crate) fn init_class_ops<D: DomTypes>() {
329    CLASS_OPS.set(JSClassOps {
330        addProperty: None,
331        delProperty: None,
332        enumerate: None,
333        newEnumerate: None,
334        resolve: None,
335        mayResolve: None,
336        finalize: Some(_finalize::<D>),
337        call: None,
338        construct: None,
339        trace: Some(_trace::<D>),
340    });
341}
342
343pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
344
345pub(crate) fn init_domjs_class<D: DomTypes>() {
346    init_class_ops::<D>();
347    Class.set(DOMJSClass {
348        base: JSClass {
349            name: c"IDBCursor".as_ptr(),
350            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
351                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
352                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
353            cOps: unsafe { CLASS_OPS.get() },
354            spec: ptr::null(),
355            ext: ptr::null(),
356            oOps: ptr::null(),
357        },
358        dom_class:
359DOMClass {
360    interface_chain: [ PrototypeList::ID::IDBCursor, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
361    depth: 0,
362    type_id: crate::codegen::InheritTypes::TopTypeId { idbcursor: (crate::codegen::InheritTypes::IDBCursorTypeId::IDBCursor) },
363    malloc_size_of: malloc_size_of_including_raw_self::<D::IDBCursor> as unsafe fn(&mut _, _) -> _,
364    global: Globals::EMPTY,
365},
366    });
367}
368
369#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
370(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::IDBCursor>, _can_gc: CanGc) -> DomRoot<D::IDBCursor>{
371
372    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
373
374    let scope = scope.reflector().get_jsobject();
375    assert!(!scope.get().is_null());
376    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
377    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
378
379    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
380    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
381    assert!(!canonical_proto.is_null());
382
383
384    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
385    if let Some(given) = given_proto {
386        proto.set(*given);
387        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
388            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
389        }
390    } else {
391        proto.set(*canonical_proto);
392    }
393    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
394        cx.raw_cx(),
395        &Class.get().base,
396        proto.handle(),
397    ));
398    assert!(!obj.is_null());
399    JS_SetReservedSlot(
400        obj.get(),
401        DOM_OBJECT_SLOT,
402        &PrivateValue(raw.as_ptr() as *const libc::c_void),
403    );
404
405    let root = raw.reflect_with(obj.get());
406
407
408
409    DomRoot::from_ref(&*root)
410}
411
412pub trait IDBCursorMethods<D: DomTypes> {
413    fn Source(&self, ) -> GenericUnionTypes::IDBObjectStoreOrIDBIndex::<D>;
414    fn Direction(&self, ) -> IDBCursorDirection;
415    fn Key(&self, r#cx: SafeJSContext, r#_can_gc: CanGc, r#retval: MutableHandleValue);
416    fn PrimaryKey(&self, r#cx: SafeJSContext, r#_can_gc: CanGc, r#retval: MutableHandleValue);
417    fn Request(&self, ) -> DomRoot<D::IDBRequest>;
418}
419static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
420
421pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
422    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
423    JSPropertySpec {
424                    name: JSPropertySpec_Name { string_: c"source".as_ptr() },
425                    attributes_: (JSPROP_ENUMERATE),
426                    kind_: (JSPropertySpec_Kind::NativeAccessor),
427                    u: JSPropertySpec_AccessorsOrValue {
428                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
429                            getter: JSPropertySpec_Accessor {
430                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { source_getterinfo.get() } },
431                            },
432                            setter: JSPropertySpec_Accessor {
433                                native: JSNativeWrapper { op: None, info: ptr::null() },
434                            }
435                        }
436                    }
437                }
438,
439    JSPropertySpec {
440                    name: JSPropertySpec_Name { string_: c"direction".as_ptr() },
441                    attributes_: (JSPROP_ENUMERATE),
442                    kind_: (JSPropertySpec_Kind::NativeAccessor),
443                    u: JSPropertySpec_AccessorsOrValue {
444                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
445                            getter: JSPropertySpec_Accessor {
446                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { direction_getterinfo.get() } },
447                            },
448                            setter: JSPropertySpec_Accessor {
449                                native: JSNativeWrapper { op: None, info: ptr::null() },
450                            }
451                        }
452                    }
453                }
454,
455    JSPropertySpec {
456                    name: JSPropertySpec_Name { string_: c"key".as_ptr() },
457                    attributes_: (JSPROP_ENUMERATE),
458                    kind_: (JSPropertySpec_Kind::NativeAccessor),
459                    u: JSPropertySpec_AccessorsOrValue {
460                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
461                            getter: JSPropertySpec_Accessor {
462                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { key_getterinfo.get() } },
463                            },
464                            setter: JSPropertySpec_Accessor {
465                                native: JSNativeWrapper { op: None, info: ptr::null() },
466                            }
467                        }
468                    }
469                }
470,
471    JSPropertySpec {
472                    name: JSPropertySpec_Name { string_: c"primaryKey".as_ptr() },
473                    attributes_: (JSPROP_ENUMERATE),
474                    kind_: (JSPropertySpec_Kind::NativeAccessor),
475                    u: JSPropertySpec_AccessorsOrValue {
476                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
477                            getter: JSPropertySpec_Accessor {
478                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { primaryKey_getterinfo.get() } },
479                            },
480                            setter: JSPropertySpec_Accessor {
481                                native: JSNativeWrapper { op: None, info: ptr::null() },
482                            }
483                        }
484                    }
485                }
486,
487    JSPropertySpec {
488                    name: JSPropertySpec_Name { string_: c"request".as_ptr() },
489                    attributes_: (JSPROP_ENUMERATE),
490                    kind_: (JSPropertySpec_Kind::NativeAccessor),
491                    u: JSPropertySpec_AccessorsOrValue {
492                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
493                            getter: JSPropertySpec_Accessor {
494                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { request_getterinfo.get() } },
495                            },
496                            setter: JSPropertySpec_Accessor {
497                                native: JSNativeWrapper { op: None, info: ptr::null() },
498                            }
499                        }
500                    }
501                }
502,
503    JSPropertySpec::ZERO]))[..]
504,
505&Box::leak(Box::new([
506    JSPropertySpec {
507                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
508                    attributes_: (JSPROP_READONLY),
509                    kind_: (JSPropertySpec_Kind::Value),
510                    u: JSPropertySpec_AccessorsOrValue {
511                        value: JSPropertySpec_ValueWrapper {
512                            type_: JSPropertySpec_ValueWrapper_Type::String,
513                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
514                                string: c"IDBCursor".as_ptr(),
515                            }
516                        }
517                    }
518                }
519,
520    JSPropertySpec::ZERO]))[..]
521])));
522}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
523
524pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
525    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]),
526    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
527}
528pub fn GetProtoObject<D: DomTypes>
529(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
530    /* Get the interface prototype object for this class.  This will create the
531       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::IDBCursor), CreateInterfaceObjects::<D>, rval)
532}
533
534
535static PrototypeClass: JSClass = JSClass {
536    name: c"IDBCursorPrototype".as_ptr(),
537    flags:
538        // JSCLASS_HAS_RESERVED_SLOTS()
539        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
540    cOps: ptr::null(),
541    spec: ptr::null(),
542    ext: ptr::null(),
543    oOps: ptr::null(),
544};
545
546
547static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
548
549pub(crate) fn init_interface_object<D: DomTypes>() {
550    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
551        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
552        b"function IDBCursor() {\n    [native code]\n}",
553        PrototypeList::ID::IDBCursor,
554        0,
555    ));
556}
557
558pub fn GetConstructorObject<D: DomTypes>
559(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
560    /* Get the interface object for this class.  This will create the object as
561       needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::IDBCursor), CreateInterfaceObjects::<D>, rval)
562}
563
564pub fn DefineDOMInterface<D: DomTypes>
565(cx: SafeJSContext, global: HandleObject){
566    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::IDBCursor),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
567}
568
569pub fn ConstructorEnabled<D: DomTypes>
570(aCx: SafeJSContext, aObj: HandleObject) -> bool{
571    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
572    pref!(dom_indexeddb_enabled)
573}
574
575unsafe fn CreateInterfaceObjects<D: DomTypes>
576(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
577
578    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
579    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
580    assert!(!prototype_proto.is_null());
581
582    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
583    create_interface_prototype_object::<D>(cx,
584                                      global,
585                                      prototype_proto.handle(),
586                                      &PrototypeClass,
587                                      &[],
588                                      sAttributes.get(),
589                                      &[],
590                                      &[],
591                                      prototype.handle_mut());
592    assert!(!prototype.is_null());
593    assert!((*cache)[PrototypeList::ID::IDBCursor as usize].is_null());
594    (*cache)[PrototypeList::ID::IDBCursor as usize] = prototype.get();
595    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::IDBCursor as isize),
596                                  ptr::null_mut(),
597                                  prototype.get());
598
599    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
600    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
601
602    assert!(!interface_proto.is_null());
603
604    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
605    create_noncallback_interface_object::<D>(cx,
606                                        global,
607                                        interface_proto.handle(),
608                                        INTERFACE_OBJECT_CLASS.get(),
609                                        &[],
610                                        &[],
611                                        &[],
612                                        prototype.handle(),
613                                        c"IDBCursor",
614                                        0,
615                                        &[],
616                                        interface.handle_mut());
617    assert!(!interface.is_null());
618
619    assert!((*cache)[PrototypeList::Constructor::IDBCursor as usize].is_null());
620    (*cache)[PrototypeList::Constructor::IDBCursor as usize] = interface.get();
621    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::IDBCursor as isize),
622                                  ptr::null_mut(),
623                                  interface.get());
624
625}
626
627
628        pub(crate) fn init_statics<D: DomTypes>() {
629            init_interface_object::<D>();
630            init_domjs_class::<D>();
631
632            init_source_getterinfo::<D>();
633init_direction_getterinfo::<D>();
634init_key_getterinfo::<D>();
635init_primaryKey_getterinfo::<D>();
636init_request_getterinfo::<D>();
637
638
639            init_sAttributes_specs::<D>();
640init_sAttributes_prefs::<D>();
641        }
642        } // mod IDBCursor_Binding
643
644