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