script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
XRFrameBinding.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::EventTargetBinding::EventTarget_Binding;
6use crate::codegen::GenericBindings::XRPoseBinding::XRPose_Binding;
7use crate::codegen::GenericBindings::XRSpaceBinding::XRSpace_Binding;
8use crate::import::base::*;
9
10pub use self::XRFrame_Binding::{Wrap, XRFrameMethods, GetProtoObject, DefineDOMInterface};
11pub mod XRFrame_Binding {
12use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
13use crate::codegen::GenericBindings::XRPoseBinding::XRPose_Binding;
14use crate::codegen::GenericBindings::XRSpaceBinding::XRSpace_Binding;
15use crate::import::module::*;
16
17unsafe extern "C" fn get_session<D: DomTypes>
18(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
19    let mut result = false;
20    wrap_panic(&mut || result = (|| {
21        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22        let this = &*(this as *const D::XRFrame);
23        let result: DomRoot<D::XRSession> = this.Session();
24
25        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26        return true;
27    })());
28    result
29}
30
31
32static session_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
33
34pub(crate) fn init_session_getterinfo<D: DomTypes>() {
35    session_getterinfo.set(JSJitInfo {
36    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
37        getter: Some(get_session::<D>)
38    },
39    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
40        protoID: PrototypeList::ID::XRFrame as u16,
41    },
42    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
43    _bitfield_align_1: [],
44    _bitfield_1: __BindgenBitfieldUnit::new(
45        new_jsjitinfo_bitfield_1!(
46            JSJitInfo_OpType::Getter as u8,
47            JSJitInfo_AliasSet::AliasNone as u8,
48            JSValueType::JSVAL_TYPE_OBJECT as u8,
49            true,
50            true,
51            false,
52            false,
53            false,
54            false,
55            0,
56        ).to_ne_bytes()
57    ),
58});
59}
60unsafe extern "C" fn get_predictedDisplayTime<D: DomTypes>
61(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
62    let mut result = false;
63    wrap_panic(&mut || result = (|| {
64        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
65        let this = &*(this as *const D::XRFrame);
66        let result: Finite<f64> = this.PredictedDisplayTime();
67
68        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
69        return true;
70    })());
71    result
72}
73
74
75static predictedDisplayTime_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
76
77pub(crate) fn init_predictedDisplayTime_getterinfo<D: DomTypes>() {
78    predictedDisplayTime_getterinfo.set(JSJitInfo {
79    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
80        getter: Some(get_predictedDisplayTime::<D>)
81    },
82    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
83        protoID: PrototypeList::ID::XRFrame as u16,
84    },
85    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
86    _bitfield_align_1: [],
87    _bitfield_1: __BindgenBitfieldUnit::new(
88        new_jsjitinfo_bitfield_1!(
89            JSJitInfo_OpType::Getter as u8,
90            JSJitInfo_AliasSet::AliasEverything as u8,
91            JSValueType::JSVAL_TYPE_DOUBLE as u8,
92            true,
93            false,
94            false,
95            false,
96            false,
97            false,
98            0,
99        ).to_ne_bytes()
100    ),
101});
102}
103unsafe extern "C" fn getViewerPose<D: DomTypes>
104(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
105    let mut result = false;
106    wrap_panic(&mut || result = (|| {
107        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
108        let this = &*(this as *const D::XRFrame);
109        let args = &*args;
110        let argc = args.argc_;
111
112        if argc < 1 {
113            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.getViewerPose\".");
114            return false;
115        }
116        let arg0: DomRoot<D::XRReferenceSpace> = if HandleValue::from_raw(args.get(0)).get().is_object() {
117            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
118                Ok(val) => val,
119                Err(()) => {
120                    throw_type_error(cx.raw_cx(), "value does not implement interface XRReferenceSpace.");
121                    return false;
122
123                }
124            }
125
126        } else {
127            throw_type_error(cx.raw_cx(), "Value is not an object.");
128            return false;
129
130        };
131        let result: Result<Option<DomRoot<D::XRViewerPose>>, Error> = this.GetViewerPose(&arg0, CanGc::note());
132        let result = match result {
133            Ok(result) => result,
134            Err(e) => {
135                <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());
136                return false;
137            },
138        };
139
140        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
141        return true;
142    })());
143    result
144}
145
146
147static getViewerPose_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
148
149pub(crate) fn init_getViewerPose_methodinfo<D: DomTypes>() {
150    getViewerPose_methodinfo.set(JSJitInfo {
151    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
152        method: Some(getViewerPose::<D>)
153    },
154    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
155        protoID: PrototypeList::ID::XRFrame as u16,
156    },
157    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
158    _bitfield_align_1: [],
159    _bitfield_1: __BindgenBitfieldUnit::new(
160        new_jsjitinfo_bitfield_1!(
161            JSJitInfo_OpType::Method as u8,
162            JSJitInfo_AliasSet::AliasEverything as u8,
163            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
164            false,
165            false,
166            false,
167            false,
168            false,
169            false,
170            0,
171        ).to_ne_bytes()
172    ),
173});
174}
175unsafe extern "C" fn getPose<D: DomTypes>
176(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
177    let mut result = false;
178    wrap_panic(&mut || result = (|| {
179        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
180        let this = &*(this as *const D::XRFrame);
181        let args = &*args;
182        let argc = args.argc_;
183
184        if argc < 2 {
185            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.getPose\".");
186            return false;
187        }
188        let arg0: DomRoot<D::XRSpace> = if HandleValue::from_raw(args.get(0)).get().is_object() {
189            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
190                Ok(val) => val,
191                Err(()) => {
192                    throw_type_error(cx.raw_cx(), "value does not implement interface XRSpace.");
193                    return false;
194
195                }
196            }
197
198        } else {
199            throw_type_error(cx.raw_cx(), "Value is not an object.");
200            return false;
201
202        };
203        let arg1: DomRoot<D::XRSpace> = if HandleValue::from_raw(args.get(1)).get().is_object() {
204            match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
205                Ok(val) => val,
206                Err(()) => {
207                    throw_type_error(cx.raw_cx(), "value does not implement interface XRSpace.");
208                    return false;
209
210                }
211            }
212
213        } else {
214            throw_type_error(cx.raw_cx(), "Value is not an object.");
215            return false;
216
217        };
218        let result: Result<Option<DomRoot<D::XRPose>>, Error> = this.GetPose(&arg0, &arg1, CanGc::note());
219        let result = match result {
220            Ok(result) => result,
221            Err(e) => {
222                <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());
223                return false;
224            },
225        };
226
227        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
228        return true;
229    })());
230    result
231}
232
233
234static getPose_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
235
236pub(crate) fn init_getPose_methodinfo<D: DomTypes>() {
237    getPose_methodinfo.set(JSJitInfo {
238    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
239        method: Some(getPose::<D>)
240    },
241    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
242        protoID: PrototypeList::ID::XRFrame as u16,
243    },
244    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
245    _bitfield_align_1: [],
246    _bitfield_1: __BindgenBitfieldUnit::new(
247        new_jsjitinfo_bitfield_1!(
248            JSJitInfo_OpType::Method as u8,
249            JSJitInfo_AliasSet::AliasEverything as u8,
250            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
251            false,
252            false,
253            false,
254            false,
255            false,
256            false,
257            0,
258        ).to_ne_bytes()
259    ),
260});
261}
262unsafe extern "C" fn getJointPose<D: DomTypes>
263(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
264    let mut result = false;
265    wrap_panic(&mut || result = (|| {
266        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
267        let this = &*(this as *const D::XRFrame);
268        let args = &*args;
269        let argc = args.argc_;
270
271        if argc < 2 {
272            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.getJointPose\".");
273            return false;
274        }
275        let arg0: DomRoot<D::XRJointSpace> = if HandleValue::from_raw(args.get(0)).get().is_object() {
276            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
277                Ok(val) => val,
278                Err(()) => {
279                    throw_type_error(cx.raw_cx(), "value does not implement interface XRJointSpace.");
280                    return false;
281
282                }
283            }
284
285        } else {
286            throw_type_error(cx.raw_cx(), "Value is not an object.");
287            return false;
288
289        };
290        let arg1: DomRoot<D::XRSpace> = if HandleValue::from_raw(args.get(1)).get().is_object() {
291            match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
292                Ok(val) => val,
293                Err(()) => {
294                    throw_type_error(cx.raw_cx(), "value does not implement interface XRSpace.");
295                    return false;
296
297                }
298            }
299
300        } else {
301            throw_type_error(cx.raw_cx(), "Value is not an object.");
302            return false;
303
304        };
305        let result: Result<Option<DomRoot<D::XRJointPose>>, Error> = this.GetJointPose(&arg0, &arg1, CanGc::note());
306        let result = match result {
307            Ok(result) => result,
308            Err(e) => {
309                <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());
310                return false;
311            },
312        };
313
314        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
315        return true;
316    })());
317    result
318}
319
320
321static getJointPose_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
322
323pub(crate) fn init_getJointPose_methodinfo<D: DomTypes>() {
324    getJointPose_methodinfo.set(JSJitInfo {
325    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
326        method: Some(getJointPose::<D>)
327    },
328    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
329        protoID: PrototypeList::ID::XRFrame as u16,
330    },
331    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
332    _bitfield_align_1: [],
333    _bitfield_1: __BindgenBitfieldUnit::new(
334        new_jsjitinfo_bitfield_1!(
335            JSJitInfo_OpType::Method as u8,
336            JSJitInfo_AliasSet::AliasEverything as u8,
337            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
338            false,
339            false,
340            false,
341            false,
342            false,
343            false,
344            0,
345        ).to_ne_bytes()
346    ),
347});
348}
349unsafe extern "C" fn fillJointRadii<D: DomTypes>
350(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
351    let mut result = false;
352    wrap_panic(&mut || result = (|| {
353        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
354        let this = &*(this as *const D::XRFrame);
355        let args = &*args;
356        let argc = args.argc_;
357
358        if argc < 2 {
359            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.fillJointRadii\".");
360            return false;
361        }
362        let arg0: Vec<DomRoot<D::XRJointSpace>> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
363            Ok(ConversionResult::Success(value)) => value,
364            Ok(ConversionResult::Failure(error)) => {
365                throw_type_error(cx.raw_cx(), &error);
366        return false;
367
368            }
369            _ => {
370                return false;
371
372            },
373        }
374        ;
375        let arg1: typedarray::Float32Array = if HandleValue::from_raw(args.get(1)).get().is_object() {
376            match typedarray::Float32Array::from(HandleValue::from_raw(args.get(1)).get().to_object()) {
377                Ok(val) => val,
378                Err(()) => {
379                    throw_type_error(cx.raw_cx(), "value is not a typed array.");
380                    return false;
381
382                }
383            }
384
385        } else {
386            throw_type_error(cx.raw_cx(), "Value is not an object.");
387            return false;
388
389        };
390        auto_root!(&in(cx) let arg1 = arg1);
391        let result: Result<bool, Error> = this.FillJointRadii(arg0, arg1);
392        let result = match result {
393            Ok(result) => result,
394            Err(e) => {
395                <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());
396                return false;
397            },
398        };
399
400        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
401        return true;
402    })());
403    result
404}
405
406
407static fillJointRadii_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
408
409pub(crate) fn init_fillJointRadii_methodinfo<D: DomTypes>() {
410    fillJointRadii_methodinfo.set(JSJitInfo {
411    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
412        method: Some(fillJointRadii::<D>)
413    },
414    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
415        protoID: PrototypeList::ID::XRFrame as u16,
416    },
417    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
418    _bitfield_align_1: [],
419    _bitfield_1: __BindgenBitfieldUnit::new(
420        new_jsjitinfo_bitfield_1!(
421            JSJitInfo_OpType::Method as u8,
422            JSJitInfo_AliasSet::AliasEverything as u8,
423            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
424            false,
425            false,
426            false,
427            false,
428            false,
429            false,
430            0,
431        ).to_ne_bytes()
432    ),
433});
434}
435unsafe extern "C" fn fillPoses<D: DomTypes>
436(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
437    let mut result = false;
438    wrap_panic(&mut || result = (|| {
439        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
440        let this = &*(this as *const D::XRFrame);
441        let args = &*args;
442        let argc = args.argc_;
443
444        if argc < 3 {
445            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.fillPoses\".");
446            return false;
447        }
448        let arg0: Vec<DomRoot<D::XRSpace>> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
449            Ok(ConversionResult::Success(value)) => value,
450            Ok(ConversionResult::Failure(error)) => {
451                throw_type_error(cx.raw_cx(), &error);
452        return false;
453
454            }
455            _ => {
456                return false;
457
458            },
459        }
460        ;
461        let arg1: DomRoot<D::XRSpace> = if HandleValue::from_raw(args.get(1)).get().is_object() {
462            match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
463                Ok(val) => val,
464                Err(()) => {
465                    throw_type_error(cx.raw_cx(), "value does not implement interface XRSpace.");
466                    return false;
467
468                }
469            }
470
471        } else {
472            throw_type_error(cx.raw_cx(), "Value is not an object.");
473            return false;
474
475        };
476        let arg2: typedarray::Float32Array = if HandleValue::from_raw(args.get(2)).get().is_object() {
477            match typedarray::Float32Array::from(HandleValue::from_raw(args.get(2)).get().to_object()) {
478                Ok(val) => val,
479                Err(()) => {
480                    throw_type_error(cx.raw_cx(), "value is not a typed array.");
481                    return false;
482
483                }
484            }
485
486        } else {
487            throw_type_error(cx.raw_cx(), "Value is not an object.");
488            return false;
489
490        };
491        auto_root!(&in(cx) let arg2 = arg2);
492        let result: Result<bool, Error> = this.FillPoses(arg0, &arg1, arg2);
493        let result = match result {
494            Ok(result) => result,
495            Err(e) => {
496                <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());
497                return false;
498            },
499        };
500
501        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
502        return true;
503    })());
504    result
505}
506
507
508static fillPoses_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
509
510pub(crate) fn init_fillPoses_methodinfo<D: DomTypes>() {
511    fillPoses_methodinfo.set(JSJitInfo {
512    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
513        method: Some(fillPoses::<D>)
514    },
515    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
516        protoID: PrototypeList::ID::XRFrame as u16,
517    },
518    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
519    _bitfield_align_1: [],
520    _bitfield_1: __BindgenBitfieldUnit::new(
521        new_jsjitinfo_bitfield_1!(
522            JSJitInfo_OpType::Method as u8,
523            JSJitInfo_AliasSet::AliasEverything as u8,
524            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
525            false,
526            false,
527            false,
528            false,
529            false,
530            false,
531            0,
532        ).to_ne_bytes()
533    ),
534});
535}
536unsafe extern "C" fn getHitTestResults<D: DomTypes>
537(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
538    let mut result = false;
539    wrap_panic(&mut || result = (|| {
540        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
541        let this = &*(this as *const D::XRFrame);
542        let args = &*args;
543        let argc = args.argc_;
544
545        if argc < 1 {
546            throw_type_error(cx.raw_cx(), "Not enough arguments to \"XRFrame.getHitTestResults\".");
547            return false;
548        }
549        let arg0: DomRoot<D::XRHitTestSource> = if HandleValue::from_raw(args.get(0)).get().is_object() {
550            match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
551                Ok(val) => val,
552                Err(()) => {
553                    throw_type_error(cx.raw_cx(), "value does not implement interface XRHitTestSource.");
554                    return false;
555
556                }
557            }
558
559        } else {
560            throw_type_error(cx.raw_cx(), "Value is not an object.");
561            return false;
562
563        };
564        let result: Vec<DomRoot<D::XRHitTestResult>> = this.GetHitTestResults(&arg0);
565
566        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
567        return true;
568    })());
569    result
570}
571
572
573static getHitTestResults_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
574
575pub(crate) fn init_getHitTestResults_methodinfo<D: DomTypes>() {
576    getHitTestResults_methodinfo.set(JSJitInfo {
577    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
578        method: Some(getHitTestResults::<D>)
579    },
580    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
581        protoID: PrototypeList::ID::XRFrame as u16,
582    },
583    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
584    _bitfield_align_1: [],
585    _bitfield_1: __BindgenBitfieldUnit::new(
586        new_jsjitinfo_bitfield_1!(
587            JSJitInfo_OpType::Method as u8,
588            JSJitInfo_AliasSet::AliasEverything as u8,
589            JSValueType::JSVAL_TYPE_OBJECT as u8,
590            false,
591            false,
592            false,
593            false,
594            false,
595            false,
596            0,
597        ).to_ne_bytes()
598    ),
599});
600}
601unsafe extern "C" fn _finalize<D: DomTypes>
602(_cx: *mut GCContext, obj: *mut JSObject){
603    wrap_panic(&mut || {
604
605        let this = native_from_object_static::<D::XRFrame>(obj).unwrap();
606        finalize_common(this);
607    })
608}
609
610unsafe extern "C" fn _trace<D: DomTypes>
611(trc: *mut JSTracer, obj: *mut JSObject){
612    wrap_panic(&mut || {
613
614        let this = native_from_object_static::<D::XRFrame>(obj).unwrap();
615        if this.is_null() { return; } // GC during obj creation
616        (*this).trace(trc);
617    })
618}
619
620
621static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
622
623pub(crate) fn init_class_ops<D: DomTypes>() {
624    CLASS_OPS.set(JSClassOps {
625        addProperty: None,
626        delProperty: None,
627        enumerate: None,
628        newEnumerate: None,
629        resolve: None,
630        mayResolve: None,
631        finalize: Some(_finalize::<D>),
632        call: None,
633        construct: None,
634        trace: Some(_trace::<D>),
635    });
636}
637
638pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
639
640pub(crate) fn init_domjs_class<D: DomTypes>() {
641    init_class_ops::<D>();
642    Class.set(DOMJSClass {
643        base: JSClass {
644            name: c"XRFrame".as_ptr(),
645            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
646                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
647                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
648            cOps: unsafe { CLASS_OPS.get() },
649            spec: ptr::null(),
650            ext: ptr::null(),
651            oOps: ptr::null(),
652        },
653        dom_class:
654DOMClass {
655    interface_chain: [ PrototypeList::ID::XRFrame, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
656    depth: 0,
657    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
658    malloc_size_of: malloc_size_of_including_raw_self::<D::XRFrame> as unsafe fn(&mut _, _) -> _,
659    global: Globals::EMPTY,
660},
661    });
662}
663
664#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
665(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::XRFrame>, _can_gc: CanGc) -> DomRoot<D::XRFrame>{
666
667    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
668
669    let scope = scope.reflector().get_jsobject();
670    assert!(!scope.get().is_null());
671    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
672    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
673
674    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
675    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
676    assert!(!canonical_proto.is_null());
677
678
679    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
680    if let Some(given) = given_proto {
681        proto.set(*given);
682        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
683            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
684        }
685    } else {
686        proto.set(*canonical_proto);
687    }
688    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
689        cx.raw_cx(),
690        &Class.get().base,
691        proto.handle(),
692    ));
693    assert!(!obj.is_null());
694    JS_SetReservedSlot(
695        obj.get(),
696        DOM_OBJECT_SLOT,
697        &PrivateValue(raw.as_ptr() as *const libc::c_void),
698    );
699
700    let root = raw.reflect_with(obj.get());
701
702
703
704    DomRoot::from_ref(&*root)
705}
706
707pub trait XRFrameMethods<D: DomTypes> {
708    fn Session(&self, ) -> DomRoot<D::XRSession>;
709    fn PredictedDisplayTime(&self, ) -> Finite<f64>;
710    fn GetViewerPose(&self, r#referenceSpace: &D::XRReferenceSpace, r#_can_gc: CanGc) -> Fallible<Option<DomRoot<D::XRViewerPose>>>;
711    fn GetPose(&self, r#space: &D::XRSpace, r#baseSpace: &D::XRSpace, r#_can_gc: CanGc) -> Fallible<Option<DomRoot<D::XRPose>>>;
712    fn GetJointPose(&self, r#joint: &D::XRJointSpace, r#baseSpace: &D::XRSpace, r#_can_gc: CanGc) -> Fallible<Option<DomRoot<D::XRJointPose>>>;
713    fn FillJointRadii(&self, r#jointSpaces: Vec<DomRoot<D::XRJointSpace>>, r#radii: CustomAutoRooterGuard<typedarray::Float32Array>) -> Fallible<bool>;
714    fn FillPoses(&self, r#spaces: Vec<DomRoot<D::XRSpace>>, r#baseSpace: &D::XRSpace, r#transforms: CustomAutoRooterGuard<typedarray::Float32Array>) -> Fallible<bool>;
715    fn GetHitTestResults(&self, r#hitTestSource: &D::XRHitTestSource) -> Vec<DomRoot<D::XRHitTestResult>>;
716}
717static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
718
719pub(crate) fn init_sMethods_specs<D: DomTypes>() {
720    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
721    JSFunctionSpec {
722        name: JSPropertySpec_Name { string_: c"getViewerPose".as_ptr() },
723        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getViewerPose_methodinfo.get() } as *const _ as *const JSJitInfo },
724        nargs: 1,
725        flags: (JSPROP_ENUMERATE) as u16,
726        selfHostedName: ptr::null()
727    },
728    JSFunctionSpec {
729        name: JSPropertySpec_Name { string_: c"getPose".as_ptr() },
730        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getPose_methodinfo.get() } as *const _ as *const JSJitInfo },
731        nargs: 2,
732        flags: (JSPROP_ENUMERATE) as u16,
733        selfHostedName: ptr::null()
734    },
735    JSFunctionSpec {
736        name: JSPropertySpec_Name { string_: ptr::null() },
737        call: JSNativeWrapper { op: None, info: ptr::null() },
738        nargs: 0,
739        flags: 0,
740        selfHostedName: ptr::null()
741    }]))[..]
742,
743&Box::leak(Box::new([
744    JSFunctionSpec {
745        name: JSPropertySpec_Name { string_: c"getJointPose".as_ptr() },
746        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getJointPose_methodinfo.get() } as *const _ as *const JSJitInfo },
747        nargs: 2,
748        flags: (JSPROP_ENUMERATE) as u16,
749        selfHostedName: ptr::null()
750    },
751    JSFunctionSpec {
752        name: JSPropertySpec_Name { string_: c"fillJointRadii".as_ptr() },
753        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { fillJointRadii_methodinfo.get() } as *const _ as *const JSJitInfo },
754        nargs: 2,
755        flags: (JSPROP_ENUMERATE) as u16,
756        selfHostedName: ptr::null()
757    },
758    JSFunctionSpec {
759        name: JSPropertySpec_Name { string_: c"fillPoses".as_ptr() },
760        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { fillPoses_methodinfo.get() } as *const _ as *const JSJitInfo },
761        nargs: 3,
762        flags: (JSPROP_ENUMERATE) as u16,
763        selfHostedName: ptr::null()
764    },
765    JSFunctionSpec {
766        name: JSPropertySpec_Name { string_: ptr::null() },
767        call: JSNativeWrapper { op: None, info: ptr::null() },
768        nargs: 0,
769        flags: 0,
770        selfHostedName: ptr::null()
771    }]))[..]
772,
773&Box::leak(Box::new([
774    JSFunctionSpec {
775        name: JSPropertySpec_Name { string_: c"getHitTestResults".as_ptr() },
776        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getHitTestResults_methodinfo.get() } as *const _ as *const JSJitInfo },
777        nargs: 1,
778        flags: (JSPROP_ENUMERATE) as u16,
779        selfHostedName: ptr::null()
780    },
781    JSFunctionSpec {
782        name: JSPropertySpec_Name { string_: ptr::null() },
783        call: JSNativeWrapper { op: None, info: ptr::null() },
784        nargs: 0,
785        flags: 0,
786        selfHostedName: ptr::null()
787    }]))[..]
788])));
789}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
790
791pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
792    sMethods.set(Box::leak(Box::new([    Guard::new(&[Condition::SecureContext(),Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0]),
793    Guard::new(&[Condition::SecureContext(),Condition::Pref("dom_webxr_hands_enabled"),Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[1]),
794    Guard::new(&[Condition::SecureContext(),Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[2])])));
795}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
796
797pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
798    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
799    JSPropertySpec {
800                    name: JSPropertySpec_Name { string_: c"session".as_ptr() },
801                    attributes_: (JSPROP_ENUMERATE),
802                    kind_: (JSPropertySpec_Kind::NativeAccessor),
803                    u: JSPropertySpec_AccessorsOrValue {
804                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
805                            getter: JSPropertySpec_Accessor {
806                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { session_getterinfo.get() } },
807                            },
808                            setter: JSPropertySpec_Accessor {
809                                native: JSNativeWrapper { op: None, info: ptr::null() },
810                            }
811                        }
812                    }
813                }
814,
815    JSPropertySpec {
816                    name: JSPropertySpec_Name { string_: c"predictedDisplayTime".as_ptr() },
817                    attributes_: (JSPROP_ENUMERATE),
818                    kind_: (JSPropertySpec_Kind::NativeAccessor),
819                    u: JSPropertySpec_AccessorsOrValue {
820                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
821                            getter: JSPropertySpec_Accessor {
822                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { predictedDisplayTime_getterinfo.get() } },
823                            },
824                            setter: JSPropertySpec_Accessor {
825                                native: JSNativeWrapper { op: None, info: ptr::null() },
826                            }
827                        }
828                    }
829                }
830,
831    JSPropertySpec::ZERO]))[..]
832,
833&Box::leak(Box::new([
834    JSPropertySpec {
835                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
836                    attributes_: (JSPROP_READONLY),
837                    kind_: (JSPropertySpec_Kind::Value),
838                    u: JSPropertySpec_AccessorsOrValue {
839                        value: JSPropertySpec_ValueWrapper {
840                            type_: JSPropertySpec_ValueWrapper_Type::String,
841                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
842                                string: c"XRFrame".as_ptr(),
843                            }
844                        }
845                    }
846                }
847,
848    JSPropertySpec::ZERO]))[..]
849])));
850}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
851
852pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
853    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::SecureContext(),Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
854    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
855}
856pub fn GetProtoObject<D: DomTypes>
857(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
858    /* Get the interface prototype object for this class.  This will create the
859       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::XRFrame), CreateInterfaceObjects::<D>, rval)
860}
861
862
863static PrototypeClass: JSClass = JSClass {
864    name: c"XRFramePrototype".as_ptr(),
865    flags:
866        // JSCLASS_HAS_RESERVED_SLOTS()
867        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
868    cOps: ptr::null(),
869    spec: ptr::null(),
870    ext: ptr::null(),
871    oOps: ptr::null(),
872};
873
874
875static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
876
877pub(crate) fn init_interface_object<D: DomTypes>() {
878    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
879        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
880        b"function XRFrame() {\n    [native code]\n}",
881        PrototypeList::ID::XRFrame,
882        0,
883    ));
884}
885
886pub fn DefineDOMInterface<D: DomTypes>
887(cx: SafeJSContext, global: HandleObject){
888    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::XRFrame),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
889}
890
891pub fn ConstructorEnabled<D: DomTypes>
892(aCx: SafeJSContext, aObj: HandleObject) -> bool{
893    is_exposed_in(aObj, Globals::WINDOW) &&
894    pref!(dom_webxr_enabled) &&
895
896    unsafe {
897        let in_realm_proof = AlreadyInRealm::assert_for_cx(aCx);
898        D::GlobalScope::from_context(*aCx, InRealm::Already(&in_realm_proof)).is_secure_context()
899    }
900
901}
902
903unsafe fn CreateInterfaceObjects<D: DomTypes>
904(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
905
906    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
907    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
908    assert!(!prototype_proto.is_null());
909
910    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
911    create_interface_prototype_object::<D>(cx,
912                                      global,
913                                      prototype_proto.handle(),
914                                      &PrototypeClass,
915                                      sMethods.get(),
916                                      sAttributes.get(),
917                                      &[],
918                                      &[],
919                                      prototype.handle_mut());
920    assert!(!prototype.is_null());
921    assert!((*cache)[PrototypeList::ID::XRFrame as usize].is_null());
922    (*cache)[PrototypeList::ID::XRFrame as usize] = prototype.get();
923    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::XRFrame as isize),
924                                  ptr::null_mut(),
925                                  prototype.get());
926
927    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
928    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
929
930    assert!(!interface_proto.is_null());
931
932    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
933    create_noncallback_interface_object::<D>(cx,
934                                        global,
935                                        interface_proto.handle(),
936                                        INTERFACE_OBJECT_CLASS.get(),
937                                        &[],
938                                        &[],
939                                        &[],
940                                        prototype.handle(),
941                                        c"XRFrame",
942                                        0,
943                                        &[],
944                                        interface.handle_mut());
945    assert!(!interface.is_null());
946}
947
948
949        pub(crate) fn init_statics<D: DomTypes>() {
950            init_interface_object::<D>();
951            init_domjs_class::<D>();
952            crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_getViewerPose_methodinfo::<D>();
953crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_getPose_methodinfo::<D>();
954crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_getJointPose_methodinfo::<D>();
955crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_fillJointRadii_methodinfo::<D>();
956crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_fillPoses_methodinfo::<D>();
957crate::codegen::GenericBindings::XRFrameBinding::XRFrame_Binding::init_getHitTestResults_methodinfo::<D>();
958            init_session_getterinfo::<D>();
959init_predictedDisplayTime_getterinfo::<D>();
960
961
962            init_sMethods_specs::<D>();
963init_sMethods_prefs::<D>();
964init_sAttributes_specs::<D>();
965init_sAttributes_prefs::<D>();
966        }
967        } // mod XRFrame_Binding
968
969