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::import::base::*;
7
8pub use self::DebuggerAddDebuggeeEvent_Binding::{Wrap as DebuggerAddDebuggeeEventWrap, DebuggerAddDebuggeeEventMethods, GetProtoObject as DebuggerAddDebuggeeEventGetProtoObject, DefineDOMInterface as DebuggerAddDebuggeeEventDefineDOMInterface};
9pub mod DebuggerAddDebuggeeEvent_Binding {
10use crate::codegen::GenericBindings::EventBinding::Event_Binding;
11use crate::import::module::*;
12
13unsafe extern "C" fn get_global<D: DomTypes>
14(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15 let mut result = false;
16 wrap_panic(&mut || result = (|| {
17 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18 let this = &*(this as *const D::DebuggerAddDebuggeeEvent);
19 let result: NonNull<JSObject> = this.Global(SafeJSContext::from_ptr(cx.raw_cx()));
20
21 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
22 return true;
23 })());
24 result
25}
26
27
28static global_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29
30pub(crate) fn init_global_getterinfo<D: DomTypes>() {
31 global_getterinfo.set(JSJitInfo {
32 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
33 getter: Some(get_global::<D>)
34 },
35 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
36 protoID: PrototypeList::ID::DebuggerAddDebuggeeEvent as u16,
37 },
38 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
39 _bitfield_align_1: [],
40 _bitfield_1: __BindgenBitfieldUnit::new(
41 new_jsjitinfo_bitfield_1!(
42 JSJitInfo_OpType::Getter as u8,
43 JSJitInfo_AliasSet::AliasEverything as u8,
44 JSValueType::JSVAL_TYPE_OBJECT as u8,
45 true,
46 false,
47 false,
48 false,
49 false,
50 false,
51 0,
52 ).to_ne_bytes()
53 ),
54});
55}
56unsafe extern "C" fn get_pipelineId<D: DomTypes>
57(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
58 let mut result = false;
59 wrap_panic(&mut || result = (|| {
60 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
61 let this = &*(this as *const D::DebuggerAddDebuggeeEvent);
62 let result: DomRoot<D::PipelineId> = this.PipelineId();
63
64 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
65 return true;
66 })());
67 result
68}
69
70
71static pipelineId_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
72
73pub(crate) fn init_pipelineId_getterinfo<D: DomTypes>() {
74 pipelineId_getterinfo.set(JSJitInfo {
75 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
76 getter: Some(get_pipelineId::<D>)
77 },
78 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
79 protoID: PrototypeList::ID::DebuggerAddDebuggeeEvent as u16,
80 },
81 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
82 _bitfield_align_1: [],
83 _bitfield_1: __BindgenBitfieldUnit::new(
84 new_jsjitinfo_bitfield_1!(
85 JSJitInfo_OpType::Getter as u8,
86 JSJitInfo_AliasSet::AliasEverything as u8,
87 JSValueType::JSVAL_TYPE_OBJECT as u8,
88 true,
89 false,
90 false,
91 false,
92 false,
93 false,
94 0,
95 ).to_ne_bytes()
96 ),
97});
98}
99unsafe extern "C" fn get_workerId<D: DomTypes>
100(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
101 let mut result = false;
102 wrap_panic(&mut || result = (|| {
103 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
104 let this = &*(this as *const D::DebuggerAddDebuggeeEvent);
105 let result: Option<DOMString> = this.GetWorkerId();
106
107 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
108 return true;
109 })());
110 result
111}
112
113
114static workerId_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
115
116pub(crate) fn init_workerId_getterinfo<D: DomTypes>() {
117 workerId_getterinfo.set(JSJitInfo {
118 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
119 getter: Some(get_workerId::<D>)
120 },
121 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
122 protoID: PrototypeList::ID::DebuggerAddDebuggeeEvent as u16,
123 },
124 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
125 _bitfield_align_1: [],
126 _bitfield_1: __BindgenBitfieldUnit::new(
127 new_jsjitinfo_bitfield_1!(
128 JSJitInfo_OpType::Getter as u8,
129 JSJitInfo_AliasSet::AliasEverything as u8,
130 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
131 true,
132 false,
133 false,
134 false,
135 false,
136 false,
137 0,
138 ).to_ne_bytes()
139 ),
140});
141}
142unsafe extern "C" fn get_isTrusted<D: DomTypes>
143(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
144 let mut result = false;
145 wrap_panic(&mut || result = (|| {
146 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
147 let this = &*(this as *const D::DebuggerAddDebuggeeEvent);
148 let result: bool = this.IsTrusted();
149
150 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
151 return true;
152 })());
153 result
154}
155
156
157static isTrusted_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
158
159pub(crate) fn init_isTrusted_getterinfo<D: DomTypes>() {
160 isTrusted_getterinfo.set(JSJitInfo {
161 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
162 getter: Some(get_isTrusted::<D>)
163 },
164 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
165 protoID: PrototypeList::ID::DebuggerAddDebuggeeEvent as u16,
166 },
167 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
168 _bitfield_align_1: [],
169 _bitfield_1: __BindgenBitfieldUnit::new(
170 new_jsjitinfo_bitfield_1!(
171 JSJitInfo_OpType::Getter as u8,
172 JSJitInfo_AliasSet::AliasEverything as u8,
173 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
174 true,
175 false,
176 false,
177 false,
178 false,
179 false,
180 0,
181 ).to_ne_bytes()
182 ),
183});
184}
185unsafe extern "C" fn _finalize<D: DomTypes>
186(_cx: *mut GCContext, obj: *mut JSObject){
187 wrap_panic(&mut || {
188
189 let this = native_from_object_static::<D::DebuggerAddDebuggeeEvent>(obj).unwrap();
190 finalize_common(this);
191 })
192}
193
194unsafe extern "C" fn _trace<D: DomTypes>
195(trc: *mut JSTracer, obj: *mut JSObject){
196 wrap_panic(&mut || {
197
198 let this = native_from_object_static::<D::DebuggerAddDebuggeeEvent>(obj).unwrap();
199 if this.is_null() { return; } (*this).trace(trc);
201 })
202}
203
204
205static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
206
207pub(crate) fn init_class_ops<D: DomTypes>() {
208 CLASS_OPS.set(JSClassOps {
209 addProperty: None,
210 delProperty: None,
211 enumerate: None,
212 newEnumerate: None,
213 resolve: None,
214 mayResolve: None,
215 finalize: Some(_finalize::<D>),
216 call: None,
217 construct: None,
218 trace: Some(_trace::<D>),
219 });
220}
221
222pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
223
224pub(crate) fn init_domjs_class<D: DomTypes>() {
225 init_class_ops::<D>();
226 Class.set(DOMJSClass {
227 base: JSClass {
228 name: c"DebuggerAddDebuggeeEvent".as_ptr(),
229 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
230 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
231 ,
232 cOps: unsafe { CLASS_OPS.get() },
233 spec: ptr::null(),
234 ext: ptr::null(),
235 oOps: ptr::null(),
236 },
237 dom_class:
238DOMClass {
239 interface_chain: [ PrototypeList::ID::Event, PrototypeList::ID::DebuggerAddDebuggeeEvent, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
240 depth: 1,
241 type_id: crate::codegen::InheritTypes::TopTypeId { event: (crate::codegen::InheritTypes::EventTypeId::DebuggerAddDebuggeeEvent) },
242 malloc_size_of: malloc_size_of_including_raw_self::<D::DebuggerAddDebuggeeEvent> as unsafe fn(&mut _, _) -> _,
243 global: Globals::EMPTY,
244},
245 });
246}
247
248#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
249(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::DebuggerAddDebuggeeEvent>, _can_gc: CanGc) -> DomRoot<D::DebuggerAddDebuggeeEvent>{
250
251 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
252
253 let scope = scope.reflector().get_jsobject();
254 assert!(!scope.get().is_null());
255 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
256 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
257
258 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
259 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
260 assert!(!canonical_proto.is_null());
261
262
263 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
264 if let Some(given) = given_proto {
265 proto.set(*given);
266 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
267 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
268 }
269 } else {
270 proto.set(*canonical_proto);
271 }
272 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
273 cx.raw_cx(),
274 &Class.get().base,
275 proto.handle(),
276 ));
277 assert!(!obj.is_null());
278 JS_SetReservedSlot(
279 obj.get(),
280 DOM_OBJECT_SLOT,
281 &PrivateValue(raw.as_ptr() as *const libc::c_void),
282 );
283
284 let root = raw.reflect_with(obj.get());
285
286
287 let mut slot = UndefinedValue();
288 JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
289 rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
290 unforgeable_holder.handle_mut().set(slot.to_object());
291 assert!(JS_InitializePropertiesFromCompatibleNativeObject(cx.raw_cx(), obj.handle(), unforgeable_holder.handle()));
292
293
294 DomRoot::from_ref(&*root)
295}
296
297pub trait DebuggerAddDebuggeeEventMethods<D: DomTypes> {
298 fn Global(&self, r#cx: SafeJSContext) -> NonNull<JSObject>;
299 fn PipelineId(&self, ) -> DomRoot<D::PipelineId>;
300 fn GetWorkerId(&self, ) -> Option<DOMString>;
301 fn IsTrusted(&self, ) -> bool;
302}
303static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
304
305pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
306 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
307 JSPropertySpec {
308 name: JSPropertySpec_Name { string_: c"global".as_ptr() },
309 attributes_: (JSPROP_ENUMERATE),
310 kind_: (JSPropertySpec_Kind::NativeAccessor),
311 u: JSPropertySpec_AccessorsOrValue {
312 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
313 getter: JSPropertySpec_Accessor {
314 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { global_getterinfo.get() } },
315 },
316 setter: JSPropertySpec_Accessor {
317 native: JSNativeWrapper { op: None, info: ptr::null() },
318 }
319 }
320 }
321 }
322,
323 JSPropertySpec {
324 name: JSPropertySpec_Name { string_: c"pipelineId".as_ptr() },
325 attributes_: (JSPROP_ENUMERATE),
326 kind_: (JSPropertySpec_Kind::NativeAccessor),
327 u: JSPropertySpec_AccessorsOrValue {
328 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
329 getter: JSPropertySpec_Accessor {
330 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { pipelineId_getterinfo.get() } },
331 },
332 setter: JSPropertySpec_Accessor {
333 native: JSNativeWrapper { op: None, info: ptr::null() },
334 }
335 }
336 }
337 }
338,
339 JSPropertySpec {
340 name: JSPropertySpec_Name { string_: c"workerId".as_ptr() },
341 attributes_: (JSPROP_ENUMERATE),
342 kind_: (JSPropertySpec_Kind::NativeAccessor),
343 u: JSPropertySpec_AccessorsOrValue {
344 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
345 getter: JSPropertySpec_Accessor {
346 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { workerId_getterinfo.get() } },
347 },
348 setter: JSPropertySpec_Accessor {
349 native: JSNativeWrapper { op: None, info: ptr::null() },
350 }
351 }
352 }
353 }
354,
355 JSPropertySpec::ZERO]))[..]
356,
357&Box::leak(Box::new([
358 JSPropertySpec {
359 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
360 attributes_: (JSPROP_READONLY),
361 kind_: (JSPropertySpec_Kind::Value),
362 u: JSPropertySpec_AccessorsOrValue {
363 value: JSPropertySpec_ValueWrapper {
364 type_: JSPropertySpec_ValueWrapper_Type::String,
365 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
366 string: c"DebuggerAddDebuggeeEvent".as_ptr(),
367 }
368 }
369 }
370 }
371,
372 JSPropertySpec::ZERO]))[..]
373])));
374}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
375
376pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
377 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::DEBUGGER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
378 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
379}static sLegacyUnforgeableAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
380
381pub(crate) fn init_sLegacyUnforgeableAttributes_specs<D: DomTypes>() {
382 sLegacyUnforgeableAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
383 JSPropertySpec {
384 name: JSPropertySpec_Name { string_: c"isTrusted".as_ptr() },
385 attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
386 kind_: (JSPropertySpec_Kind::NativeAccessor),
387 u: JSPropertySpec_AccessorsOrValue {
388 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
389 getter: JSPropertySpec_Accessor {
390 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { isTrusted_getterinfo.get() } },
391 },
392 setter: JSPropertySpec_Accessor {
393 native: JSNativeWrapper { op: None, info: ptr::null() },
394 }
395 }
396 }
397 }
398,
399 JSPropertySpec::ZERO]))[..]
400])));
401}static sLegacyUnforgeableAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
402
403pub(crate) fn init_sLegacyUnforgeableAttributes_prefs<D: DomTypes>() {
404 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])])));
405}
406pub fn GetProtoObject<D: DomTypes>
407(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
408 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::DebuggerAddDebuggeeEvent), CreateInterfaceObjects::<D>, rval)
410}
411
412
413static PrototypeClass: JSClass = JSClass {
414 name: c"DebuggerAddDebuggeeEventPrototype".as_ptr(),
415 flags:
416 (1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
418 cOps: ptr::null(),
419 spec: ptr::null(),
420 ext: ptr::null(),
421 oOps: ptr::null(),
422};
423
424
425static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
426
427pub(crate) fn init_interface_object<D: DomTypes>() {
428 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
429 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
430 b"function DebuggerAddDebuggeeEvent() {\n [native code]\n}",
431 PrototypeList::ID::DebuggerAddDebuggeeEvent,
432 1,
433 ));
434}
435
436pub fn DefineDOMInterface<D: DomTypes>
437(cx: SafeJSContext, global: HandleObject){
438 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::DebuggerAddDebuggeeEvent),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
439}
440
441pub fn ConstructorEnabled<D: DomTypes>
442(aCx: SafeJSContext, aObj: HandleObject) -> bool{
443 is_exposed_in(aObj, Globals::DEBUGGER_GLOBAL_SCOPE)
444}
445
446unsafe fn CreateInterfaceObjects<D: DomTypes>
447(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
448
449 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
450 Event_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
451 assert!(!prototype_proto.is_null());
452
453 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
454 create_interface_prototype_object::<D>(cx,
455 global,
456 prototype_proto.handle(),
457 &PrototypeClass,
458 &[],
459 sAttributes.get(),
460 &[],
461 &[],
462 prototype.handle_mut());
463 assert!(!prototype.is_null());
464 assert!((*cache)[PrototypeList::ID::DebuggerAddDebuggeeEvent as usize].is_null());
465 (*cache)[PrototypeList::ID::DebuggerAddDebuggeeEvent as usize] = prototype.get();
466 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::DebuggerAddDebuggeeEvent as isize),
467 ptr::null_mut(),
468 prototype.get());
469
470 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
471
472 Event_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
473
474 assert!(!interface_proto.is_null());
475
476 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
477 create_noncallback_interface_object::<D>(cx,
478 global,
479 interface_proto.handle(),
480 INTERFACE_OBJECT_CLASS.get(),
481 &[],
482 &[],
483 &[],
484 prototype.handle(),
485 c"DebuggerAddDebuggeeEvent",
486 0,
487 &[],
488 interface.handle_mut());
489 assert!(!interface.is_null());
490
491 rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
492 unforgeable_holder.handle_mut().set(
493 JS_NewObjectWithoutMetadata(cx.raw_cx(), &Class.get().base as *const JSClass, prototype.handle()));
494 assert!(!unforgeable_holder.is_null());
495
496 define_guarded_properties::<D>(cx, unforgeable_holder.handle(), unsafe { sLegacyUnforgeableAttributes.get() }, global);
497 let val = ObjectValue(unforgeable_holder.get());
498 JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
499}
500
501
502 pub(crate) fn init_statics<D: DomTypes>() {
503 init_interface_object::<D>();
504 init_domjs_class::<D>();
505
506 init_global_getterinfo::<D>();
507init_pipelineId_getterinfo::<D>();
508init_workerId_getterinfo::<D>();
509init_isTrusted_getterinfo::<D>();
510
511
512 init_sAttributes_specs::<D>();
513init_sAttributes_prefs::<D>();
514init_sLegacyUnforgeableAttributes_specs::<D>();
515init_sLegacyUnforgeableAttributes_prefs::<D>();
516 }
517 } pub use self::PipelineId_Binding::{Wrap as PipelineIdWrap, PipelineIdMethods, GetProtoObject as PipelineIdGetProtoObject, DefineDOMInterface as PipelineIdDefineDOMInterface};
521pub mod PipelineId_Binding {
522use crate::import::module::*;
523
524unsafe extern "C" fn get_namespaceId<D: DomTypes>
525(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
526 let mut result = false;
527 wrap_panic(&mut || result = (|| {
528 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
529 let this = &*(this as *const D::PipelineId);
530 let result: u32 = this.NamespaceId();
531
532 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
533 return true;
534 })());
535 result
536}
537
538
539static namespaceId_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
540
541pub(crate) fn init_namespaceId_getterinfo<D: DomTypes>() {
542 namespaceId_getterinfo.set(JSJitInfo {
543 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
544 getter: Some(get_namespaceId::<D>)
545 },
546 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
547 protoID: PrototypeList::ID::PipelineId as u16,
548 },
549 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
550 _bitfield_align_1: [],
551 _bitfield_1: __BindgenBitfieldUnit::new(
552 new_jsjitinfo_bitfield_1!(
553 JSJitInfo_OpType::Getter as u8,
554 JSJitInfo_AliasSet::AliasEverything as u8,
555 JSValueType::JSVAL_TYPE_DOUBLE as u8,
556 true,
557 false,
558 false,
559 false,
560 false,
561 false,
562 0,
563 ).to_ne_bytes()
564 ),
565});
566}
567unsafe extern "C" fn get_index<D: DomTypes>
568(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
569 let mut result = false;
570 wrap_panic(&mut || result = (|| {
571 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
572 let this = &*(this as *const D::PipelineId);
573 let result: u32 = this.Index();
574
575 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
576 return true;
577 })());
578 result
579}
580
581
582static index_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
583
584pub(crate) fn init_index_getterinfo<D: DomTypes>() {
585 index_getterinfo.set(JSJitInfo {
586 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
587 getter: Some(get_index::<D>)
588 },
589 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
590 protoID: PrototypeList::ID::PipelineId as u16,
591 },
592 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
593 _bitfield_align_1: [],
594 _bitfield_1: __BindgenBitfieldUnit::new(
595 new_jsjitinfo_bitfield_1!(
596 JSJitInfo_OpType::Getter as u8,
597 JSJitInfo_AliasSet::AliasEverything as u8,
598 JSValueType::JSVAL_TYPE_DOUBLE as u8,
599 true,
600 false,
601 false,
602 false,
603 false,
604 false,
605 0,
606 ).to_ne_bytes()
607 ),
608});
609}
610unsafe extern "C" fn _finalize<D: DomTypes>
611(_cx: *mut GCContext, obj: *mut JSObject){
612 wrap_panic(&mut || {
613
614 let this = native_from_object_static::<D::PipelineId>(obj).unwrap();
615 finalize_common(this);
616 })
617}
618
619unsafe extern "C" fn _trace<D: DomTypes>
620(trc: *mut JSTracer, obj: *mut JSObject){
621 wrap_panic(&mut || {
622
623 let this = native_from_object_static::<D::PipelineId>(obj).unwrap();
624 if this.is_null() { return; } (*this).trace(trc);
626 })
627}
628
629
630static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
631
632pub(crate) fn init_class_ops<D: DomTypes>() {
633 CLASS_OPS.set(JSClassOps {
634 addProperty: None,
635 delProperty: None,
636 enumerate: None,
637 newEnumerate: None,
638 resolve: None,
639 mayResolve: None,
640 finalize: Some(_finalize::<D>),
641 call: None,
642 construct: None,
643 trace: Some(_trace::<D>),
644 });
645}
646
647pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
648
649pub(crate) fn init_domjs_class<D: DomTypes>() {
650 init_class_ops::<D>();
651 Class.set(DOMJSClass {
652 base: JSClass {
653 name: c"PipelineId".as_ptr(),
654 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
655 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
656 ,
657 cOps: unsafe { CLASS_OPS.get() },
658 spec: ptr::null(),
659 ext: ptr::null(),
660 oOps: ptr::null(),
661 },
662 dom_class:
663DOMClass {
664 interface_chain: [ PrototypeList::ID::PipelineId, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
665 depth: 0,
666 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
667 malloc_size_of: malloc_size_of_including_raw_self::<D::PipelineId> as unsafe fn(&mut _, _) -> _,
668 global: Globals::EMPTY,
669},
670 });
671}
672
673#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
674(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::PipelineId>, _can_gc: CanGc) -> DomRoot<D::PipelineId>{
675
676 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
677
678 let scope = scope.reflector().get_jsobject();
679 assert!(!scope.get().is_null());
680 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
681 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
682
683 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
684 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
685 assert!(!canonical_proto.is_null());
686
687
688 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
689 if let Some(given) = given_proto {
690 proto.set(*given);
691 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
692 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
693 }
694 } else {
695 proto.set(*canonical_proto);
696 }
697 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
698 cx.raw_cx(),
699 &Class.get().base,
700 proto.handle(),
701 ));
702 assert!(!obj.is_null());
703 JS_SetReservedSlot(
704 obj.get(),
705 DOM_OBJECT_SLOT,
706 &PrivateValue(raw.as_ptr() as *const libc::c_void),
707 );
708
709 let root = raw.reflect_with(obj.get());
710
711
712
713 DomRoot::from_ref(&*root)
714}
715
716pub trait PipelineIdMethods<D: DomTypes> {
717 fn NamespaceId(&self, ) -> u32;
718 fn Index(&self, ) -> u32;
719}
720static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
721
722pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
723 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
724 JSPropertySpec {
725 name: JSPropertySpec_Name { string_: c"namespaceId".as_ptr() },
726 attributes_: (JSPROP_ENUMERATE),
727 kind_: (JSPropertySpec_Kind::NativeAccessor),
728 u: JSPropertySpec_AccessorsOrValue {
729 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
730 getter: JSPropertySpec_Accessor {
731 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { namespaceId_getterinfo.get() } },
732 },
733 setter: JSPropertySpec_Accessor {
734 native: JSNativeWrapper { op: None, info: ptr::null() },
735 }
736 }
737 }
738 }
739,
740 JSPropertySpec {
741 name: JSPropertySpec_Name { string_: c"index".as_ptr() },
742 attributes_: (JSPROP_ENUMERATE),
743 kind_: (JSPropertySpec_Kind::NativeAccessor),
744 u: JSPropertySpec_AccessorsOrValue {
745 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
746 getter: JSPropertySpec_Accessor {
747 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { index_getterinfo.get() } },
748 },
749 setter: JSPropertySpec_Accessor {
750 native: JSNativeWrapper { op: None, info: ptr::null() },
751 }
752 }
753 }
754 }
755,
756 JSPropertySpec::ZERO]))[..]
757,
758&Box::leak(Box::new([
759 JSPropertySpec {
760 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
761 attributes_: (JSPROP_READONLY),
762 kind_: (JSPropertySpec_Kind::Value),
763 u: JSPropertySpec_AccessorsOrValue {
764 value: JSPropertySpec_ValueWrapper {
765 type_: JSPropertySpec_ValueWrapper_Type::String,
766 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
767 string: c"PipelineId".as_ptr(),
768 }
769 }
770 }
771 }
772,
773 JSPropertySpec::ZERO]))[..]
774])));
775}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
776
777pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
778 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::DEBUGGER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
779 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
780}
781pub fn GetProtoObject<D: DomTypes>
782(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
783 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::PipelineId), CreateInterfaceObjects::<D>, rval)
785}
786
787
788static PrototypeClass: JSClass = JSClass {
789 name: c"PipelineIdPrototype".as_ptr(),
790 flags:
791 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
793 cOps: ptr::null(),
794 spec: ptr::null(),
795 ext: ptr::null(),
796 oOps: ptr::null(),
797};
798
799
800static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
801
802pub(crate) fn init_interface_object<D: DomTypes>() {
803 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
804 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
805 b"function PipelineId() {\n [native code]\n}",
806 PrototypeList::ID::PipelineId,
807 0,
808 ));
809}
810
811pub fn DefineDOMInterface<D: DomTypes>
812(cx: SafeJSContext, global: HandleObject){
813 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::PipelineId),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
814}
815
816pub fn ConstructorEnabled<D: DomTypes>
817(aCx: SafeJSContext, aObj: HandleObject) -> bool{
818 is_exposed_in(aObj, Globals::DEBUGGER_GLOBAL_SCOPE)
819}
820
821unsafe fn CreateInterfaceObjects<D: DomTypes>
822(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
823
824 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
825 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
826 assert!(!prototype_proto.is_null());
827
828 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
829 create_interface_prototype_object::<D>(cx,
830 global,
831 prototype_proto.handle(),
832 &PrototypeClass,
833 &[],
834 sAttributes.get(),
835 &[],
836 &[],
837 prototype.handle_mut());
838 assert!(!prototype.is_null());
839 assert!((*cache)[PrototypeList::ID::PipelineId as usize].is_null());
840 (*cache)[PrototypeList::ID::PipelineId as usize] = prototype.get();
841 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::PipelineId as isize),
842 ptr::null_mut(),
843 prototype.get());
844
845 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
846 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
847
848 assert!(!interface_proto.is_null());
849
850 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
851 create_noncallback_interface_object::<D>(cx,
852 global,
853 interface_proto.handle(),
854 INTERFACE_OBJECT_CLASS.get(),
855 &[],
856 &[],
857 &[],
858 prototype.handle(),
859 c"PipelineId",
860 0,
861 &[],
862 interface.handle_mut());
863 assert!(!interface.is_null());
864}
865
866
867 pub(crate) fn init_statics<D: DomTypes>() {
868 init_interface_object::<D>();
869 init_domjs_class::<D>();
870
871 init_namespaceId_getterinfo::<D>();
872init_index_getterinfo::<D>();
873
874
875 init_sAttributes_specs::<D>();
876init_sAttributes_prefs::<D>();
877 }
878 }