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::import::base::*;
6
7pub use self::GeolocationCoordinates_Binding::{Wrap, GeolocationCoordinatesMethods, GetProtoObject, DefineDOMInterface};
8pub mod GeolocationCoordinates_Binding {
9use crate::import::module::*;
10
11unsafe extern "C" fn get_accuracy<D: DomTypes>
12(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
13 let mut result = false;
14 wrap_panic(&mut || result = (|| {
15 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16 let this = &*(this as *const D::GeolocationCoordinates);
17 let result: Finite<f64> = this.Accuracy();
18
19 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20 return true;
21 })());
22 result
23}
24
25
26static accuracy_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
27
28pub(crate) fn init_accuracy_getterinfo<D: DomTypes>() {
29 accuracy_getterinfo.set(JSJitInfo {
30 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
31 getter: Some(get_accuracy::<D>)
32 },
33 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
34 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
35 },
36 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
37 _bitfield_align_1: [],
38 _bitfield_1: __BindgenBitfieldUnit::new(
39 new_jsjitinfo_bitfield_1!(
40 JSJitInfo_OpType::Getter as u8,
41 JSJitInfo_AliasSet::AliasEverything as u8,
42 JSValueType::JSVAL_TYPE_DOUBLE as u8,
43 true,
44 false,
45 false,
46 false,
47 false,
48 false,
49 0,
50 ).to_ne_bytes()
51 ),
52});
53}
54unsafe extern "C" fn get_latitude<D: DomTypes>
55(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
56 let mut result = false;
57 wrap_panic(&mut || result = (|| {
58 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
59 let this = &*(this as *const D::GeolocationCoordinates);
60 let result: Finite<f64> = this.Latitude();
61
62 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
63 return true;
64 })());
65 result
66}
67
68
69static latitude_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
70
71pub(crate) fn init_latitude_getterinfo<D: DomTypes>() {
72 latitude_getterinfo.set(JSJitInfo {
73 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
74 getter: Some(get_latitude::<D>)
75 },
76 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
77 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
78 },
79 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
80 _bitfield_align_1: [],
81 _bitfield_1: __BindgenBitfieldUnit::new(
82 new_jsjitinfo_bitfield_1!(
83 JSJitInfo_OpType::Getter as u8,
84 JSJitInfo_AliasSet::AliasEverything as u8,
85 JSValueType::JSVAL_TYPE_DOUBLE as u8,
86 true,
87 false,
88 false,
89 false,
90 false,
91 false,
92 0,
93 ).to_ne_bytes()
94 ),
95});
96}
97unsafe extern "C" fn get_longitude<D: DomTypes>
98(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
99 let mut result = false;
100 wrap_panic(&mut || result = (|| {
101 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
102 let this = &*(this as *const D::GeolocationCoordinates);
103 let result: Finite<f64> = this.Longitude();
104
105 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
106 return true;
107 })());
108 result
109}
110
111
112static longitude_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
113
114pub(crate) fn init_longitude_getterinfo<D: DomTypes>() {
115 longitude_getterinfo.set(JSJitInfo {
116 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
117 getter: Some(get_longitude::<D>)
118 },
119 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
120 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
121 },
122 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
123 _bitfield_align_1: [],
124 _bitfield_1: __BindgenBitfieldUnit::new(
125 new_jsjitinfo_bitfield_1!(
126 JSJitInfo_OpType::Getter as u8,
127 JSJitInfo_AliasSet::AliasEverything as u8,
128 JSValueType::JSVAL_TYPE_DOUBLE as u8,
129 true,
130 false,
131 false,
132 false,
133 false,
134 false,
135 0,
136 ).to_ne_bytes()
137 ),
138});
139}
140unsafe extern "C" fn get_altitude<D: DomTypes>
141(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
142 let mut result = false;
143 wrap_panic(&mut || result = (|| {
144 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
145 let this = &*(this as *const D::GeolocationCoordinates);
146 let result: Option<Finite<f64>> = this.GetAltitude();
147
148 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
149 return true;
150 })());
151 result
152}
153
154
155static altitude_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
156
157pub(crate) fn init_altitude_getterinfo<D: DomTypes>() {
158 altitude_getterinfo.set(JSJitInfo {
159 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
160 getter: Some(get_altitude::<D>)
161 },
162 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
163 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
164 },
165 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
166 _bitfield_align_1: [],
167 _bitfield_1: __BindgenBitfieldUnit::new(
168 new_jsjitinfo_bitfield_1!(
169 JSJitInfo_OpType::Getter as u8,
170 JSJitInfo_AliasSet::AliasEverything as u8,
171 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
172 true,
173 false,
174 false,
175 false,
176 false,
177 false,
178 0,
179 ).to_ne_bytes()
180 ),
181});
182}
183unsafe extern "C" fn get_altitudeAccuracy<D: DomTypes>
184(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
185 let mut result = false;
186 wrap_panic(&mut || result = (|| {
187 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
188 let this = &*(this as *const D::GeolocationCoordinates);
189 let result: Option<Finite<f64>> = this.GetAltitudeAccuracy();
190
191 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
192 return true;
193 })());
194 result
195}
196
197
198static altitudeAccuracy_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
199
200pub(crate) fn init_altitudeAccuracy_getterinfo<D: DomTypes>() {
201 altitudeAccuracy_getterinfo.set(JSJitInfo {
202 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
203 getter: Some(get_altitudeAccuracy::<D>)
204 },
205 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
206 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
207 },
208 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
209 _bitfield_align_1: [],
210 _bitfield_1: __BindgenBitfieldUnit::new(
211 new_jsjitinfo_bitfield_1!(
212 JSJitInfo_OpType::Getter as u8,
213 JSJitInfo_AliasSet::AliasEverything as u8,
214 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
215 true,
216 false,
217 false,
218 false,
219 false,
220 false,
221 0,
222 ).to_ne_bytes()
223 ),
224});
225}
226unsafe extern "C" fn get_heading<D: DomTypes>
227(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
228 let mut result = false;
229 wrap_panic(&mut || result = (|| {
230 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
231 let this = &*(this as *const D::GeolocationCoordinates);
232 let result: Option<Finite<f64>> = this.GetHeading();
233
234 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
235 return true;
236 })());
237 result
238}
239
240
241static heading_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
242
243pub(crate) fn init_heading_getterinfo<D: DomTypes>() {
244 heading_getterinfo.set(JSJitInfo {
245 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
246 getter: Some(get_heading::<D>)
247 },
248 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
249 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
250 },
251 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
252 _bitfield_align_1: [],
253 _bitfield_1: __BindgenBitfieldUnit::new(
254 new_jsjitinfo_bitfield_1!(
255 JSJitInfo_OpType::Getter as u8,
256 JSJitInfo_AliasSet::AliasEverything as u8,
257 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
258 true,
259 false,
260 false,
261 false,
262 false,
263 false,
264 0,
265 ).to_ne_bytes()
266 ),
267});
268}
269unsafe extern "C" fn get_speed<D: DomTypes>
270(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
271 let mut result = false;
272 wrap_panic(&mut || result = (|| {
273 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
274 let this = &*(this as *const D::GeolocationCoordinates);
275 let result: Option<Finite<f64>> = this.GetSpeed();
276
277 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
278 return true;
279 })());
280 result
281}
282
283
284static speed_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
285
286pub(crate) fn init_speed_getterinfo<D: DomTypes>() {
287 speed_getterinfo.set(JSJitInfo {
288 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
289 getter: Some(get_speed::<D>)
290 },
291 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
292 protoID: PrototypeList::ID::GeolocationCoordinates as u16,
293 },
294 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
295 _bitfield_align_1: [],
296 _bitfield_1: __BindgenBitfieldUnit::new(
297 new_jsjitinfo_bitfield_1!(
298 JSJitInfo_OpType::Getter as u8,
299 JSJitInfo_AliasSet::AliasEverything as u8,
300 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
301 true,
302 false,
303 false,
304 false,
305 false,
306 false,
307 0,
308 ).to_ne_bytes()
309 ),
310});
311}
312unsafe extern "C" fn _finalize<D: DomTypes>
313(_cx: *mut GCContext, obj: *mut JSObject){
314 wrap_panic(&mut || {
315
316 let this = native_from_object_static::<D::GeolocationCoordinates>(obj).unwrap();
317 finalize_common(this);
318 })
319}
320
321unsafe extern "C" fn _trace<D: DomTypes>
322(trc: *mut JSTracer, obj: *mut JSObject){
323 wrap_panic(&mut || {
324
325 let this = native_from_object_static::<D::GeolocationCoordinates>(obj).unwrap();
326 if this.is_null() { return; } (*this).trace(trc);
328 })
329}
330
331
332static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
333
334pub(crate) fn init_class_ops<D: DomTypes>() {
335 CLASS_OPS.set(JSClassOps {
336 addProperty: None,
337 delProperty: None,
338 enumerate: None,
339 newEnumerate: None,
340 resolve: None,
341 mayResolve: None,
342 finalize: Some(_finalize::<D>),
343 call: None,
344 construct: None,
345 trace: Some(_trace::<D>),
346 });
347}
348
349pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
350
351pub(crate) fn init_domjs_class<D: DomTypes>() {
352 init_class_ops::<D>();
353 Class.set(DOMJSClass {
354 base: JSClass {
355 name: c"GeolocationCoordinates".as_ptr(),
356 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
357 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
358 ,
359 cOps: unsafe { CLASS_OPS.get() },
360 spec: ptr::null(),
361 ext: ptr::null(),
362 oOps: ptr::null(),
363 },
364 dom_class:
365DOMClass {
366 interface_chain: [ PrototypeList::ID::GeolocationCoordinates, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
367 depth: 0,
368 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
369 malloc_size_of: malloc_size_of_including_raw_self::<D::GeolocationCoordinates> as unsafe fn(&mut _, _) -> _,
370 global: Globals::EMPTY,
371},
372 });
373}
374
375#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
376(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GeolocationCoordinates>, _can_gc: CanGc) -> DomRoot<D::GeolocationCoordinates>{
377
378 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
379
380 let scope = scope.reflector().get_jsobject();
381 assert!(!scope.get().is_null());
382 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
383 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
384
385 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
386 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
387 assert!(!canonical_proto.is_null());
388
389
390 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
391 if let Some(given) = given_proto {
392 proto.set(*given);
393 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
394 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
395 }
396 } else {
397 proto.set(*canonical_proto);
398 }
399 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
400 cx.raw_cx(),
401 &Class.get().base,
402 proto.handle(),
403 ));
404 assert!(!obj.is_null());
405 JS_SetReservedSlot(
406 obj.get(),
407 DOM_OBJECT_SLOT,
408 &PrivateValue(raw.as_ptr() as *const libc::c_void),
409 );
410
411 let root = raw.reflect_with(obj.get());
412
413
414
415 DomRoot::from_ref(&*root)
416}
417
418pub trait GeolocationCoordinatesMethods<D: DomTypes> {
419 fn Accuracy(&self, ) -> Finite<f64>;
420 fn Latitude(&self, ) -> Finite<f64>;
421 fn Longitude(&self, ) -> Finite<f64>;
422 fn GetAltitude(&self, ) -> Option<Finite<f64>>;
423 fn GetAltitudeAccuracy(&self, ) -> Option<Finite<f64>>;
424 fn GetHeading(&self, ) -> Option<Finite<f64>>;
425 fn GetSpeed(&self, ) -> Option<Finite<f64>>;
426}
427static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
428
429pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
430 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
431 JSPropertySpec {
432 name: JSPropertySpec_Name { string_: c"accuracy".as_ptr() },
433 attributes_: (JSPROP_ENUMERATE),
434 kind_: (JSPropertySpec_Kind::NativeAccessor),
435 u: JSPropertySpec_AccessorsOrValue {
436 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
437 getter: JSPropertySpec_Accessor {
438 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { accuracy_getterinfo.get() } },
439 },
440 setter: JSPropertySpec_Accessor {
441 native: JSNativeWrapper { op: None, info: ptr::null() },
442 }
443 }
444 }
445 }
446,
447 JSPropertySpec {
448 name: JSPropertySpec_Name { string_: c"latitude".as_ptr() },
449 attributes_: (JSPROP_ENUMERATE),
450 kind_: (JSPropertySpec_Kind::NativeAccessor),
451 u: JSPropertySpec_AccessorsOrValue {
452 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
453 getter: JSPropertySpec_Accessor {
454 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { latitude_getterinfo.get() } },
455 },
456 setter: JSPropertySpec_Accessor {
457 native: JSNativeWrapper { op: None, info: ptr::null() },
458 }
459 }
460 }
461 }
462,
463 JSPropertySpec {
464 name: JSPropertySpec_Name { string_: c"longitude".as_ptr() },
465 attributes_: (JSPROP_ENUMERATE),
466 kind_: (JSPropertySpec_Kind::NativeAccessor),
467 u: JSPropertySpec_AccessorsOrValue {
468 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
469 getter: JSPropertySpec_Accessor {
470 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { longitude_getterinfo.get() } },
471 },
472 setter: JSPropertySpec_Accessor {
473 native: JSNativeWrapper { op: None, info: ptr::null() },
474 }
475 }
476 }
477 }
478,
479 JSPropertySpec {
480 name: JSPropertySpec_Name { string_: c"altitude".as_ptr() },
481 attributes_: (JSPROP_ENUMERATE),
482 kind_: (JSPropertySpec_Kind::NativeAccessor),
483 u: JSPropertySpec_AccessorsOrValue {
484 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
485 getter: JSPropertySpec_Accessor {
486 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { altitude_getterinfo.get() } },
487 },
488 setter: JSPropertySpec_Accessor {
489 native: JSNativeWrapper { op: None, info: ptr::null() },
490 }
491 }
492 }
493 }
494,
495 JSPropertySpec {
496 name: JSPropertySpec_Name { string_: c"altitudeAccuracy".as_ptr() },
497 attributes_: (JSPROP_ENUMERATE),
498 kind_: (JSPropertySpec_Kind::NativeAccessor),
499 u: JSPropertySpec_AccessorsOrValue {
500 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
501 getter: JSPropertySpec_Accessor {
502 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { altitudeAccuracy_getterinfo.get() } },
503 },
504 setter: JSPropertySpec_Accessor {
505 native: JSNativeWrapper { op: None, info: ptr::null() },
506 }
507 }
508 }
509 }
510,
511 JSPropertySpec {
512 name: JSPropertySpec_Name { string_: c"heading".as_ptr() },
513 attributes_: (JSPROP_ENUMERATE),
514 kind_: (JSPropertySpec_Kind::NativeAccessor),
515 u: JSPropertySpec_AccessorsOrValue {
516 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
517 getter: JSPropertySpec_Accessor {
518 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { heading_getterinfo.get() } },
519 },
520 setter: JSPropertySpec_Accessor {
521 native: JSNativeWrapper { op: None, info: ptr::null() },
522 }
523 }
524 }
525 }
526,
527 JSPropertySpec {
528 name: JSPropertySpec_Name { string_: c"speed".as_ptr() },
529 attributes_: (JSPROP_ENUMERATE),
530 kind_: (JSPropertySpec_Kind::NativeAccessor),
531 u: JSPropertySpec_AccessorsOrValue {
532 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
533 getter: JSPropertySpec_Accessor {
534 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { speed_getterinfo.get() } },
535 },
536 setter: JSPropertySpec_Accessor {
537 native: JSNativeWrapper { op: None, info: ptr::null() },
538 }
539 }
540 }
541 }
542,
543 JSPropertySpec::ZERO]))[..]
544,
545&Box::leak(Box::new([
546 JSPropertySpec {
547 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
548 attributes_: (JSPROP_READONLY),
549 kind_: (JSPropertySpec_Kind::Value),
550 u: JSPropertySpec_AccessorsOrValue {
551 value: JSPropertySpec_ValueWrapper {
552 type_: JSPropertySpec_ValueWrapper_Type::String,
553 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
554 string: c"GeolocationCoordinates".as_ptr(),
555 }
556 }
557 }
558 }
559,
560 JSPropertySpec::ZERO]))[..]
561])));
562}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
563
564pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
565 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::SecureContext(),Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
566 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
567}
568pub fn GetProtoObject<D: DomTypes>
569(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
570 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GeolocationCoordinates), CreateInterfaceObjects::<D>, rval)
572}
573
574
575static PrototypeClass: JSClass = JSClass {
576 name: c"GeolocationCoordinatesPrototype".as_ptr(),
577 flags:
578 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
580 cOps: ptr::null(),
581 spec: ptr::null(),
582 ext: ptr::null(),
583 oOps: ptr::null(),
584};
585
586
587static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
588
589pub(crate) fn init_interface_object<D: DomTypes>() {
590 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
591 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
592 b"function GeolocationCoordinates() {\n [native code]\n}",
593 PrototypeList::ID::GeolocationCoordinates,
594 0,
595 ));
596}
597
598pub fn DefineDOMInterface<D: DomTypes>
599(cx: SafeJSContext, global: HandleObject){
600 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GeolocationCoordinates),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
601}
602
603pub fn ConstructorEnabled<D: DomTypes>
604(aCx: SafeJSContext, aObj: HandleObject) -> bool{
605 is_exposed_in(aObj, Globals::WINDOW) &&
606 pref!(dom_geolocation_enabled) &&
607
608 unsafe {
609 let in_realm_proof = AlreadyInRealm::assert_for_cx(aCx);
610 D::GlobalScope::from_context(*aCx, InRealm::Already(&in_realm_proof)).is_secure_context()
611 }
612
613}
614
615unsafe fn CreateInterfaceObjects<D: DomTypes>
616(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
617
618 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
619 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
620 assert!(!prototype_proto.is_null());
621
622 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
623 create_interface_prototype_object::<D>(cx,
624 global,
625 prototype_proto.handle(),
626 &PrototypeClass,
627 &[],
628 sAttributes.get(),
629 &[],
630 &[],
631 prototype.handle_mut());
632 assert!(!prototype.is_null());
633 assert!((*cache)[PrototypeList::ID::GeolocationCoordinates as usize].is_null());
634 (*cache)[PrototypeList::ID::GeolocationCoordinates as usize] = prototype.get();
635 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GeolocationCoordinates as isize),
636 ptr::null_mut(),
637 prototype.get());
638
639 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
640 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
641
642 assert!(!interface_proto.is_null());
643
644 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
645 create_noncallback_interface_object::<D>(cx,
646 global,
647 interface_proto.handle(),
648 INTERFACE_OBJECT_CLASS.get(),
649 &[],
650 &[],
651 &[],
652 prototype.handle(),
653 c"GeolocationCoordinates",
654 0,
655 &[],
656 interface.handle_mut());
657 assert!(!interface.is_null());
658}
659
660
661 pub(crate) fn init_statics<D: DomTypes>() {
662 init_interface_object::<D>();
663 init_domjs_class::<D>();
664
665 init_accuracy_getterinfo::<D>();
666init_latitude_getterinfo::<D>();
667init_longitude_getterinfo::<D>();
668init_altitude_getterinfo::<D>();
669init_altitudeAccuracy_getterinfo::<D>();
670init_heading_getterinfo::<D>();
671init_speed_getterinfo::<D>();
672
673
674 init_sAttributes_specs::<D>();
675init_sAttributes_prefs::<D>();
676 }
677 }