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