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