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