script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
GamepadEventBinding.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::EventBinding::Event_Binding;
6use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
7use crate::import::base::*;
8
9#[derive(JSTraceable)]
10pub struct GamepadEventInit<D: DomTypes> {
11    pub parent: crate::codegen::GenericBindings::EventBinding::EventInit,
12    pub gamepad: DomRoot<D::Gamepad>,
13}
14
15impl<D: DomTypes> GamepadEventInit<D> {
16
17    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
18                      -> Result<ConversionResult<GamepadEventInit<D>>, ()> {
19        unsafe {
20            let object = if val.get().is_null_or_undefined() {
21                ptr::null_mut()
22            } else if val.get().is_object() {
23                val.get().to_object()
24            } else {
25                return Ok(ConversionResult::Failure("Value is not an object.".into()));
26            };
27            rooted!(&in(cx) let object = object);
28        let dictionary = GamepadEventInit {
29                parent: {
30                    match crate::codegen::GenericBindings::EventBinding::EventInit::new(cx, val, can_gc)? {
31                        ConversionResult::Success(v) => v,
32                        ConversionResult::Failure(error) => {
33                            throw_type_error(cx.raw_cx(), &error);
34                            return Err(());
35                        }
36                    }
37                },
38                gamepad: {
39                    rooted!(&in(cx) let mut rval = UndefinedValue());
40                    if get_dictionary_property(cx.raw_cx(), object.handle(), "gamepad", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
41                            if rval.handle().get().is_object() {
42                                match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
43                                    Ok(val) => val,
44                                    Err(()) => {
45                                        throw_type_error(cx.raw_cx(), "value does not implement interface Gamepad.");
46                                        return Err(());
47
48                                    }
49                                }
50
51                            } else {
52                                throw_type_error(cx.raw_cx(), "Value is not an object.");
53                                return Err(());
54
55                            }
56                    } else {
57                            throw_type_error(cx.raw_cx(), "Missing required member \"gamepad\".");
58                            return Err(());
59                    }
60                },
61        };
62            Ok(ConversionResult::Success(dictionary))
63        }
64    }
65}
66
67impl<D: DomTypes> FromJSValConvertible for GamepadEventInit<D> {
68    type Config = ();
69    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
70                         -> Result<ConversionResult<GamepadEventInit<D>>, ()> {
71        GamepadEventInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
72    }
73}
74
75impl<D: DomTypes> GamepadEventInit<D> {
76    #[allow(clippy::wrong_self_convention)]
77    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
78        self.parent.to_jsobject(cx, obj.reborrow());
79        let gamepad = &self.gamepad;
80        rooted!(in(cx) let mut gamepad_js = UndefinedValue());
81        gamepad.to_jsval(cx, gamepad_js.handle_mut());
82        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "gamepad", gamepad_js.handle()).unwrap();
83    }
84}
85
86impl<D: DomTypes> ToJSValConvertible for GamepadEventInit<D> {
87    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
88        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
89        self.to_jsobject(cx, obj.handle_mut());
90        rval.set(ObjectOrNullValue(obj.get()))
91    }
92}
93
94
95pub use self::GamepadEvent_Binding::{Wrap, GamepadEventMethods, GetProtoObject, DefineDOMInterface};
96pub mod GamepadEvent_Binding {
97use crate::codegen::GenericBindings::EventBinding::Event_Binding;
98use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
99use crate::codegen::GenericBindings::GamepadEventBinding::GamepadEventInit;
100use crate::import::module::*;
101
102unsafe extern "C" fn get_gamepad<D: DomTypes>
103(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
104    let mut result = false;
105    wrap_panic(&mut || result = (|| {
106        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
107        let this = &*(this as *const D::GamepadEvent);
108        let result: DomRoot<D::Gamepad> = this.Gamepad();
109
110        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
111        return true;
112    })());
113    result
114}
115
116
117static gamepad_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
118
119pub(crate) fn init_gamepad_getterinfo<D: DomTypes>() {
120    gamepad_getterinfo.set(JSJitInfo {
121    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
122        getter: Some(get_gamepad::<D>)
123    },
124    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
125        protoID: PrototypeList::ID::GamepadEvent as u16,
126    },
127    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
128    _bitfield_align_1: [],
129    _bitfield_1: __BindgenBitfieldUnit::new(
130        new_jsjitinfo_bitfield_1!(
131            JSJitInfo_OpType::Getter as u8,
132            JSJitInfo_AliasSet::AliasEverything as u8,
133            JSValueType::JSVAL_TYPE_OBJECT as u8,
134            true,
135            false,
136            false,
137            false,
138            false,
139            false,
140            0,
141        ).to_ne_bytes()
142    ),
143});
144}
145unsafe extern "C" fn get_isTrusted<D: DomTypes>
146(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
147    let mut result = false;
148    wrap_panic(&mut || result = (|| {
149        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
150        let this = &*(this as *const D::GamepadEvent);
151        let result: bool = this.IsTrusted();
152
153        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
154        return true;
155    })());
156    result
157}
158
159
160static isTrusted_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
161
162pub(crate) fn init_isTrusted_getterinfo<D: DomTypes>() {
163    isTrusted_getterinfo.set(JSJitInfo {
164    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
165        getter: Some(get_isTrusted::<D>)
166    },
167    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
168        protoID: PrototypeList::ID::GamepadEvent as u16,
169    },
170    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
171    _bitfield_align_1: [],
172    _bitfield_1: __BindgenBitfieldUnit::new(
173        new_jsjitinfo_bitfield_1!(
174            JSJitInfo_OpType::Getter as u8,
175            JSJitInfo_AliasSet::AliasEverything as u8,
176            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
177            true,
178            false,
179            false,
180            false,
181            false,
182            false,
183            0,
184        ).to_ne_bytes()
185    ),
186});
187}
188unsafe extern "C" fn _finalize<D: DomTypes>
189(_cx: *mut GCContext, obj: *mut JSObject){
190    wrap_panic(&mut || {
191
192        let this = native_from_object_static::<D::GamepadEvent>(obj).unwrap();
193        finalize_common(this);
194    })
195}
196
197unsafe extern "C" fn _trace<D: DomTypes>
198(trc: *mut JSTracer, obj: *mut JSObject){
199    wrap_panic(&mut || {
200
201        let this = native_from_object_static::<D::GamepadEvent>(obj).unwrap();
202        if this.is_null() { return; } // GC during obj creation
203        (*this).trace(trc);
204    })
205}
206
207
208static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
209
210pub(crate) fn init_class_ops<D: DomTypes>() {
211    CLASS_OPS.set(JSClassOps {
212        addProperty: None,
213        delProperty: None,
214        enumerate: None,
215        newEnumerate: None,
216        resolve: None,
217        mayResolve: None,
218        finalize: Some(_finalize::<D>),
219        call: None,
220        construct: None,
221        trace: Some(_trace::<D>),
222    });
223}
224
225pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
226
227pub(crate) fn init_domjs_class<D: DomTypes>() {
228    init_class_ops::<D>();
229    Class.set(DOMJSClass {
230        base: JSClass {
231            name: c"GamepadEvent".as_ptr(),
232            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
233                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
234                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
235            cOps: unsafe { CLASS_OPS.get() },
236            spec: ptr::null(),
237            ext: ptr::null(),
238            oOps: ptr::null(),
239        },
240        dom_class:
241DOMClass {
242    interface_chain: [ PrototypeList::ID::Event, PrototypeList::ID::GamepadEvent, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
243    depth: 1,
244    type_id: crate::codegen::InheritTypes::TopTypeId { event: (crate::codegen::InheritTypes::EventTypeId::GamepadEvent) },
245    malloc_size_of: malloc_size_of_including_raw_self::<D::GamepadEvent> as unsafe fn(&mut _, _) -> _,
246    global: Globals::EMPTY,
247},
248    });
249}
250
251#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
252(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GamepadEvent>, _can_gc: CanGc) -> DomRoot<D::GamepadEvent>{
253
254    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
255
256    let scope = scope.reflector().get_jsobject();
257    assert!(!scope.get().is_null());
258    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
259    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
260
261    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
262    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
263    assert!(!canonical_proto.is_null());
264
265
266    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
267    if let Some(given) = given_proto {
268        proto.set(*given);
269        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
270            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
271        }
272    } else {
273        proto.set(*canonical_proto);
274    }
275    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
276        cx.raw_cx(),
277        &Class.get().base,
278        proto.handle(),
279    ));
280    assert!(!obj.is_null());
281    JS_SetReservedSlot(
282        obj.get(),
283        DOM_OBJECT_SLOT,
284        &PrivateValue(raw.as_ptr() as *const libc::c_void),
285    );
286
287    let root = raw.reflect_with(obj.get());
288
289
290    let mut slot = UndefinedValue();
291    JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
292    rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
293    unforgeable_holder.handle_mut().set(slot.to_object());
294    assert!(JS_InitializePropertiesFromCompatibleNativeObject(cx.raw_cx(), obj.handle(), unforgeable_holder.handle()));
295
296
297    DomRoot::from_ref(&*root)
298}
299
300pub trait GamepadEventMethods<D: DomTypes> {
301    fn Gamepad(&self, ) -> DomRoot<D::Gamepad>;
302    fn IsTrusted(&self, ) -> bool;
303    fn Constructor(r#global: &D::Window, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#type_: DOMString, r#eventInitDict: &crate::codegen::GenericBindings::GamepadEventBinding::GamepadEventInit<D>) -> Fallible<DomRoot<D::GamepadEvent>>;
304}
305static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
306
307pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
308    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
309    JSPropertySpec {
310                    name: JSPropertySpec_Name { string_: c"gamepad".as_ptr() },
311                    attributes_: (JSPROP_ENUMERATE),
312                    kind_: (JSPropertySpec_Kind::NativeAccessor),
313                    u: JSPropertySpec_AccessorsOrValue {
314                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
315                            getter: JSPropertySpec_Accessor {
316                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { gamepad_getterinfo.get() } },
317                            },
318                            setter: JSPropertySpec_Accessor {
319                                native: JSNativeWrapper { op: None, info: ptr::null() },
320                            }
321                        }
322                    }
323                }
324,
325    JSPropertySpec::ZERO]))[..]
326,
327&Box::leak(Box::new([
328    JSPropertySpec {
329                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
330                    attributes_: (JSPROP_READONLY),
331                    kind_: (JSPropertySpec_Kind::Value),
332                    u: JSPropertySpec_AccessorsOrValue {
333                        value: JSPropertySpec_ValueWrapper {
334                            type_: JSPropertySpec_ValueWrapper_Type::String,
335                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
336                                string: c"GamepadEvent".as_ptr(),
337                            }
338                        }
339                    }
340                }
341,
342    JSPropertySpec::ZERO]))[..]
343])));
344}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
345
346pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
347    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
348    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
349}static sLegacyUnforgeableAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
350
351pub(crate) fn init_sLegacyUnforgeableAttributes_specs<D: DomTypes>() {
352    sLegacyUnforgeableAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
353    JSPropertySpec {
354                    name: JSPropertySpec_Name { string_: c"isTrusted".as_ptr() },
355                    attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
356                    kind_: (JSPropertySpec_Kind::NativeAccessor),
357                    u: JSPropertySpec_AccessorsOrValue {
358                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
359                            getter: JSPropertySpec_Accessor {
360                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { isTrusted_getterinfo.get() } },
361                            },
362                            setter: JSPropertySpec_Accessor {
363                                native: JSNativeWrapper { op: None, info: ptr::null() },
364                            }
365                        }
366                    }
367                }
368,
369    JSPropertySpec::ZERO]))[..]
370])));
371}static sLegacyUnforgeableAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
372
373pub(crate) fn init_sLegacyUnforgeableAttributes_prefs<D: DomTypes>() {
374    sLegacyUnforgeableAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::PAINT_WORKLET_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEBUGGER_GLOBAL_SCOPE),Condition::Exposed(Globals::DISSIMILAR_ORIGIN_WINDOW),Condition::Exposed(Globals::TEST_WORKLET_GLOBAL_SCOPE)], (unsafe { sLegacyUnforgeableAttributes_specs.get() })[0])])));
375}
376pub fn GetProtoObject<D: DomTypes>
377(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
378    /* Get the interface prototype object for this class.  This will create the
379       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GamepadEvent), CreateInterfaceObjects::<D>, rval)
380}
381
382
383static PrototypeClass: JSClass = JSClass {
384    name: c"GamepadEventPrototype".as_ptr(),
385    flags:
386        // JSCLASS_HAS_RESERVED_SLOTS()
387        (1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
388    cOps: ptr::null(),
389    spec: ptr::null(),
390    ext: ptr::null(),
391    oOps: ptr::null(),
392};
393
394unsafe extern "C" fn _constructor<D: DomTypes>
395(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
396    let mut result = false;
397    wrap_panic(&mut || result = {
398        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
399        let args = CallArgs::from_vp(vp, argc);
400        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
401
402                    call_default_constructor::<D>(
403                        SafeJSContext::from_ptr(cx.raw_cx()),
404                        &args,
405                        &global,
406                        PrototypeList::ID::GamepadEvent,
407                        "GamepadEvent",
408                        CreateInterfaceObjects::<D>,
409                        |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
410
411        if argc < 2 {
412            throw_type_error(cx.raw_cx(), "Not enough arguments to \"GamepadEvent.constructor\".");
413            return false;
414        }
415        let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
416            Ok(ConversionResult::Success(value)) => value,
417            Ok(ConversionResult::Failure(error)) => {
418                throw_type_error(cx.raw_cx(), &error);
419        return false;
420
421            }
422            _ => {
423                return false;
424
425            },
426        }
427        ;
428        let arg1: crate::codegen::GenericBindings::GamepadEventBinding::GamepadEventInit<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
429            Ok(ConversionResult::Success(value)) => value,
430            Ok(ConversionResult::Failure(error)) => {
431                throw_type_error(cx.raw_cx(), &error);
432        return false;
433
434            }
435            _ => {
436                return false;
437
438            },
439        }
440        ;
441        let result: Result<DomRoot<D::GamepadEvent>, Error> = <D::GamepadEvent>::Constructor(global.downcast::<D::Window>().unwrap(), Some(desired_proto), CanGc::note(), arg0, &arg1);
442        let result = match result {
443            Ok(result) => result,
444            Err(e) => {
445                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
446                return false;
447            },
448        };
449
450        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
451        return true;
452                        }
453                    )
454
455    });
456    result
457}
458
459
460static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
461
462pub(crate) fn init_interface_object<D: DomTypes>() {
463    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
464        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
465        b"function GamepadEvent() {\n    [native code]\n}",
466        PrototypeList::ID::GamepadEvent,
467        1,
468    ));
469}
470
471pub fn DefineDOMInterface<D: DomTypes>
472(cx: SafeJSContext, global: HandleObject){
473    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GamepadEvent),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
474}
475
476pub fn ConstructorEnabled<D: DomTypes>
477(aCx: SafeJSContext, aObj: HandleObject) -> bool{
478    is_exposed_in(aObj, Globals::WINDOW) &&
479    pref!(dom_gamepad_enabled)
480}
481
482unsafe fn CreateInterfaceObjects<D: DomTypes>
483(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
484
485    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
486    Event_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
487    assert!(!prototype_proto.is_null());
488
489    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
490    create_interface_prototype_object::<D>(cx,
491                                      global,
492                                      prototype_proto.handle(),
493                                      &PrototypeClass,
494                                      &[],
495                                      sAttributes.get(),
496                                      &[],
497                                      &[],
498                                      prototype.handle_mut());
499    assert!(!prototype.is_null());
500    assert!((*cache)[PrototypeList::ID::GamepadEvent as usize].is_null());
501    (*cache)[PrototypeList::ID::GamepadEvent as usize] = prototype.get();
502    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GamepadEvent as isize),
503                                  ptr::null_mut(),
504                                  prototype.get());
505
506    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
507
508    Event_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
509
510    assert!(!interface_proto.is_null());
511
512    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
513    create_noncallback_interface_object::<D>(cx,
514                                        global,
515                                        interface_proto.handle(),
516                                        INTERFACE_OBJECT_CLASS.get(),
517                                        &[],
518                                        &[],
519                                        &[],
520                                        prototype.handle(),
521                                        c"GamepadEvent",
522                                        2,
523                                        &[],
524                                        interface.handle_mut());
525    assert!(!interface.is_null());
526
527    rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
528    unforgeable_holder.handle_mut().set(
529        JS_NewObjectWithoutMetadata(cx.raw_cx(), &Class.get().base as *const JSClass, prototype.handle()));
530    assert!(!unforgeable_holder.is_null());
531
532    define_guarded_properties::<D>(cx, unforgeable_holder.handle(), unsafe { sLegacyUnforgeableAttributes.get() }, global);
533    let val = ObjectValue(unforgeable_holder.get());
534    JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
535}
536
537
538        pub(crate) fn init_statics<D: DomTypes>() {
539            init_interface_object::<D>();
540            init_domjs_class::<D>();
541
542            init_gamepad_getterinfo::<D>();
543init_isTrusted_getterinfo::<D>();
544
545
546            init_sAttributes_specs::<D>();
547init_sAttributes_prefs::<D>();
548init_sLegacyUnforgeableAttributes_specs::<D>();
549init_sLegacyUnforgeableAttributes_prefs::<D>();
550        }
551        } // mod GamepadEvent_Binding
552
553