script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
MessageEventBinding.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::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
8use crate::import::base::*;
9
10pub use self::GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker as MessageEventSource;
11
12#[derive(JSTraceable)]
13#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
14pub struct MessageEventInit<D: DomTypes> {
15    pub parent: crate::codegen::GenericBindings::EventBinding::EventInit,
16    pub data: RootedTraceableBox<Heap<JSVal>>,
17    pub lastEventId: DOMString,
18    pub origin: DOMString,
19    pub ports: Vec<DomRoot<D::MessagePort>>,
20    pub source: Option<GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker::<D> >,
21}
22impl<D: DomTypes> Default for MessageEventInit<D> {
23    fn default() -> Self {
24        Self {
25                    parent: Default::default(),
26        data: Default::default(),
27        lastEventId: Default::default(),
28        origin: Default::default(),
29        ports: Default::default(),
30        source: Default::default(),        }
31    }
32}
33
34impl<D: DomTypes> MessageEventInit<D> {
35    pub fn empty() -> RootedTraceableBox<Self> {
36        let mut dictionary = RootedTraceableBox::new(Self::default());
37                dictionary.parent = crate::codegen::GenericBindings::EventBinding::EventInit::empty();
38                dictionary.data = RootedTraceableBox::from_box(Heap::boxed(NullValue()));
39                dictionary.lastEventId = DOMString::from("");
40                dictionary.origin = DOMString::from("");
41                dictionary.ports = Vec::new();
42                dictionary.source = None;
43        dictionary
44    }
45    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
46                      -> Result<ConversionResult<RootedTraceableBox<MessageEventInit<D>>>, ()> {
47        unsafe {
48            let object = if val.get().is_null_or_undefined() {
49                ptr::null_mut()
50            } else if val.get().is_object() {
51                val.get().to_object()
52            } else {
53                return Ok(ConversionResult::Failure("Value is not an object.".into()));
54            };
55            rooted!(&in(cx) let object = object);
56        let dictionary = RootedTraceableBox::new(MessageEventInit {
57                parent: {
58                    match crate::codegen::GenericBindings::EventBinding::EventInit::new(cx, val, can_gc)? {
59                        ConversionResult::Success(v) => v,
60                        ConversionResult::Failure(error) => {
61                            throw_type_error(cx.raw_cx(), &error);
62                            return Err(());
63                        }
64                    }
65                },
66                data: {
67                    rooted!(&in(cx) let mut rval = UndefinedValue());
68                    if get_dictionary_property(cx.raw_cx(), object.handle(), "data", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
69                            RootedTraceableBox::from_box(Heap::boxed(rval.handle().get()))
70                    } else {
71                            RootedTraceableBox::from_box(Heap::boxed(NullValue()))
72                    }
73                },
74                lastEventId: {
75                    rooted!(&in(cx) let mut rval = UndefinedValue());
76                    if get_dictionary_property(cx.raw_cx(), object.handle(), "lastEventId", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
77                            match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), StringificationBehavior::Default) {
78                                Ok(ConversionResult::Success(value)) => value,
79                                Ok(ConversionResult::Failure(error)) => {
80                                    throw_type_error(cx.raw_cx(), &error);
81                            return Err(());
82
83                                }
84                                _ => {
85                                    return Err(());
86
87                                },
88                            }
89
90                    } else {
91                            DOMString::from("")
92                    }
93                },
94                origin: {
95                    rooted!(&in(cx) let mut rval = UndefinedValue());
96                    if get_dictionary_property(cx.raw_cx(), object.handle(), "origin", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
97                            match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), StringificationBehavior::Default) {
98                                Ok(ConversionResult::Success(value)) => value,
99                                Ok(ConversionResult::Failure(error)) => {
100                                    throw_type_error(cx.raw_cx(), &error);
101                            return Err(());
102
103                                }
104                                _ => {
105                                    return Err(());
106
107                                },
108                            }
109
110                    } else {
111                            DOMString::from("")
112                    }
113                },
114                ports: {
115                    rooted!(&in(cx) let mut rval = UndefinedValue());
116                    if get_dictionary_property(cx.raw_cx(), object.handle(), "ports", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
117                            match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
118                                Ok(ConversionResult::Success(value)) => value,
119                                Ok(ConversionResult::Failure(error)) => {
120                                    throw_type_error(cx.raw_cx(), &error);
121                            return Err(());
122
123                                }
124                                _ => {
125                                    return Err(());
126
127                                },
128                            }
129
130                    } else {
131                            Vec::new()
132                    }
133                },
134                source: {
135                    rooted!(&in(cx) let mut rval = UndefinedValue());
136                    if get_dictionary_property(cx.raw_cx(), object.handle(), "source", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
137                            match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
138                                Ok(ConversionResult::Success(value)) => value,
139                                Ok(ConversionResult::Failure(error)) => {
140                                    throw_type_error(cx.raw_cx(), &error);
141                            return Err(());
142
143                                }
144                                _ => {
145                                    return Err(());
146
147                                },
148                            }
149
150                    } else {
151                            None
152                    }
153                },
154        });
155            Ok(ConversionResult::Success(dictionary))
156        }
157    }
158}
159
160impl<D: DomTypes> FromJSValConvertible for RootedTraceableBox<MessageEventInit<D>> {
161    type Config = ();
162    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
163                         -> Result<ConversionResult<RootedTraceableBox<MessageEventInit<D>>>, ()> {
164        MessageEventInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
165    }
166}
167
168impl<D: DomTypes> MessageEventInit<D> {
169    #[allow(clippy::wrong_self_convention)]
170    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
171        self.parent.to_jsobject(cx, obj.reborrow());
172        let data = &self.data;
173        rooted!(in(cx) let mut data_js = UndefinedValue());
174        data.to_jsval(cx, data_js.handle_mut());
175        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "data", data_js.handle()).unwrap();
176        let lastEventId = &self.lastEventId;
177        rooted!(in(cx) let mut lastEventId_js = UndefinedValue());
178        lastEventId.to_jsval(cx, lastEventId_js.handle_mut());
179        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "lastEventId", lastEventId_js.handle()).unwrap();
180        let origin = &self.origin;
181        rooted!(in(cx) let mut origin_js = UndefinedValue());
182        origin.to_jsval(cx, origin_js.handle_mut());
183        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "origin", origin_js.handle()).unwrap();
184        let ports = &self.ports;
185        rooted!(in(cx) let mut ports_js = UndefinedValue());
186        ports.to_jsval(cx, ports_js.handle_mut());
187        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "ports", ports_js.handle()).unwrap();
188        let source = &self.source;
189        rooted!(in(cx) let mut source_js = UndefinedValue());
190        source.to_jsval(cx, source_js.handle_mut());
191        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "source", source_js.handle()).unwrap();
192    }
193}
194
195impl<D: DomTypes> ToJSValConvertible for MessageEventInit<D> {
196    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
197        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
198        self.to_jsobject(cx, obj.handle_mut());
199        rval.set(ObjectOrNullValue(obj.get()))
200    }
201}
202
203
204pub use self::MessageEvent_Binding::{Wrap, MessageEventMethods, GetProtoObject, DefineDOMInterface};
205pub mod MessageEvent_Binding {
206use crate::codegen::GenericBindings::EventBinding::Event_Binding;
207use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
208use crate::codegen::GenericBindings::MessageEventBinding::MessageEventInit;
209use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
210use crate::import::module::*;
211
212unsafe extern "C" fn get_data<D: DomTypes>
213(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
214    let mut result = false;
215    wrap_panic(&mut || result = (|| {
216        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
217        let this = &*(this as *const D::MessageEvent);
218        rooted!(&in(cx) let mut retval: JSVal);
219        let result: () = this.Data(SafeJSContext::from_ptr(cx.raw_cx()), retval.handle_mut());
220
221        (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
222        return true;
223    })());
224    result
225}
226
227
228static data_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
229
230pub(crate) fn init_data_getterinfo<D: DomTypes>() {
231    data_getterinfo.set(JSJitInfo {
232    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
233        getter: Some(get_data::<D>)
234    },
235    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
236        protoID: PrototypeList::ID::MessageEvent as u16,
237    },
238    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
239    _bitfield_align_1: [],
240    _bitfield_1: __BindgenBitfieldUnit::new(
241        new_jsjitinfo_bitfield_1!(
242            JSJitInfo_OpType::Getter as u8,
243            JSJitInfo_AliasSet::AliasEverything as u8,
244            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
245            true,
246            false,
247            false,
248            false,
249            false,
250            false,
251            0,
252        ).to_ne_bytes()
253    ),
254});
255}
256unsafe extern "C" fn get_origin<D: DomTypes>
257(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
258    let mut result = false;
259    wrap_panic(&mut || result = (|| {
260        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
261        let this = &*(this as *const D::MessageEvent);
262        let result: DOMString = this.Origin();
263
264        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
265        return true;
266    })());
267    result
268}
269
270
271static origin_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
272
273pub(crate) fn init_origin_getterinfo<D: DomTypes>() {
274    origin_getterinfo.set(JSJitInfo {
275    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
276        getter: Some(get_origin::<D>)
277    },
278    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
279        protoID: PrototypeList::ID::MessageEvent as u16,
280    },
281    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
282    _bitfield_align_1: [],
283    _bitfield_1: __BindgenBitfieldUnit::new(
284        new_jsjitinfo_bitfield_1!(
285            JSJitInfo_OpType::Getter as u8,
286            JSJitInfo_AliasSet::AliasEverything as u8,
287            JSValueType::JSVAL_TYPE_STRING as u8,
288            true,
289            false,
290            false,
291            false,
292            false,
293            false,
294            0,
295        ).to_ne_bytes()
296    ),
297});
298}
299unsafe extern "C" fn get_lastEventId<D: DomTypes>
300(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
301    let mut result = false;
302    wrap_panic(&mut || result = (|| {
303        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
304        let this = &*(this as *const D::MessageEvent);
305        let result: DOMString = this.LastEventId();
306
307        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
308        return true;
309    })());
310    result
311}
312
313
314static lastEventId_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
315
316pub(crate) fn init_lastEventId_getterinfo<D: DomTypes>() {
317    lastEventId_getterinfo.set(JSJitInfo {
318    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
319        getter: Some(get_lastEventId::<D>)
320    },
321    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
322        protoID: PrototypeList::ID::MessageEvent as u16,
323    },
324    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
325    _bitfield_align_1: [],
326    _bitfield_1: __BindgenBitfieldUnit::new(
327        new_jsjitinfo_bitfield_1!(
328            JSJitInfo_OpType::Getter as u8,
329            JSJitInfo_AliasSet::AliasEverything as u8,
330            JSValueType::JSVAL_TYPE_STRING as u8,
331            true,
332            false,
333            false,
334            false,
335            false,
336            false,
337            0,
338        ).to_ne_bytes()
339    ),
340});
341}
342unsafe extern "C" fn get_source<D: DomTypes>
343(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
344    let mut result = false;
345    wrap_panic(&mut || result = (|| {
346        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
347        let this = &*(this as *const D::MessageEvent);
348        let result: Option<GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker::<D>> = this.GetSource();
349
350        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
351        return true;
352    })());
353    result
354}
355
356
357static source_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
358
359pub(crate) fn init_source_getterinfo<D: DomTypes>() {
360    source_getterinfo.set(JSJitInfo {
361    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
362        getter: Some(get_source::<D>)
363    },
364    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
365        protoID: PrototypeList::ID::MessageEvent as u16,
366    },
367    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
368    _bitfield_align_1: [],
369    _bitfield_1: __BindgenBitfieldUnit::new(
370        new_jsjitinfo_bitfield_1!(
371            JSJitInfo_OpType::Getter as u8,
372            JSJitInfo_AliasSet::AliasEverything as u8,
373            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
374            true,
375            false,
376            false,
377            false,
378            false,
379            false,
380            0,
381        ).to_ne_bytes()
382    ),
383});
384}
385unsafe extern "C" fn get_ports<D: DomTypes>
386(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
387    let mut result = false;
388    wrap_panic(&mut || result = (|| {
389        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
390        let this = &*(this as *const D::MessageEvent);
391        rooted!(&in(cx) let mut retval: JSVal);
392        let result: () = this.Ports(SafeJSContext::from_ptr(cx.raw_cx()), CanGc::note(), retval.handle_mut());
393
394        (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
395        return true;
396    })());
397    result
398}
399
400
401static ports_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
402
403pub(crate) fn init_ports_getterinfo<D: DomTypes>() {
404    ports_getterinfo.set(JSJitInfo {
405    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
406        getter: Some(get_ports::<D>)
407    },
408    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
409        protoID: PrototypeList::ID::MessageEvent as u16,
410    },
411    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
412    _bitfield_align_1: [],
413    _bitfield_1: __BindgenBitfieldUnit::new(
414        new_jsjitinfo_bitfield_1!(
415            JSJitInfo_OpType::Getter as u8,
416            JSJitInfo_AliasSet::AliasEverything as u8,
417            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
418            true,
419            false,
420            false,
421            false,
422            false,
423            false,
424            0,
425        ).to_ne_bytes()
426    ),
427});
428}
429unsafe extern "C" fn initMessageEvent<D: DomTypes>
430(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
431    let mut result = false;
432    wrap_panic(&mut || result = (|| {
433        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
434        let this = &*(this as *const D::MessageEvent);
435        let args = &*args;
436        let argc = args.argc_;
437
438        if argc < 1 {
439            throw_type_error(cx.raw_cx(), "Not enough arguments to \"MessageEvent.initMessageEvent\".");
440            return false;
441        }
442        let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
443            Ok(ConversionResult::Success(value)) => value,
444            Ok(ConversionResult::Failure(error)) => {
445                throw_type_error(cx.raw_cx(), &error);
446        return false;
447
448            }
449            _ => {
450                return false;
451
452            },
453        }
454        ;
455        let arg1: bool = if args.get(1).is_undefined() {
456            false
457        } else {
458            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
459                Ok(ConversionResult::Success(value)) => value,
460                Ok(ConversionResult::Failure(error)) => {
461                    throw_type_error(cx.raw_cx(), &error);
462            return false;
463
464                }
465                _ => {
466                    return false;
467
468                },
469            }
470
471        };
472        let arg2: bool = if args.get(2).is_undefined() {
473            false
474        } else {
475            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
476                Ok(ConversionResult::Success(value)) => value,
477                Ok(ConversionResult::Failure(error)) => {
478                    throw_type_error(cx.raw_cx(), &error);
479            return false;
480
481                }
482                _ => {
483                    return false;
484
485                },
486            }
487
488        };
489        let arg3: HandleValue = if args.get(3).is_undefined() {
490            HandleValue::null()
491        } else {
492            HandleValue::from_raw(args.get(3))
493        };
494        let arg4: DOMString = if args.get(4).is_undefined() {
495            DOMString::from("")
496        } else {
497            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), StringificationBehavior::Default) {
498                Ok(ConversionResult::Success(value)) => value,
499                Ok(ConversionResult::Failure(error)) => {
500                    throw_type_error(cx.raw_cx(), &error);
501            return false;
502
503                }
504                _ => {
505                    return false;
506
507                },
508            }
509
510        };
511        let arg5: DOMString = if args.get(5).is_undefined() {
512            DOMString::from("")
513        } else {
514            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(5)), StringificationBehavior::Default) {
515                Ok(ConversionResult::Success(value)) => value,
516                Ok(ConversionResult::Failure(error)) => {
517                    throw_type_error(cx.raw_cx(), &error);
518            return false;
519
520                }
521                _ => {
522                    return false;
523
524                },
525            }
526
527        };
528        let arg6: Option<GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker::<D> > = if args.get(6).is_undefined() {
529            None
530        } else {
531            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(6)), ()) {
532                Ok(ConversionResult::Success(value)) => value,
533                Ok(ConversionResult::Failure(error)) => {
534                    throw_type_error(cx.raw_cx(), &error);
535            return false;
536
537                }
538                _ => {
539                    return false;
540
541                },
542            }
543
544        };
545        let arg7: Vec<DomRoot<D::MessagePort>> = if args.get(7).is_undefined() {
546            Vec::new()
547        } else {
548            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(7)), ()) {
549                Ok(ConversionResult::Success(value)) => value,
550                Ok(ConversionResult::Failure(error)) => {
551                    throw_type_error(cx.raw_cx(), &error);
552            return false;
553
554                }
555                _ => {
556                    return false;
557
558                },
559            }
560
561        };
562        let result: () = this.InitMessageEvent(SafeJSContext::from_ptr(cx.raw_cx()), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
563
564        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
565        return true;
566    })());
567    result
568}
569
570
571static initMessageEvent_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
572
573pub(crate) fn init_initMessageEvent_methodinfo<D: DomTypes>() {
574    initMessageEvent_methodinfo.set(JSJitInfo {
575    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
576        method: Some(initMessageEvent::<D>)
577    },
578    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
579        protoID: PrototypeList::ID::MessageEvent as u16,
580    },
581    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
582    _bitfield_align_1: [],
583    _bitfield_1: __BindgenBitfieldUnit::new(
584        new_jsjitinfo_bitfield_1!(
585            JSJitInfo_OpType::Method as u8,
586            JSJitInfo_AliasSet::AliasEverything as u8,
587            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
588            false,
589            false,
590            false,
591            false,
592            false,
593            false,
594            0,
595        ).to_ne_bytes()
596    ),
597});
598}
599unsafe extern "C" fn get_isTrusted<D: DomTypes>
600(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
601    let mut result = false;
602    wrap_panic(&mut || result = (|| {
603        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
604        let this = &*(this as *const D::MessageEvent);
605        let result: bool = this.IsTrusted();
606
607        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
608        return true;
609    })());
610    result
611}
612
613
614static isTrusted_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
615
616pub(crate) fn init_isTrusted_getterinfo<D: DomTypes>() {
617    isTrusted_getterinfo.set(JSJitInfo {
618    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
619        getter: Some(get_isTrusted::<D>)
620    },
621    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
622        protoID: PrototypeList::ID::MessageEvent as u16,
623    },
624    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
625    _bitfield_align_1: [],
626    _bitfield_1: __BindgenBitfieldUnit::new(
627        new_jsjitinfo_bitfield_1!(
628            JSJitInfo_OpType::Getter as u8,
629            JSJitInfo_AliasSet::AliasEverything as u8,
630            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
631            true,
632            false,
633            false,
634            false,
635            false,
636            false,
637            0,
638        ).to_ne_bytes()
639    ),
640});
641}
642unsafe extern "C" fn _finalize<D: DomTypes>
643(_cx: *mut GCContext, obj: *mut JSObject){
644    wrap_panic(&mut || {
645
646        let this = native_from_object_static::<D::MessageEvent>(obj).unwrap();
647        finalize_common(this);
648    })
649}
650
651unsafe extern "C" fn _trace<D: DomTypes>
652(trc: *mut JSTracer, obj: *mut JSObject){
653    wrap_panic(&mut || {
654
655        let this = native_from_object_static::<D::MessageEvent>(obj).unwrap();
656        if this.is_null() { return; } // GC during obj creation
657        (*this).trace(trc);
658    })
659}
660
661
662static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
663
664pub(crate) fn init_class_ops<D: DomTypes>() {
665    CLASS_OPS.set(JSClassOps {
666        addProperty: None,
667        delProperty: None,
668        enumerate: None,
669        newEnumerate: None,
670        resolve: None,
671        mayResolve: None,
672        finalize: Some(_finalize::<D>),
673        call: None,
674        construct: None,
675        trace: Some(_trace::<D>),
676    });
677}
678
679pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
680
681pub(crate) fn init_domjs_class<D: DomTypes>() {
682    init_class_ops::<D>();
683    Class.set(DOMJSClass {
684        base: JSClass {
685            name: c"MessageEvent".as_ptr(),
686            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
687                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
688                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
689            cOps: unsafe { CLASS_OPS.get() },
690            spec: ptr::null(),
691            ext: ptr::null(),
692            oOps: ptr::null(),
693        },
694        dom_class:
695DOMClass {
696    interface_chain: [ PrototypeList::ID::Event, PrototypeList::ID::MessageEvent, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
697    depth: 1,
698    type_id: crate::codegen::InheritTypes::TopTypeId { event: (crate::codegen::InheritTypes::EventTypeId::MessageEvent) },
699    malloc_size_of: malloc_size_of_including_raw_self::<D::MessageEvent> as unsafe fn(&mut _, _) -> _,
700    global: Globals::EMPTY,
701},
702    });
703}
704
705#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
706(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::MessageEvent>, _can_gc: CanGc) -> DomRoot<D::MessageEvent>{
707
708    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
709
710    let scope = scope.reflector().get_jsobject();
711    assert!(!scope.get().is_null());
712    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
713    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
714
715    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
716    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
717    assert!(!canonical_proto.is_null());
718
719
720    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
721    if let Some(given) = given_proto {
722        proto.set(*given);
723        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
724            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
725        }
726    } else {
727        proto.set(*canonical_proto);
728    }
729    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
730        cx.raw_cx(),
731        &Class.get().base,
732        proto.handle(),
733    ));
734    assert!(!obj.is_null());
735    JS_SetReservedSlot(
736        obj.get(),
737        DOM_OBJECT_SLOT,
738        &PrivateValue(raw.as_ptr() as *const libc::c_void),
739    );
740
741    let root = raw.reflect_with(obj.get());
742
743
744    let mut slot = UndefinedValue();
745    JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
746    rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
747    unforgeable_holder.handle_mut().set(slot.to_object());
748    assert!(JS_InitializePropertiesFromCompatibleNativeObject(cx.raw_cx(), obj.handle(), unforgeable_holder.handle()));
749
750
751    DomRoot::from_ref(&*root)
752}
753
754pub trait MessageEventMethods<D: DomTypes> {
755    fn Data(&self, r#cx: SafeJSContext, r#retval: MutableHandleValue);
756    fn Origin(&self, ) -> DOMString;
757    fn LastEventId(&self, ) -> DOMString;
758    fn GetSource(&self, ) -> Option<GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker::<D>>;
759    fn Ports(&self, r#cx: SafeJSContext, r#_can_gc: CanGc, r#retval: MutableHandleValue);
760    fn InitMessageEvent(&self, r#cx: SafeJSContext, r#type_: DOMString, r#bubbles: bool, r#cancelable: bool, r#data: HandleValue, r#origin: DOMString, r#lastEventId: DOMString, r#source: Option<GenericUnionTypes::WindowProxyOrMessagePortOrServiceWorker::<D> >, r#ports: Vec<DomRoot<D::MessagePort>>);
761    fn IsTrusted(&self, ) -> bool;
762    fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#type_: DOMString, r#eventInitDict: RootedTraceableBox<crate::codegen::GenericBindings::MessageEventBinding::MessageEventInit<D>>) -> Fallible<DomRoot<D::MessageEvent>>;
763}
764static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
765
766pub(crate) fn init_sMethods_specs<D: DomTypes>() {
767    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
768    JSFunctionSpec {
769        name: JSPropertySpec_Name { string_: c"initMessageEvent".as_ptr() },
770        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { initMessageEvent_methodinfo.get() } as *const _ as *const JSJitInfo },
771        nargs: 1,
772        flags: (JSPROP_ENUMERATE) as u16,
773        selfHostedName: ptr::null()
774    },
775    JSFunctionSpec {
776        name: JSPropertySpec_Name { string_: ptr::null() },
777        call: JSNativeWrapper { op: None, info: ptr::null() },
778        nargs: 0,
779        flags: 0,
780        selfHostedName: ptr::null()
781    }]))[..]
782])));
783}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
784
785pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
786    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])])));
787}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
788
789pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
790    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
791    JSPropertySpec {
792                    name: JSPropertySpec_Name { string_: c"data".as_ptr() },
793                    attributes_: (JSPROP_ENUMERATE),
794                    kind_: (JSPropertySpec_Kind::NativeAccessor),
795                    u: JSPropertySpec_AccessorsOrValue {
796                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
797                            getter: JSPropertySpec_Accessor {
798                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { data_getterinfo.get() } },
799                            },
800                            setter: JSPropertySpec_Accessor {
801                                native: JSNativeWrapper { op: None, info: ptr::null() },
802                            }
803                        }
804                    }
805                }
806,
807    JSPropertySpec {
808                    name: JSPropertySpec_Name { string_: c"origin".as_ptr() },
809                    attributes_: (JSPROP_ENUMERATE),
810                    kind_: (JSPropertySpec_Kind::NativeAccessor),
811                    u: JSPropertySpec_AccessorsOrValue {
812                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
813                            getter: JSPropertySpec_Accessor {
814                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { origin_getterinfo.get() } },
815                            },
816                            setter: JSPropertySpec_Accessor {
817                                native: JSNativeWrapper { op: None, info: ptr::null() },
818                            }
819                        }
820                    }
821                }
822,
823    JSPropertySpec {
824                    name: JSPropertySpec_Name { string_: c"lastEventId".as_ptr() },
825                    attributes_: (JSPROP_ENUMERATE),
826                    kind_: (JSPropertySpec_Kind::NativeAccessor),
827                    u: JSPropertySpec_AccessorsOrValue {
828                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
829                            getter: JSPropertySpec_Accessor {
830                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { lastEventId_getterinfo.get() } },
831                            },
832                            setter: JSPropertySpec_Accessor {
833                                native: JSNativeWrapper { op: None, info: ptr::null() },
834                            }
835                        }
836                    }
837                }
838,
839    JSPropertySpec {
840                    name: JSPropertySpec_Name { string_: c"source".as_ptr() },
841                    attributes_: (JSPROP_ENUMERATE),
842                    kind_: (JSPropertySpec_Kind::NativeAccessor),
843                    u: JSPropertySpec_AccessorsOrValue {
844                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
845                            getter: JSPropertySpec_Accessor {
846                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { source_getterinfo.get() } },
847                            },
848                            setter: JSPropertySpec_Accessor {
849                                native: JSNativeWrapper { op: None, info: ptr::null() },
850                            }
851                        }
852                    }
853                }
854,
855    JSPropertySpec {
856                    name: JSPropertySpec_Name { string_: c"ports".as_ptr() },
857                    attributes_: (JSPROP_ENUMERATE),
858                    kind_: (JSPropertySpec_Kind::NativeAccessor),
859                    u: JSPropertySpec_AccessorsOrValue {
860                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
861                            getter: JSPropertySpec_Accessor {
862                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { ports_getterinfo.get() } },
863                            },
864                            setter: JSPropertySpec_Accessor {
865                                native: JSNativeWrapper { op: None, info: ptr::null() },
866                            }
867                        }
868                    }
869                }
870,
871    JSPropertySpec::ZERO]))[..]
872,
873&Box::leak(Box::new([
874    JSPropertySpec {
875                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
876                    attributes_: (JSPROP_READONLY),
877                    kind_: (JSPropertySpec_Kind::Value),
878                    u: JSPropertySpec_AccessorsOrValue {
879                        value: JSPropertySpec_ValueWrapper {
880                            type_: JSPropertySpec_ValueWrapper_Type::String,
881                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
882                                string: c"MessageEvent".as_ptr(),
883                            }
884                        }
885                    }
886                }
887,
888    JSPropertySpec::ZERO]))[..]
889])));
890}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
891
892pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
893    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]),
894    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
895}static sLegacyUnforgeableAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
896
897pub(crate) fn init_sLegacyUnforgeableAttributes_specs<D: DomTypes>() {
898    sLegacyUnforgeableAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
899    JSPropertySpec {
900                    name: JSPropertySpec_Name { string_: c"isTrusted".as_ptr() },
901                    attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
902                    kind_: (JSPropertySpec_Kind::NativeAccessor),
903                    u: JSPropertySpec_AccessorsOrValue {
904                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
905                            getter: JSPropertySpec_Accessor {
906                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { isTrusted_getterinfo.get() } },
907                            },
908                            setter: JSPropertySpec_Accessor {
909                                native: JSNativeWrapper { op: None, info: ptr::null() },
910                            }
911                        }
912                    }
913                }
914,
915    JSPropertySpec::ZERO]))[..]
916])));
917}static sLegacyUnforgeableAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
918
919pub(crate) fn init_sLegacyUnforgeableAttributes_prefs<D: DomTypes>() {
920    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])])));
921}
922pub fn GetProtoObject<D: DomTypes>
923(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
924    /* Get the interface prototype object for this class.  This will create the
925       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::MessageEvent), CreateInterfaceObjects::<D>, rval)
926}
927
928
929static PrototypeClass: JSClass = JSClass {
930    name: c"MessageEventPrototype".as_ptr(),
931    flags:
932        // JSCLASS_HAS_RESERVED_SLOTS()
933        (1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
934    cOps: ptr::null(),
935    spec: ptr::null(),
936    ext: ptr::null(),
937    oOps: ptr::null(),
938};
939
940unsafe extern "C" fn _constructor<D: DomTypes>
941(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
942    let mut result = false;
943    wrap_panic(&mut || result = {
944        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
945        let args = CallArgs::from_vp(vp, argc);
946        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
947
948                    call_default_constructor::<D>(
949                        SafeJSContext::from_ptr(cx.raw_cx()),
950                        &args,
951                        &global,
952                        PrototypeList::ID::MessageEvent,
953                        "MessageEvent",
954                        CreateInterfaceObjects::<D>,
955                        |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
956
957        if argc < 1 {
958            throw_type_error(cx.raw_cx(), "Not enough arguments to \"MessageEvent.constructor\".");
959            return false;
960        }
961        let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
962            Ok(ConversionResult::Success(value)) => value,
963            Ok(ConversionResult::Failure(error)) => {
964                throw_type_error(cx.raw_cx(), &error);
965        return false;
966
967            }
968            _ => {
969                return false;
970
971            },
972        }
973        ;
974        let arg1: RootedTraceableBox<crate::codegen::GenericBindings::MessageEventBinding::MessageEventInit<D>> = if args.get(1).is_undefined() {
975            crate::codegen::GenericBindings::MessageEventBinding::MessageEventInit::empty()
976        } else {
977            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
978                Ok(ConversionResult::Success(value)) => value,
979                Ok(ConversionResult::Failure(error)) => {
980                    throw_type_error(cx.raw_cx(), &error);
981            return false;
982
983                }
984                _ => {
985                    return false;
986
987                },
988            }
989
990        };
991        let result: Result<DomRoot<D::MessageEvent>, Error> = <D::MessageEvent>::Constructor(global, Some(desired_proto), CanGc::note(), arg0, arg1);
992        let result = match result {
993            Ok(result) => result,
994            Err(e) => {
995                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
996                return false;
997            },
998        };
999
1000        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1001        return true;
1002                        }
1003                    )
1004
1005    });
1006    result
1007}
1008
1009
1010static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
1011
1012pub(crate) fn init_interface_object<D: DomTypes>() {
1013    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
1014        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
1015        b"function MessageEvent() {\n    [native code]\n}",
1016        PrototypeList::ID::MessageEvent,
1017        1,
1018    ));
1019}
1020
1021pub fn DefineDOMInterface<D: DomTypes>
1022(cx: SafeJSContext, global: HandleObject){
1023    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::MessageEvent),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
1024}
1025
1026pub fn ConstructorEnabled<D: DomTypes>
1027(aCx: SafeJSContext, aObj: HandleObject) -> bool{
1028    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW)
1029}
1030
1031unsafe fn CreateInterfaceObjects<D: DomTypes>
1032(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1033
1034    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1035    Event_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
1036    assert!(!prototype_proto.is_null());
1037
1038    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1039    create_interface_prototype_object::<D>(cx,
1040                                      global,
1041                                      prototype_proto.handle(),
1042                                      &PrototypeClass,
1043                                      sMethods.get(),
1044                                      sAttributes.get(),
1045                                      &[],
1046                                      &[],
1047                                      prototype.handle_mut());
1048    assert!(!prototype.is_null());
1049    assert!((*cache)[PrototypeList::ID::MessageEvent as usize].is_null());
1050    (*cache)[PrototypeList::ID::MessageEvent as usize] = prototype.get();
1051    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::MessageEvent as isize),
1052                                  ptr::null_mut(),
1053                                  prototype.get());
1054
1055    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
1056
1057    Event_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
1058
1059    assert!(!interface_proto.is_null());
1060
1061    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
1062    create_noncallback_interface_object::<D>(cx,
1063                                        global,
1064                                        interface_proto.handle(),
1065                                        INTERFACE_OBJECT_CLASS.get(),
1066                                        &[],
1067                                        &[],
1068                                        &[],
1069                                        prototype.handle(),
1070                                        c"MessageEvent",
1071                                        1,
1072                                        &[],
1073                                        interface.handle_mut());
1074    assert!(!interface.is_null());
1075
1076    rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
1077    unforgeable_holder.handle_mut().set(
1078        JS_NewObjectWithoutMetadata(cx.raw_cx(), &Class.get().base as *const JSClass, prototype.handle()));
1079    assert!(!unforgeable_holder.is_null());
1080
1081    define_guarded_properties::<D>(cx, unforgeable_holder.handle(), unsafe { sLegacyUnforgeableAttributes.get() }, global);
1082    let val = ObjectValue(unforgeable_holder.get());
1083    JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
1084}
1085
1086
1087        pub(crate) fn init_statics<D: DomTypes>() {
1088            init_interface_object::<D>();
1089            init_domjs_class::<D>();
1090            crate::codegen::GenericBindings::MessageEventBinding::MessageEvent_Binding::init_initMessageEvent_methodinfo::<D>();
1091            init_data_getterinfo::<D>();
1092init_origin_getterinfo::<D>();
1093init_lastEventId_getterinfo::<D>();
1094init_source_getterinfo::<D>();
1095init_ports_getterinfo::<D>();
1096init_isTrusted_getterinfo::<D>();
1097
1098
1099            init_sMethods_specs::<D>();
1100init_sMethods_prefs::<D>();
1101init_sAttributes_specs::<D>();
1102init_sAttributes_prefs::<D>();
1103init_sLegacyUnforgeableAttributes_specs::<D>();
1104init_sLegacyUnforgeableAttributes_prefs::<D>();
1105        }
1106        } // mod MessageEvent_Binding
1107
1108