1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::BlobBinding::Blob_Binding;
6use crate::codegen::GenericBindings::DocumentFragmentBinding::DocumentFragment_Binding;
7use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
8use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
9use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
10use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
11use crate::import::base::*;
12
13#[derive(JSTraceable)]
14pub struct ValidityStateFlags {
15 pub badInput: bool,
16 pub customError: bool,
17 pub patternMismatch: bool,
18 pub rangeOverflow: bool,
19 pub rangeUnderflow: bool,
20 pub stepMismatch: bool,
21 pub tooLong: bool,
22 pub tooShort: bool,
23 pub typeMismatch: bool,
24 pub valueMissing: bool,
25}
26impl Default for ValidityStateFlags {
27 fn default() -> Self {
28 Self::empty()
29 }
30}
31
32impl ValidityStateFlags {
33 pub fn empty() -> Self {
34 Self {
35 badInput: false,
36 customError: false,
37 patternMismatch: false,
38 rangeOverflow: false,
39 rangeUnderflow: false,
40 stepMismatch: false,
41 tooLong: false,
42 tooShort: false,
43 typeMismatch: false,
44 valueMissing: false,
45 }
46 }
47 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
48 -> Result<ConversionResult<ValidityStateFlags>, ()> {
49 unsafe {
50 let object = if val.get().is_null_or_undefined() {
51 ptr::null_mut()
52 } else if val.get().is_object() {
53 val.get().to_object()
54 } else {
55 return Ok(ConversionResult::Failure("Value is not an object.".into()));
56 };
57 rooted!(&in(cx) let object = object);
58 let dictionary = ValidityStateFlags {
59 badInput: {
60 rooted!(&in(cx) let mut rval = UndefinedValue());
61 if get_dictionary_property(cx.raw_cx(), object.handle(), "badInput", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
62 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
63 Ok(ConversionResult::Success(value)) => value,
64 Ok(ConversionResult::Failure(error)) => {
65 throw_type_error(cx.raw_cx(), &error);
66 return Err(());
67
68 }
69 _ => {
70 return Err(());
71
72 },
73 }
74
75 } else {
76 false
77 }
78 },
79 customError: {
80 rooted!(&in(cx) let mut rval = UndefinedValue());
81 if get_dictionary_property(cx.raw_cx(), object.handle(), "customError", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
82 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
83 Ok(ConversionResult::Success(value)) => value,
84 Ok(ConversionResult::Failure(error)) => {
85 throw_type_error(cx.raw_cx(), &error);
86 return Err(());
87
88 }
89 _ => {
90 return Err(());
91
92 },
93 }
94
95 } else {
96 false
97 }
98 },
99 patternMismatch: {
100 rooted!(&in(cx) let mut rval = UndefinedValue());
101 if get_dictionary_property(cx.raw_cx(), object.handle(), "patternMismatch", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
102 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
103 Ok(ConversionResult::Success(value)) => value,
104 Ok(ConversionResult::Failure(error)) => {
105 throw_type_error(cx.raw_cx(), &error);
106 return Err(());
107
108 }
109 _ => {
110 return Err(());
111
112 },
113 }
114
115 } else {
116 false
117 }
118 },
119 rangeOverflow: {
120 rooted!(&in(cx) let mut rval = UndefinedValue());
121 if get_dictionary_property(cx.raw_cx(), object.handle(), "rangeOverflow", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
122 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
123 Ok(ConversionResult::Success(value)) => value,
124 Ok(ConversionResult::Failure(error)) => {
125 throw_type_error(cx.raw_cx(), &error);
126 return Err(());
127
128 }
129 _ => {
130 return Err(());
131
132 },
133 }
134
135 } else {
136 false
137 }
138 },
139 rangeUnderflow: {
140 rooted!(&in(cx) let mut rval = UndefinedValue());
141 if get_dictionary_property(cx.raw_cx(), object.handle(), "rangeUnderflow", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
142 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
143 Ok(ConversionResult::Success(value)) => value,
144 Ok(ConversionResult::Failure(error)) => {
145 throw_type_error(cx.raw_cx(), &error);
146 return Err(());
147
148 }
149 _ => {
150 return Err(());
151
152 },
153 }
154
155 } else {
156 false
157 }
158 },
159 stepMismatch: {
160 rooted!(&in(cx) let mut rval = UndefinedValue());
161 if get_dictionary_property(cx.raw_cx(), object.handle(), "stepMismatch", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
162 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
163 Ok(ConversionResult::Success(value)) => value,
164 Ok(ConversionResult::Failure(error)) => {
165 throw_type_error(cx.raw_cx(), &error);
166 return Err(());
167
168 }
169 _ => {
170 return Err(());
171
172 },
173 }
174
175 } else {
176 false
177 }
178 },
179 tooLong: {
180 rooted!(&in(cx) let mut rval = UndefinedValue());
181 if get_dictionary_property(cx.raw_cx(), object.handle(), "tooLong", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
182 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
183 Ok(ConversionResult::Success(value)) => value,
184 Ok(ConversionResult::Failure(error)) => {
185 throw_type_error(cx.raw_cx(), &error);
186 return Err(());
187
188 }
189 _ => {
190 return Err(());
191
192 },
193 }
194
195 } else {
196 false
197 }
198 },
199 tooShort: {
200 rooted!(&in(cx) let mut rval = UndefinedValue());
201 if get_dictionary_property(cx.raw_cx(), object.handle(), "tooShort", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
202 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
203 Ok(ConversionResult::Success(value)) => value,
204 Ok(ConversionResult::Failure(error)) => {
205 throw_type_error(cx.raw_cx(), &error);
206 return Err(());
207
208 }
209 _ => {
210 return Err(());
211
212 },
213 }
214
215 } else {
216 false
217 }
218 },
219 typeMismatch: {
220 rooted!(&in(cx) let mut rval = UndefinedValue());
221 if get_dictionary_property(cx.raw_cx(), object.handle(), "typeMismatch", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
222 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
223 Ok(ConversionResult::Success(value)) => value,
224 Ok(ConversionResult::Failure(error)) => {
225 throw_type_error(cx.raw_cx(), &error);
226 return Err(());
227
228 }
229 _ => {
230 return Err(());
231
232 },
233 }
234
235 } else {
236 false
237 }
238 },
239 valueMissing: {
240 rooted!(&in(cx) let mut rval = UndefinedValue());
241 if get_dictionary_property(cx.raw_cx(), object.handle(), "valueMissing", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
242 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
243 Ok(ConversionResult::Success(value)) => value,
244 Ok(ConversionResult::Failure(error)) => {
245 throw_type_error(cx.raw_cx(), &error);
246 return Err(());
247
248 }
249 _ => {
250 return Err(());
251
252 },
253 }
254
255 } else {
256 false
257 }
258 },
259 };
260 Ok(ConversionResult::Success(dictionary))
261 }
262 }
263}
264
265impl FromJSValConvertible for ValidityStateFlags {
266 type Config = ();
267 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
268 -> Result<ConversionResult<ValidityStateFlags>, ()> {
269 ValidityStateFlags::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
270 }
271}
272
273impl ValidityStateFlags {
274 #[allow(clippy::wrong_self_convention)]
275 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
276 let badInput = &self.badInput;
277 rooted!(in(cx) let mut badInput_js = UndefinedValue());
278 badInput.to_jsval(cx, badInput_js.handle_mut());
279 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "badInput", badInput_js.handle()).unwrap();
280 let customError = &self.customError;
281 rooted!(in(cx) let mut customError_js = UndefinedValue());
282 customError.to_jsval(cx, customError_js.handle_mut());
283 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "customError", customError_js.handle()).unwrap();
284 let patternMismatch = &self.patternMismatch;
285 rooted!(in(cx) let mut patternMismatch_js = UndefinedValue());
286 patternMismatch.to_jsval(cx, patternMismatch_js.handle_mut());
287 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "patternMismatch", patternMismatch_js.handle()).unwrap();
288 let rangeOverflow = &self.rangeOverflow;
289 rooted!(in(cx) let mut rangeOverflow_js = UndefinedValue());
290 rangeOverflow.to_jsval(cx, rangeOverflow_js.handle_mut());
291 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "rangeOverflow", rangeOverflow_js.handle()).unwrap();
292 let rangeUnderflow = &self.rangeUnderflow;
293 rooted!(in(cx) let mut rangeUnderflow_js = UndefinedValue());
294 rangeUnderflow.to_jsval(cx, rangeUnderflow_js.handle_mut());
295 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "rangeUnderflow", rangeUnderflow_js.handle()).unwrap();
296 let stepMismatch = &self.stepMismatch;
297 rooted!(in(cx) let mut stepMismatch_js = UndefinedValue());
298 stepMismatch.to_jsval(cx, stepMismatch_js.handle_mut());
299 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stepMismatch", stepMismatch_js.handle()).unwrap();
300 let tooLong = &self.tooLong;
301 rooted!(in(cx) let mut tooLong_js = UndefinedValue());
302 tooLong.to_jsval(cx, tooLong_js.handle_mut());
303 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "tooLong", tooLong_js.handle()).unwrap();
304 let tooShort = &self.tooShort;
305 rooted!(in(cx) let mut tooShort_js = UndefinedValue());
306 tooShort.to_jsval(cx, tooShort_js.handle_mut());
307 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "tooShort", tooShort_js.handle()).unwrap();
308 let typeMismatch = &self.typeMismatch;
309 rooted!(in(cx) let mut typeMismatch_js = UndefinedValue());
310 typeMismatch.to_jsval(cx, typeMismatch_js.handle_mut());
311 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "typeMismatch", typeMismatch_js.handle()).unwrap();
312 let valueMissing = &self.valueMissing;
313 rooted!(in(cx) let mut valueMissing_js = UndefinedValue());
314 valueMissing.to_jsval(cx, valueMissing_js.handle_mut());
315 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "valueMissing", valueMissing_js.handle()).unwrap();
316 }
317}
318
319impl ToJSValConvertible for ValidityStateFlags {
320 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
321 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
322 self.to_jsobject(cx, obj.handle_mut());
323 rval.set(ObjectOrNullValue(obj.get()))
324 }
325}
326
327
328pub use self::CustomStateSet_Binding::{Wrap as CustomStateSetWrap, CustomStateSetMethods, GetProtoObject as CustomStateSetGetProtoObject, DefineDOMInterface as CustomStateSetDefineDOMInterface};
329pub mod CustomStateSet_Binding {
330use crate::import::module::*;
331
332unsafe extern "C" fn get_size<D: DomTypes>
333(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
334 let mut result = false;
335 wrap_panic(&mut || result = (|| {
336 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
337 let this = &*(this as *const D::CustomStateSet);
338 let result: u32 = this.Size();
339
340 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
341 return true;
342 })());
343 result
344}
345
346
347static size_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
348
349pub(crate) fn init_size_getterinfo<D: DomTypes>() {
350 size_getterinfo.set(JSJitInfo {
351 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
352 getter: Some(get_size::<D>)
353 },
354 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
355 protoID: PrototypeList::ID::CustomStateSet as u16,
356 },
357 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
358 _bitfield_align_1: [],
359 _bitfield_1: __BindgenBitfieldUnit::new(
360 new_jsjitinfo_bitfield_1!(
361 JSJitInfo_OpType::Getter as u8,
362 JSJitInfo_AliasSet::AliasEverything as u8,
363 JSValueType::JSVAL_TYPE_DOUBLE as u8,
364 true,
365 false,
366 false,
367 false,
368 false,
369 false,
370 0,
371 ).to_ne_bytes()
372 ),
373});
374}
375unsafe extern "C" fn entries<D: DomTypes>
376(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
377 let mut result = false;
378 wrap_panic(&mut || result = (|| {
379 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
380 let this = &*(this as *const D::CustomStateSet);
381 let args = &*args;
382 let argc = args.argc_;
383 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
384 let result = crate::iterable::IterableIterator::new(this, IteratorType::Entries, InRealm::already(&realm));
385
386
387 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
388 return true;
389 })());
390 result
391}
392
393const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
394static entries_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
395
396pub(crate) fn init_entries_methodinfo<D: DomTypes>() {
397 entries_methodinfo.set(JSTypedMethodJitInfo {
398 base: JSJitInfo {
399 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
400 method: Some(entries::<D>)
401 },
402 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
403 protoID: PrototypeList::ID::CustomStateSet as u16,
404 },
405 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
406 _bitfield_align_1: [],
407 _bitfield_1: __BindgenBitfieldUnit::new(
408 new_jsjitinfo_bitfield_1!(
409 JSJitInfo_OpType::Method as u8,
410 JSJitInfo_AliasSet::AliasEverything as u8,
411 JSValueType::JSVAL_TYPE_OBJECT as u8,
412 false,
413 false,
414 false,
415 false,
416 false,
417 true,
418 0,
419 ).to_ne_bytes()
420 ),
421 },
422 argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
423 });
424}
425
426unsafe extern "C" fn keys<D: DomTypes>
427(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
428 let mut result = false;
429 wrap_panic(&mut || result = (|| {
430 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
431 let this = &*(this as *const D::CustomStateSet);
432 let args = &*args;
433 let argc = args.argc_;
434 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
435 let result = crate::iterable::IterableIterator::new(this, IteratorType::Keys, InRealm::already(&realm));
436
437
438 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
439 return true;
440 })());
441 result
442}
443
444const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
445static keys_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
446
447pub(crate) fn init_keys_methodinfo<D: DomTypes>() {
448 keys_methodinfo.set(JSTypedMethodJitInfo {
449 base: JSJitInfo {
450 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
451 method: Some(keys::<D>)
452 },
453 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
454 protoID: PrototypeList::ID::CustomStateSet as u16,
455 },
456 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
457 _bitfield_align_1: [],
458 _bitfield_1: __BindgenBitfieldUnit::new(
459 new_jsjitinfo_bitfield_1!(
460 JSJitInfo_OpType::Method as u8,
461 JSJitInfo_AliasSet::AliasEverything as u8,
462 JSValueType::JSVAL_TYPE_OBJECT as u8,
463 false,
464 false,
465 false,
466 false,
467 false,
468 true,
469 0,
470 ).to_ne_bytes()
471 ),
472 },
473 argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
474 });
475}
476
477unsafe extern "C" fn values<D: DomTypes>
478(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
479 let mut result = false;
480 wrap_panic(&mut || result = (|| {
481 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
482 let this = &*(this as *const D::CustomStateSet);
483 let args = &*args;
484 let argc = args.argc_;
485 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
486 let result = crate::iterable::IterableIterator::new(this, IteratorType::Values, InRealm::already(&realm));
487
488
489 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
490 return true;
491 })());
492 result
493}
494
495const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
496static values_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
497
498pub(crate) fn init_values_methodinfo<D: DomTypes>() {
499 values_methodinfo.set(JSTypedMethodJitInfo {
500 base: JSJitInfo {
501 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
502 method: Some(values::<D>)
503 },
504 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
505 protoID: PrototypeList::ID::CustomStateSet as u16,
506 },
507 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
508 _bitfield_align_1: [],
509 _bitfield_1: __BindgenBitfieldUnit::new(
510 new_jsjitinfo_bitfield_1!(
511 JSJitInfo_OpType::Method as u8,
512 JSJitInfo_AliasSet::AliasEverything as u8,
513 JSValueType::JSVAL_TYPE_OBJECT as u8,
514 false,
515 false,
516 false,
517 false,
518 false,
519 true,
520 0,
521 ).to_ne_bytes()
522 ),
523 },
524 argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
525 });
526}
527
528unsafe extern "C" fn forEach<D: DomTypes>
529(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
530 let mut result = false;
531 wrap_panic(&mut || result = (|| {
532 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
533 let this = &*(this as *const D::CustomStateSet);
534 let args = &*args;
535 let argc = args.argc_;
536
537 if argc < 1 {
538 throw_type_error(cx.raw_cx(), "Not enough arguments to \"CustomStateSet.forEach\".");
539 return false;
540 }
541 let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
542 HandleValue::from_raw(args.get(0)).get().to_object()
543 } else {
544 throw_type_error(cx.raw_cx(), "Value is not an object.");
545 return false;
546
547 };
548 let arg1: HandleValue = if args.get(1).is_undefined() {
549 HandleValue::undefined()
550 } else {
551 HandleValue::from_raw(args.get(1))
552 };
553 if !IsCallable(arg0) {
554 throw_type_error(cx.raw_cx(), "Argument 1 of CustomStateSet.forEach is not callable.");
555 return false;
556 }
557 rooted!(&in(cx) let arg0 = ObjectValue(arg0));
558 rooted!(&in(cx) let mut call_arg1 = UndefinedValue());
559 rooted!(&in(cx) let mut call_arg2 = UndefinedValue());
560 rooted_vec!(let mut call_args);
561 call_args.push(UndefinedValue());
562 call_args.push(UndefinedValue());
563 call_args.push(ObjectValue(*_obj));
564 rooted!(&in(cx) let mut ignoredReturnVal = UndefinedValue());
565
566 let mut i = 0;
574 while i < (*this).get_iterable_length() {
575 (*this).get_value_at_index(i).to_jsval(cx.raw_cx(), call_arg1.handle_mut());
576 (*this).get_key_at_index(i).to_jsval(cx.raw_cx(), call_arg2.handle_mut());
577 call_args[0] = call_arg1.handle().get();
578 call_args[1] = call_arg2.handle().get();
579 let call_args_handle = HandleValueArray::from(&call_args);
580 if !Call(cx.raw_cx(), arg1, arg0.handle(), &call_args_handle,
581 ignoredReturnVal.handle_mut()) {
582 return false;
583 }
584
585 i += 1;
586 }
587
588 let result = ();
589
590
591 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
592 return true;
593 })());
594 result
595}
596
597
598static forEach_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
599
600pub(crate) fn init_forEach_methodinfo<D: DomTypes>() {
601 forEach_methodinfo.set(JSJitInfo {
602 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
603 method: Some(forEach::<D>)
604 },
605 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
606 protoID: PrototypeList::ID::CustomStateSet as u16,
607 },
608 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
609 _bitfield_align_1: [],
610 _bitfield_1: __BindgenBitfieldUnit::new(
611 new_jsjitinfo_bitfield_1!(
612 JSJitInfo_OpType::Method as u8,
613 JSJitInfo_AliasSet::AliasEverything as u8,
614 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
615 false,
616 false,
617 false,
618 false,
619 false,
620 false,
621 0,
622 ).to_ne_bytes()
623 ),
624});
625}
626unsafe extern "C" fn has<D: DomTypes>
627(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
628 let mut result = false;
629 wrap_panic(&mut || result = (|| {
630 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
631 let this = &*(this as *const D::CustomStateSet);
632 let args = &*args;
633 let argc = args.argc_;
634
635 if argc < 1 {
636 throw_type_error(cx.raw_cx(), "Not enough arguments to \"CustomStateSet.has\".");
637 return false;
638 }
639 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
640 Ok(ConversionResult::Success(value)) => value,
641 Ok(ConversionResult::Failure(error)) => {
642 throw_type_error(cx.raw_cx(), &error);
643 return false;
644
645 }
646 _ => {
647 return false;
648
649 },
650 }
651 ;
652 let result = Setlike::has(this, arg0);
653
654
655 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
656 return true;
657 })());
658 result
659}
660
661const has_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
662static has_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
663
664pub(crate) fn init_has_methodinfo<D: DomTypes>() {
665 has_methodinfo.set(JSTypedMethodJitInfo {
666 base: JSJitInfo {
667 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
668 method: Some(has::<D>)
669 },
670 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
671 protoID: PrototypeList::ID::CustomStateSet as u16,
672 },
673 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
674 _bitfield_align_1: [],
675 _bitfield_1: __BindgenBitfieldUnit::new(
676 new_jsjitinfo_bitfield_1!(
677 JSJitInfo_OpType::Method as u8,
678 JSJitInfo_AliasSet::AliasDOMSets as u8,
679 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
680 false,
681 false,
682 false,
683 false,
684 false,
685 true,
686 0,
687 ).to_ne_bytes()
688 ),
689 },
690 argTypes: &has_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
691 });
692}
693
694unsafe extern "C" fn clear<D: DomTypes>
695(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
696 let mut result = false;
697 wrap_panic(&mut || result = (|| {
698 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
699 let this = &*(this as *const D::CustomStateSet);
700 let args = &*args;
701 let argc = args.argc_;
702 let result = Setlike::clear(this);
703
704
705 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
706 return true;
707 })());
708 result
709}
710
711
712static clear_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
713
714pub(crate) fn init_clear_methodinfo<D: DomTypes>() {
715 clear_methodinfo.set(JSJitInfo {
716 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
717 method: Some(clear::<D>)
718 },
719 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
720 protoID: PrototypeList::ID::CustomStateSet as u16,
721 },
722 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
723 _bitfield_align_1: [],
724 _bitfield_1: __BindgenBitfieldUnit::new(
725 new_jsjitinfo_bitfield_1!(
726 JSJitInfo_OpType::Method as u8,
727 JSJitInfo_AliasSet::AliasEverything as u8,
728 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
729 false,
730 false,
731 false,
732 false,
733 false,
734 false,
735 0,
736 ).to_ne_bytes()
737 ),
738});
739}
740unsafe extern "C" fn delete<D: DomTypes>
741(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
742 let mut result = false;
743 wrap_panic(&mut || result = (|| {
744 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
745 let this = &*(this as *const D::CustomStateSet);
746 let args = &*args;
747 let argc = args.argc_;
748
749 if argc < 1 {
750 throw_type_error(cx.raw_cx(), "Not enough arguments to \"CustomStateSet.delete\".");
751 return false;
752 }
753 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
754 Ok(ConversionResult::Success(value)) => value,
755 Ok(ConversionResult::Failure(error)) => {
756 throw_type_error(cx.raw_cx(), &error);
757 return false;
758
759 }
760 _ => {
761 return false;
762
763 },
764 }
765 ;
766 let result = Setlike::delete(this, arg0);
767
768
769 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
770 return true;
771 })());
772 result
773}
774
775
776static delete_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
777
778pub(crate) fn init_delete_methodinfo<D: DomTypes>() {
779 delete_methodinfo.set(JSJitInfo {
780 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
781 method: Some(delete::<D>)
782 },
783 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
784 protoID: PrototypeList::ID::CustomStateSet as u16,
785 },
786 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
787 _bitfield_align_1: [],
788 _bitfield_1: __BindgenBitfieldUnit::new(
789 new_jsjitinfo_bitfield_1!(
790 JSJitInfo_OpType::Method as u8,
791 JSJitInfo_AliasSet::AliasEverything as u8,
792 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
793 false,
794 false,
795 false,
796 false,
797 false,
798 false,
799 0,
800 ).to_ne_bytes()
801 ),
802});
803}
804unsafe extern "C" fn add<D: DomTypes>
805(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
806 let mut result = false;
807 wrap_panic(&mut || result = (|| {
808 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
809 let this = &*(this as *const D::CustomStateSet);
810 let args = &*args;
811 let argc = args.argc_;
812
813 if argc < 1 {
814 throw_type_error(cx.raw_cx(), "Not enough arguments to \"CustomStateSet.add\".");
815 return false;
816 }
817 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
818 Ok(ConversionResult::Success(value)) => value,
819 Ok(ConversionResult::Failure(error)) => {
820 throw_type_error(cx.raw_cx(), &error);
821 return false;
822
823 }
824 _ => {
825 return false;
826
827 },
828 }
829 ;
830 Setlike::add(this, arg0);
831 let result = this;
833
834
835 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
836 return true;
837 })());
838 result
839}
840
841
842static add_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
843
844pub(crate) fn init_add_methodinfo<D: DomTypes>() {
845 add_methodinfo.set(JSJitInfo {
846 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
847 method: Some(add::<D>)
848 },
849 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
850 protoID: PrototypeList::ID::CustomStateSet as u16,
851 },
852 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
853 _bitfield_align_1: [],
854 _bitfield_1: __BindgenBitfieldUnit::new(
855 new_jsjitinfo_bitfield_1!(
856 JSJitInfo_OpType::Method as u8,
857 JSJitInfo_AliasSet::AliasEverything as u8,
858 JSValueType::JSVAL_TYPE_OBJECT as u8,
859 false,
860 false,
861 false,
862 false,
863 false,
864 false,
865 0,
866 ).to_ne_bytes()
867 ),
868});
869}
870unsafe extern "C" fn _finalize<D: DomTypes>
871(_cx: *mut GCContext, obj: *mut JSObject){
872 wrap_panic(&mut || {
873
874 let this = native_from_object_static::<D::CustomStateSet>(obj).unwrap();
875 finalize_common(this);
876 })
877}
878
879unsafe extern "C" fn _trace<D: DomTypes>
880(trc: *mut JSTracer, obj: *mut JSObject){
881 wrap_panic(&mut || {
882
883 let this = native_from_object_static::<D::CustomStateSet>(obj).unwrap();
884 if this.is_null() { return; } (*this).trace(trc);
886 })
887}
888
889
890static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
891
892pub(crate) fn init_class_ops<D: DomTypes>() {
893 CLASS_OPS.set(JSClassOps {
894 addProperty: None,
895 delProperty: None,
896 enumerate: None,
897 newEnumerate: None,
898 resolve: None,
899 mayResolve: None,
900 finalize: Some(_finalize::<D>),
901 call: None,
902 construct: None,
903 trace: Some(_trace::<D>),
904 });
905}
906
907pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
908
909pub(crate) fn init_domjs_class<D: DomTypes>() {
910 init_class_ops::<D>();
911 Class.set(DOMJSClass {
912 base: JSClass {
913 name: c"CustomStateSet".as_ptr(),
914 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
915 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
916 ,
917 cOps: unsafe { CLASS_OPS.get() },
918 spec: ptr::null(),
919 ext: ptr::null(),
920 oOps: ptr::null(),
921 },
922 dom_class:
923DOMClass {
924 interface_chain: [ PrototypeList::ID::CustomStateSet, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
925 depth: 0,
926 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
927 malloc_size_of: malloc_size_of_including_raw_self::<D::CustomStateSet> as unsafe fn(&mut _, _) -> _,
928 global: Globals::EMPTY,
929},
930 });
931}
932
933#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
934(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::CustomStateSet>, _can_gc: CanGc) -> DomRoot<D::CustomStateSet>{
935
936 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
937
938 let scope = scope.reflector().get_jsobject();
939 assert!(!scope.get().is_null());
940 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
941 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
942
943 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
944 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
945 assert!(!canonical_proto.is_null());
946
947
948 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
949 if let Some(given) = given_proto {
950 proto.set(*given);
951 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
952 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
953 }
954 } else {
955 proto.set(*canonical_proto);
956 }
957 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
958 cx.raw_cx(),
959 &Class.get().base,
960 proto.handle(),
961 ));
962 assert!(!obj.is_null());
963 JS_SetReservedSlot(
964 obj.get(),
965 DOM_OBJECT_SLOT,
966 &PrivateValue(raw.as_ptr() as *const libc::c_void),
967 );
968
969 let root = raw.reflect_with(obj.get());
970
971
972
973 DomRoot::from_ref(&*root)
974}
975
976pub trait CustomStateSetMethods<D: DomTypes> {
977 fn Size(&self, ) -> u32;
978}
979static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
980
981pub(crate) fn init_sMethods_specs<D: DomTypes>() {
982 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
983 JSFunctionSpec {
984 name: JSPropertySpec_Name { string_: c"entries".as_ptr() },
985 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { entries_methodinfo.get() } as *const _ as *const JSJitInfo },
986 nargs: 0,
987 flags: (JSPROP_ENUMERATE) as u16,
988 selfHostedName: ptr::null()
989 },
990 JSFunctionSpec {
991 name: JSPropertySpec_Name { string_: c"keys".as_ptr() },
992 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { keys_methodinfo.get() } as *const _ as *const JSJitInfo },
993 nargs: 0,
994 flags: (JSPROP_ENUMERATE) as u16,
995 selfHostedName: ptr::null()
996 },
997 JSFunctionSpec {
998 name: JSPropertySpec_Name { string_: c"values".as_ptr() },
999 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { values_methodinfo.get() } as *const _ as *const JSJitInfo },
1000 nargs: 0,
1001 flags: (JSPROP_ENUMERATE) as u16,
1002 selfHostedName: ptr::null()
1003 },
1004 JSFunctionSpec {
1005 name: JSPropertySpec_Name { string_: c"forEach".as_ptr() },
1006 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { forEach_methodinfo.get() } as *const _ as *const JSJitInfo },
1007 nargs: 1,
1008 flags: (JSPROP_ENUMERATE) as u16,
1009 selfHostedName: ptr::null()
1010 },
1011 JSFunctionSpec {
1012 name: JSPropertySpec_Name { string_: c"has".as_ptr() },
1013 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
1014 nargs: 1,
1015 flags: (JSPROP_ENUMERATE) as u16,
1016 selfHostedName: ptr::null()
1017 },
1018 JSFunctionSpec {
1019 name: JSPropertySpec_Name { string_: c"clear".as_ptr() },
1020 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { clear_methodinfo.get() } as *const _ as *const JSJitInfo },
1021 nargs: 0,
1022 flags: (JSPROP_ENUMERATE) as u16,
1023 selfHostedName: ptr::null()
1024 },
1025 JSFunctionSpec {
1026 name: JSPropertySpec_Name { string_: c"delete".as_ptr() },
1027 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { delete_methodinfo.get() } as *const _ as *const JSJitInfo },
1028 nargs: 1,
1029 flags: (JSPROP_ENUMERATE) as u16,
1030 selfHostedName: ptr::null()
1031 },
1032 JSFunctionSpec {
1033 name: JSPropertySpec_Name { string_: c"add".as_ptr() },
1034 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { add_methodinfo.get() } as *const _ as *const JSJitInfo },
1035 nargs: 1,
1036 flags: (JSPROP_ENUMERATE) as u16,
1037 selfHostedName: ptr::null()
1038 },
1039 JSFunctionSpec {
1040 name: JSPropertySpec_Name { string_: ptr::null() },
1041 call: JSNativeWrapper { op: None, info: ptr::null() },
1042 nargs: 0,
1043 flags: 0,
1044 selfHostedName: ptr::null()
1045 }]))[..]
1046])));
1047}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1048
1049pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1050 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0])])));
1051}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1052
1053pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1054 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1055 JSPropertySpec {
1056 name: JSPropertySpec_Name { string_: c"size".as_ptr() },
1057 attributes_: (JSPROP_ENUMERATE),
1058 kind_: (JSPropertySpec_Kind::NativeAccessor),
1059 u: JSPropertySpec_AccessorsOrValue {
1060 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1061 getter: JSPropertySpec_Accessor {
1062 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { size_getterinfo.get() } },
1063 },
1064 setter: JSPropertySpec_Accessor {
1065 native: JSNativeWrapper { op: None, info: ptr::null() },
1066 }
1067 }
1068 }
1069 }
1070,
1071 JSPropertySpec::ZERO]))[..]
1072,
1073&Box::leak(Box::new([
1074 JSPropertySpec {
1075 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1076 attributes_: (JSPROP_READONLY),
1077 kind_: (JSPropertySpec_Kind::Value),
1078 u: JSPropertySpec_AccessorsOrValue {
1079 value: JSPropertySpec_ValueWrapper {
1080 type_: JSPropertySpec_ValueWrapper_Type::String,
1081 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1082 string: c"CustomStateSet".as_ptr(),
1083 }
1084 }
1085 }
1086 }
1087,
1088 JSPropertySpec::ZERO]))[..]
1089])));
1090}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1091
1092pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1093 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
1094 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
1095}
1096pub fn GetProtoObject<D: DomTypes>
1097(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1098 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::CustomStateSet), CreateInterfaceObjects::<D>, rval)
1100}
1101
1102
1103static PrototypeClass: JSClass = JSClass {
1104 name: c"CustomStateSetPrototype".as_ptr(),
1105 flags:
1106 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1108 cOps: ptr::null(),
1109 spec: ptr::null(),
1110 ext: ptr::null(),
1111 oOps: ptr::null(),
1112};
1113
1114
1115static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
1116
1117pub(crate) fn init_interface_object<D: DomTypes>() {
1118 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
1119 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
1120 b"function CustomStateSet() {\n [native code]\n}",
1121 PrototypeList::ID::CustomStateSet,
1122 0,
1123 ));
1124}
1125
1126pub fn DefineDOMInterface<D: DomTypes>
1127(cx: SafeJSContext, global: HandleObject){
1128 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::CustomStateSet),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
1129}
1130
1131pub fn ConstructorEnabled<D: DomTypes>
1132(aCx: SafeJSContext, aObj: HandleObject) -> bool{
1133 is_exposed_in(aObj, Globals::WINDOW)
1134}
1135
1136unsafe fn CreateInterfaceObjects<D: DomTypes>
1137(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1138
1139 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1140 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
1141 assert!(!prototype_proto.is_null());
1142
1143 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1144 create_interface_prototype_object::<D>(cx,
1145 global,
1146 prototype_proto.handle(),
1147 &PrototypeClass,
1148 sMethods.get(),
1149 sAttributes.get(),
1150 &[],
1151 &[],
1152 prototype.handle_mut());
1153 assert!(!prototype.is_null());
1154 assert!((*cache)[PrototypeList::ID::CustomStateSet as usize].is_null());
1155 (*cache)[PrototypeList::ID::CustomStateSet as usize] = prototype.get();
1156 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::CustomStateSet as isize),
1157 ptr::null_mut(),
1158 prototype.get());
1159
1160 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
1161 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
1162
1163 assert!(!interface_proto.is_null());
1164
1165 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
1166 create_noncallback_interface_object::<D>(cx,
1167 global,
1168 interface_proto.handle(),
1169 INTERFACE_OBJECT_CLASS.get(),
1170 &[],
1171 &[],
1172 &[],
1173 prototype.handle(),
1174 c"CustomStateSet",
1175 0,
1176 &[],
1177 interface.handle_mut());
1178 assert!(!interface.is_null());
1179 rooted!(&in(cx) let mut aliasedVal = UndefinedValue());
1182
1183 assert!(JS_GetProperty(cx.raw_cx(), prototype.handle(),
1184 c"values".as_ptr() as *const u8 as *const _,
1185 aliasedVal.handle_mut()));
1186 rooted!(&in(cx) let mut iteratorId: jsid);
1187 RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(cx.raw_cx(), SymbolCode::iterator), iteratorId.handle_mut());
1188
1189 assert!(JS_DefinePropertyById2(cx.raw_cx(), prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
1190
1191}
1192
1193
1194 pub(crate) fn init_statics<D: DomTypes>() {
1195 init_interface_object::<D>();
1196 init_domjs_class::<D>();
1197 crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_entries_methodinfo::<D>();
1198crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_keys_methodinfo::<D>();
1199crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_values_methodinfo::<D>();
1200crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_forEach_methodinfo::<D>();
1201crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_has_methodinfo::<D>();
1202crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_clear_methodinfo::<D>();
1203crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_delete_methodinfo::<D>();
1204crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSet_Binding::init_add_methodinfo::<D>();
1205 init_size_getterinfo::<D>();
1206
1207
1208 init_sMethods_specs::<D>();
1209init_sMethods_prefs::<D>();
1210init_sAttributes_specs::<D>();
1211init_sAttributes_prefs::<D>();
1212 }
1213 } pub use self::ElementInternals_Binding::{Wrap as ElementInternalsWrap, ElementInternalsMethods, GetProtoObject as ElementInternalsGetProtoObject, DefineDOMInterface as ElementInternalsDefineDOMInterface};
1217pub mod ElementInternals_Binding {
1218use crate::codegen::GenericBindings::BlobBinding::Blob_Binding;
1219use crate::codegen::GenericBindings::DocumentFragmentBinding::DocumentFragment_Binding;
1220use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
1221use crate::codegen::GenericBindings::ElementInternalsBinding::ValidityStateFlags;
1222use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
1223use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
1224use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
1225use crate::import::module::*;
1226
1227unsafe extern "C" fn get_shadowRoot<D: DomTypes>
1228(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1229 let mut result = false;
1230 wrap_panic(&mut || result = (|| {
1231 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1232 let this = &*(this as *const D::ElementInternals);
1233 let result: Option<DomRoot<D::ShadowRoot>> = this.GetShadowRoot();
1234
1235 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1236 return true;
1237 })());
1238 result
1239}
1240
1241
1242static shadowRoot_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1243
1244pub(crate) fn init_shadowRoot_getterinfo<D: DomTypes>() {
1245 shadowRoot_getterinfo.set(JSJitInfo {
1246 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1247 getter: Some(get_shadowRoot::<D>)
1248 },
1249 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1250 protoID: PrototypeList::ID::ElementInternals as u16,
1251 },
1252 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1253 _bitfield_align_1: [],
1254 _bitfield_1: __BindgenBitfieldUnit::new(
1255 new_jsjitinfo_bitfield_1!(
1256 JSJitInfo_OpType::Getter as u8,
1257 JSJitInfo_AliasSet::AliasEverything as u8,
1258 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
1259 true,
1260 false,
1261 false,
1262 false,
1263 false,
1264 false,
1265 0,
1266 ).to_ne_bytes()
1267 ),
1268});
1269}
1270unsafe extern "C" fn setFormValue<D: DomTypes>
1271(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1272 let mut result = false;
1273 wrap_panic(&mut || result = (|| {
1274 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1275 let this = &*(this as *const D::ElementInternals);
1276 let args = &*args;
1277 let argc = args.argc_;
1278
1279 if argc < 1 {
1280 throw_type_error(cx.raw_cx(), "Not enough arguments to \"ElementInternals.setFormValue\".");
1281 return false;
1282 }
1283 let arg0: Option<GenericUnionTypes::FileOrUSVStringOrFormData::<D> > = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1284 Ok(ConversionResult::Success(value)) => value,
1285 Ok(ConversionResult::Failure(error)) => {
1286 throw_type_error(cx.raw_cx(), &error);
1287 return false;
1288
1289 }
1290 _ => {
1291 return false;
1292
1293 },
1294 }
1295 ;
1296 let arg1: Option<Option<GenericUnionTypes::FileOrUSVStringOrFormData::<D> >> = if args.get(1).is_undefined() {
1297 None
1298 } else {
1299 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1300 Ok(ConversionResult::Success(value)) => value,
1301 Ok(ConversionResult::Failure(error)) => {
1302 throw_type_error(cx.raw_cx(), &error);
1303 return false;
1304
1305 }
1306 _ => {
1307 return false;
1308
1309 },
1310 }
1311 )
1312 };
1313 let result: Result<(), Error> = this.SetFormValue(arg0, arg1);
1314 let result = match result {
1315 Ok(result) => result,
1316 Err(e) => {
1317 <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());
1318 return false;
1319 },
1320 };
1321
1322 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1323 return true;
1324 })());
1325 result
1326}
1327
1328
1329static setFormValue_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1330
1331pub(crate) fn init_setFormValue_methodinfo<D: DomTypes>() {
1332 setFormValue_methodinfo.set(JSJitInfo {
1333 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1334 method: Some(setFormValue::<D>)
1335 },
1336 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1337 protoID: PrototypeList::ID::ElementInternals as u16,
1338 },
1339 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1340 _bitfield_align_1: [],
1341 _bitfield_1: __BindgenBitfieldUnit::new(
1342 new_jsjitinfo_bitfield_1!(
1343 JSJitInfo_OpType::Method as u8,
1344 JSJitInfo_AliasSet::AliasEverything as u8,
1345 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1346 false,
1347 false,
1348 false,
1349 false,
1350 false,
1351 false,
1352 0,
1353 ).to_ne_bytes()
1354 ),
1355});
1356}
1357unsafe extern "C" fn get_form<D: DomTypes>
1358(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1359 let mut result = false;
1360 wrap_panic(&mut || result = (|| {
1361 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1362 let this = &*(this as *const D::ElementInternals);
1363 let result: Result<Option<DomRoot<D::HTMLFormElement>>, Error> = this.GetForm();
1364 let result = match result {
1365 Ok(result) => result,
1366 Err(e) => {
1367 <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());
1368 return false;
1369 },
1370 };
1371
1372 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1373 return true;
1374 })());
1375 result
1376}
1377
1378
1379static form_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1380
1381pub(crate) fn init_form_getterinfo<D: DomTypes>() {
1382 form_getterinfo.set(JSJitInfo {
1383 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1384 getter: Some(get_form::<D>)
1385 },
1386 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1387 protoID: PrototypeList::ID::ElementInternals as u16,
1388 },
1389 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1390 _bitfield_align_1: [],
1391 _bitfield_1: __BindgenBitfieldUnit::new(
1392 new_jsjitinfo_bitfield_1!(
1393 JSJitInfo_OpType::Getter as u8,
1394 JSJitInfo_AliasSet::AliasEverything as u8,
1395 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
1396 false,
1397 false,
1398 false,
1399 false,
1400 false,
1401 false,
1402 0,
1403 ).to_ne_bytes()
1404 ),
1405});
1406}
1407unsafe extern "C" fn setValidity<D: DomTypes>
1408(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1409 let mut result = false;
1410 wrap_panic(&mut || result = (|| {
1411 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1412 let this = &*(this as *const D::ElementInternals);
1413 let args = &*args;
1414 let argc = args.argc_;
1415 let arg0: crate::codegen::GenericBindings::ElementInternalsBinding::ValidityStateFlags = if args.get(0).is_undefined() {
1416 crate::codegen::GenericBindings::ElementInternalsBinding::ValidityStateFlags::empty()
1417 } else {
1418 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1419 Ok(ConversionResult::Success(value)) => value,
1420 Ok(ConversionResult::Failure(error)) => {
1421 throw_type_error(cx.raw_cx(), &error);
1422 return false;
1423
1424 }
1425 _ => {
1426 return false;
1427
1428 },
1429 }
1430
1431 };
1432 let arg1: Option<DOMString> = if args.get(1).is_undefined() {
1433 None
1434 } else {
1435 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), StringificationBehavior::Default) {
1436 Ok(ConversionResult::Success(value)) => value,
1437 Ok(ConversionResult::Failure(error)) => {
1438 throw_type_error(cx.raw_cx(), &error);
1439 return false;
1440
1441 }
1442 _ => {
1443 return false;
1444
1445 },
1446 }
1447 )
1448 };
1449 let arg2: Option<DomRoot<D::HTMLElement>> = if args.get(2).is_undefined() {
1450 None
1451 } else {
1452 Some(if HandleValue::from_raw(args.get(2)).get().is_object() {
1453 match root_from_handlevalue(HandleValue::from_raw(args.get(2)), SafeJSContext::from_ptr(cx.raw_cx())) {
1454 Ok(val) => val,
1455 Err(()) => {
1456 throw_type_error(cx.raw_cx(), "value does not implement interface HTMLElement.");
1457 return false;
1458
1459 }
1460 }
1461
1462 } else {
1463 throw_type_error(cx.raw_cx(), "Value is not an object.");
1464 return false;
1465
1466 })
1467 };
1468 let result: Result<(), Error> = this.SetValidity(&arg0, arg1, arg2.as_deref(), CanGc::note());
1469 let result = match result {
1470 Ok(result) => result,
1471 Err(e) => {
1472 <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());
1473 return false;
1474 },
1475 };
1476
1477 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1478 return true;
1479 })());
1480 result
1481}
1482
1483
1484static setValidity_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1485
1486pub(crate) fn init_setValidity_methodinfo<D: DomTypes>() {
1487 setValidity_methodinfo.set(JSJitInfo {
1488 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1489 method: Some(setValidity::<D>)
1490 },
1491 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1492 protoID: PrototypeList::ID::ElementInternals as u16,
1493 },
1494 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1495 _bitfield_align_1: [],
1496 _bitfield_1: __BindgenBitfieldUnit::new(
1497 new_jsjitinfo_bitfield_1!(
1498 JSJitInfo_OpType::Method as u8,
1499 JSJitInfo_AliasSet::AliasEverything as u8,
1500 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
1501 false,
1502 false,
1503 false,
1504 false,
1505 false,
1506 false,
1507 0,
1508 ).to_ne_bytes()
1509 ),
1510});
1511}
1512unsafe extern "C" fn get_willValidate<D: DomTypes>
1513(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1514 let mut result = false;
1515 wrap_panic(&mut || result = (|| {
1516 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1517 let this = &*(this as *const D::ElementInternals);
1518 let result: Result<bool, Error> = this.GetWillValidate();
1519 let result = match result {
1520 Ok(result) => result,
1521 Err(e) => {
1522 <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());
1523 return false;
1524 },
1525 };
1526
1527 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1528 return true;
1529 })());
1530 result
1531}
1532
1533
1534static willValidate_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1535
1536pub(crate) fn init_willValidate_getterinfo<D: DomTypes>() {
1537 willValidate_getterinfo.set(JSJitInfo {
1538 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1539 getter: Some(get_willValidate::<D>)
1540 },
1541 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1542 protoID: PrototypeList::ID::ElementInternals as u16,
1543 },
1544 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1545 _bitfield_align_1: [],
1546 _bitfield_1: __BindgenBitfieldUnit::new(
1547 new_jsjitinfo_bitfield_1!(
1548 JSJitInfo_OpType::Getter as u8,
1549 JSJitInfo_AliasSet::AliasEverything as u8,
1550 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
1551 false,
1552 false,
1553 false,
1554 false,
1555 false,
1556 false,
1557 0,
1558 ).to_ne_bytes()
1559 ),
1560});
1561}
1562unsafe extern "C" fn get_validity<D: DomTypes>
1563(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1564 let mut result = false;
1565 wrap_panic(&mut || result = (|| {
1566 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1567 let this = &*(this as *const D::ElementInternals);
1568 let result: Result<DomRoot<D::ValidityState>, Error> = this.GetValidity(CanGc::note());
1569 let result = match result {
1570 Ok(result) => result,
1571 Err(e) => {
1572 <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());
1573 return false;
1574 },
1575 };
1576
1577 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1578 return true;
1579 })());
1580 result
1581}
1582
1583
1584static validity_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1585
1586pub(crate) fn init_validity_getterinfo<D: DomTypes>() {
1587 validity_getterinfo.set(JSJitInfo {
1588 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1589 getter: Some(get_validity::<D>)
1590 },
1591 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1592 protoID: PrototypeList::ID::ElementInternals as u16,
1593 },
1594 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1595 _bitfield_align_1: [],
1596 _bitfield_1: __BindgenBitfieldUnit::new(
1597 new_jsjitinfo_bitfield_1!(
1598 JSJitInfo_OpType::Getter as u8,
1599 JSJitInfo_AliasSet::AliasEverything as u8,
1600 JSValueType::JSVAL_TYPE_OBJECT as u8,
1601 false,
1602 false,
1603 false,
1604 false,
1605 false,
1606 false,
1607 0,
1608 ).to_ne_bytes()
1609 ),
1610});
1611}
1612unsafe extern "C" fn get_validationMessage<D: DomTypes>
1613(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1614 let mut result = false;
1615 wrap_panic(&mut || result = (|| {
1616 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1617 let this = &*(this as *const D::ElementInternals);
1618 let result: Result<DOMString, Error> = this.GetValidationMessage();
1619 let result = match result {
1620 Ok(result) => result,
1621 Err(e) => {
1622 <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());
1623 return false;
1624 },
1625 };
1626
1627 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1628 return true;
1629 })());
1630 result
1631}
1632
1633
1634static validationMessage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1635
1636pub(crate) fn init_validationMessage_getterinfo<D: DomTypes>() {
1637 validationMessage_getterinfo.set(JSJitInfo {
1638 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1639 getter: Some(get_validationMessage::<D>)
1640 },
1641 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1642 protoID: PrototypeList::ID::ElementInternals as u16,
1643 },
1644 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1645 _bitfield_align_1: [],
1646 _bitfield_1: __BindgenBitfieldUnit::new(
1647 new_jsjitinfo_bitfield_1!(
1648 JSJitInfo_OpType::Getter as u8,
1649 JSJitInfo_AliasSet::AliasEverything as u8,
1650 JSValueType::JSVAL_TYPE_STRING as u8,
1651 false,
1652 false,
1653 false,
1654 false,
1655 false,
1656 false,
1657 0,
1658 ).to_ne_bytes()
1659 ),
1660});
1661}
1662unsafe extern "C" fn checkValidity<D: DomTypes>
1663(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1664 let mut result = false;
1665 wrap_panic(&mut || result = (|| {
1666 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1667 let this = &*(this as *const D::ElementInternals);
1668 let args = &*args;
1669 let argc = args.argc_;
1670 let result: Result<bool, Error> = this.CheckValidity(CanGc::note());
1671 let result = match result {
1672 Ok(result) => result,
1673 Err(e) => {
1674 <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());
1675 return false;
1676 },
1677 };
1678
1679 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1680 return true;
1681 })());
1682 result
1683}
1684
1685
1686static checkValidity_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1687
1688pub(crate) fn init_checkValidity_methodinfo<D: DomTypes>() {
1689 checkValidity_methodinfo.set(JSJitInfo {
1690 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1691 method: Some(checkValidity::<D>)
1692 },
1693 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1694 protoID: PrototypeList::ID::ElementInternals as u16,
1695 },
1696 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1697 _bitfield_align_1: [],
1698 _bitfield_1: __BindgenBitfieldUnit::new(
1699 new_jsjitinfo_bitfield_1!(
1700 JSJitInfo_OpType::Method as u8,
1701 JSJitInfo_AliasSet::AliasEverything as u8,
1702 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
1703 false,
1704 false,
1705 false,
1706 false,
1707 false,
1708 false,
1709 0,
1710 ).to_ne_bytes()
1711 ),
1712});
1713}
1714unsafe extern "C" fn reportValidity<D: DomTypes>
1715(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1716 let mut result = false;
1717 wrap_panic(&mut || result = (|| {
1718 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1719 let this = &*(this as *const D::ElementInternals);
1720 let args = &*args;
1721 let argc = args.argc_;
1722 let result: Result<bool, Error> = this.ReportValidity(CanGc::note());
1723 let result = match result {
1724 Ok(result) => result,
1725 Err(e) => {
1726 <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());
1727 return false;
1728 },
1729 };
1730
1731 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1732 return true;
1733 })());
1734 result
1735}
1736
1737
1738static reportValidity_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1739
1740pub(crate) fn init_reportValidity_methodinfo<D: DomTypes>() {
1741 reportValidity_methodinfo.set(JSJitInfo {
1742 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1743 method: Some(reportValidity::<D>)
1744 },
1745 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1746 protoID: PrototypeList::ID::ElementInternals as u16,
1747 },
1748 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1749 _bitfield_align_1: [],
1750 _bitfield_1: __BindgenBitfieldUnit::new(
1751 new_jsjitinfo_bitfield_1!(
1752 JSJitInfo_OpType::Method as u8,
1753 JSJitInfo_AliasSet::AliasEverything as u8,
1754 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
1755 false,
1756 false,
1757 false,
1758 false,
1759 false,
1760 false,
1761 0,
1762 ).to_ne_bytes()
1763 ),
1764});
1765}
1766unsafe extern "C" fn get_labels<D: DomTypes>
1767(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1768 let mut result = false;
1769 wrap_panic(&mut || result = (|| {
1770 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1771 let this = &*(this as *const D::ElementInternals);
1772 let result: Result<DomRoot<D::NodeList>, Error> = this.GetLabels(CanGc::note());
1773 let result = match result {
1774 Ok(result) => result,
1775 Err(e) => {
1776 <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());
1777 return false;
1778 },
1779 };
1780
1781 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1782 return true;
1783 })());
1784 result
1785}
1786
1787
1788static labels_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1789
1790pub(crate) fn init_labels_getterinfo<D: DomTypes>() {
1791 labels_getterinfo.set(JSJitInfo {
1792 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1793 getter: Some(get_labels::<D>)
1794 },
1795 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1796 protoID: PrototypeList::ID::ElementInternals as u16,
1797 },
1798 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1799 _bitfield_align_1: [],
1800 _bitfield_1: __BindgenBitfieldUnit::new(
1801 new_jsjitinfo_bitfield_1!(
1802 JSJitInfo_OpType::Getter as u8,
1803 JSJitInfo_AliasSet::AliasEverything as u8,
1804 JSValueType::JSVAL_TYPE_OBJECT as u8,
1805 false,
1806 false,
1807 false,
1808 false,
1809 false,
1810 false,
1811 0,
1812 ).to_ne_bytes()
1813 ),
1814});
1815}
1816unsafe extern "C" fn get_states<D: DomTypes>
1817(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1818 let mut result = false;
1819 wrap_panic(&mut || result = (|| {
1820 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1821 let this = &*(this as *const D::ElementInternals);
1822 let result: DomRoot<D::CustomStateSet> = this.States(CanGc::note());
1823
1824 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1825 return true;
1826 })());
1827 result
1828}
1829
1830
1831static states_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1832
1833pub(crate) fn init_states_getterinfo<D: DomTypes>() {
1834 states_getterinfo.set(JSJitInfo {
1835 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1836 getter: Some(get_states::<D>)
1837 },
1838 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1839 protoID: PrototypeList::ID::ElementInternals as u16,
1840 },
1841 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1842 _bitfield_align_1: [],
1843 _bitfield_1: __BindgenBitfieldUnit::new(
1844 new_jsjitinfo_bitfield_1!(
1845 JSJitInfo_OpType::Getter as u8,
1846 JSJitInfo_AliasSet::AliasNone as u8,
1847 JSValueType::JSVAL_TYPE_OBJECT as u8,
1848 true,
1849 true,
1850 false,
1851 false,
1852 false,
1853 false,
1854 0,
1855 ).to_ne_bytes()
1856 ),
1857});
1858}
1859unsafe extern "C" fn _finalize<D: DomTypes>
1860(_cx: *mut GCContext, obj: *mut JSObject){
1861 wrap_panic(&mut || {
1862
1863 let this = native_from_object_static::<D::ElementInternals>(obj).unwrap();
1864 finalize_common(this);
1865 })
1866}
1867
1868unsafe extern "C" fn _trace<D: DomTypes>
1869(trc: *mut JSTracer, obj: *mut JSObject){
1870 wrap_panic(&mut || {
1871
1872 let this = native_from_object_static::<D::ElementInternals>(obj).unwrap();
1873 if this.is_null() { return; } (*this).trace(trc);
1875 })
1876}
1877
1878
1879static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1880
1881pub(crate) fn init_class_ops<D: DomTypes>() {
1882 CLASS_OPS.set(JSClassOps {
1883 addProperty: None,
1884 delProperty: None,
1885 enumerate: None,
1886 newEnumerate: None,
1887 resolve: None,
1888 mayResolve: None,
1889 finalize: Some(_finalize::<D>),
1890 call: None,
1891 construct: None,
1892 trace: Some(_trace::<D>),
1893 });
1894}
1895
1896pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1897
1898pub(crate) fn init_domjs_class<D: DomTypes>() {
1899 init_class_ops::<D>();
1900 Class.set(DOMJSClass {
1901 base: JSClass {
1902 name: c"ElementInternals".as_ptr(),
1903 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1904 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1905 ,
1906 cOps: unsafe { CLASS_OPS.get() },
1907 spec: ptr::null(),
1908 ext: ptr::null(),
1909 oOps: ptr::null(),
1910 },
1911 dom_class:
1912DOMClass {
1913 interface_chain: [ PrototypeList::ID::ElementInternals, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1914 depth: 0,
1915 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
1916 malloc_size_of: malloc_size_of_including_raw_self::<D::ElementInternals> as unsafe fn(&mut _, _) -> _,
1917 global: Globals::EMPTY,
1918},
1919 });
1920}
1921
1922#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1923(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::ElementInternals>, _can_gc: CanGc) -> DomRoot<D::ElementInternals>{
1924
1925 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1926
1927 let scope = scope.reflector().get_jsobject();
1928 assert!(!scope.get().is_null());
1929 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1930 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1931
1932 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1933 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1934 assert!(!canonical_proto.is_null());
1935
1936
1937 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1938 if let Some(given) = given_proto {
1939 proto.set(*given);
1940 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1941 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1942 }
1943 } else {
1944 proto.set(*canonical_proto);
1945 }
1946 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1947 cx.raw_cx(),
1948 &Class.get().base,
1949 proto.handle(),
1950 ));
1951 assert!(!obj.is_null());
1952 JS_SetReservedSlot(
1953 obj.get(),
1954 DOM_OBJECT_SLOT,
1955 &PrivateValue(raw.as_ptr() as *const libc::c_void),
1956 );
1957
1958 let root = raw.reflect_with(obj.get());
1959
1960
1961
1962 DomRoot::from_ref(&*root)
1963}
1964
1965pub trait ElementInternalsMethods<D: DomTypes> {
1966 fn GetShadowRoot(&self, ) -> Option<DomRoot<D::ShadowRoot>>;
1967 fn SetFormValue(&self, r#value: Option<GenericUnionTypes::FileOrUSVStringOrFormData::<D> >, r#state: Option<Option<GenericUnionTypes::FileOrUSVStringOrFormData::<D> >>) -> Fallible<()>;
1968 fn GetForm(&self, ) -> Fallible<Option<DomRoot<D::HTMLFormElement>>>;
1969 fn SetValidity(&self, r#flags: &crate::codegen::GenericBindings::ElementInternalsBinding::ValidityStateFlags, r#message: Option<DOMString>, r#anchor: Option<&D::HTMLElement>, r#_can_gc: CanGc) -> Fallible<()>;
1970 fn GetWillValidate(&self, ) -> Fallible<bool>;
1971 fn GetValidity(&self, r#_can_gc: CanGc) -> Fallible<DomRoot<D::ValidityState>>;
1972 fn GetValidationMessage(&self, ) -> Fallible<DOMString>;
1973 fn CheckValidity(&self, r#_can_gc: CanGc) -> Fallible<bool>;
1974 fn ReportValidity(&self, r#_can_gc: CanGc) -> Fallible<bool>;
1975 fn GetLabels(&self, r#_can_gc: CanGc) -> Fallible<DomRoot<D::NodeList>>;
1976 fn States(&self, r#_can_gc: CanGc) -> DomRoot<D::CustomStateSet>;
1977}
1978static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1979
1980pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1981 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1982 JSFunctionSpec {
1983 name: JSPropertySpec_Name { string_: c"setFormValue".as_ptr() },
1984 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setFormValue_methodinfo.get() } as *const _ as *const JSJitInfo },
1985 nargs: 1,
1986 flags: (JSPROP_ENUMERATE) as u16,
1987 selfHostedName: ptr::null()
1988 },
1989 JSFunctionSpec {
1990 name: JSPropertySpec_Name { string_: c"setValidity".as_ptr() },
1991 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setValidity_methodinfo.get() } as *const _ as *const JSJitInfo },
1992 nargs: 0,
1993 flags: (JSPROP_ENUMERATE) as u16,
1994 selfHostedName: ptr::null()
1995 },
1996 JSFunctionSpec {
1997 name: JSPropertySpec_Name { string_: c"checkValidity".as_ptr() },
1998 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { checkValidity_methodinfo.get() } as *const _ as *const JSJitInfo },
1999 nargs: 0,
2000 flags: (JSPROP_ENUMERATE) as u16,
2001 selfHostedName: ptr::null()
2002 },
2003 JSFunctionSpec {
2004 name: JSPropertySpec_Name { string_: c"reportValidity".as_ptr() },
2005 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { reportValidity_methodinfo.get() } as *const _ as *const JSJitInfo },
2006 nargs: 0,
2007 flags: (JSPROP_ENUMERATE) as u16,
2008 selfHostedName: ptr::null()
2009 },
2010 JSFunctionSpec {
2011 name: JSPropertySpec_Name { string_: ptr::null() },
2012 call: JSNativeWrapper { op: None, info: ptr::null() },
2013 nargs: 0,
2014 flags: 0,
2015 selfHostedName: ptr::null()
2016 }]))[..]
2017])));
2018}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
2019
2020pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
2021 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0])])));
2022}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
2023
2024pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
2025 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
2026 JSPropertySpec {
2027 name: JSPropertySpec_Name { string_: c"shadowRoot".as_ptr() },
2028 attributes_: (JSPROP_ENUMERATE),
2029 kind_: (JSPropertySpec_Kind::NativeAccessor),
2030 u: JSPropertySpec_AccessorsOrValue {
2031 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2032 getter: JSPropertySpec_Accessor {
2033 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { shadowRoot_getterinfo.get() } },
2034 },
2035 setter: JSPropertySpec_Accessor {
2036 native: JSNativeWrapper { op: None, info: ptr::null() },
2037 }
2038 }
2039 }
2040 }
2041,
2042 JSPropertySpec {
2043 name: JSPropertySpec_Name { string_: c"form".as_ptr() },
2044 attributes_: (JSPROP_ENUMERATE),
2045 kind_: (JSPropertySpec_Kind::NativeAccessor),
2046 u: JSPropertySpec_AccessorsOrValue {
2047 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2048 getter: JSPropertySpec_Accessor {
2049 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { form_getterinfo.get() } },
2050 },
2051 setter: JSPropertySpec_Accessor {
2052 native: JSNativeWrapper { op: None, info: ptr::null() },
2053 }
2054 }
2055 }
2056 }
2057,
2058 JSPropertySpec {
2059 name: JSPropertySpec_Name { string_: c"willValidate".as_ptr() },
2060 attributes_: (JSPROP_ENUMERATE),
2061 kind_: (JSPropertySpec_Kind::NativeAccessor),
2062 u: JSPropertySpec_AccessorsOrValue {
2063 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2064 getter: JSPropertySpec_Accessor {
2065 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { willValidate_getterinfo.get() } },
2066 },
2067 setter: JSPropertySpec_Accessor {
2068 native: JSNativeWrapper { op: None, info: ptr::null() },
2069 }
2070 }
2071 }
2072 }
2073,
2074 JSPropertySpec {
2075 name: JSPropertySpec_Name { string_: c"validity".as_ptr() },
2076 attributes_: (JSPROP_ENUMERATE),
2077 kind_: (JSPropertySpec_Kind::NativeAccessor),
2078 u: JSPropertySpec_AccessorsOrValue {
2079 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2080 getter: JSPropertySpec_Accessor {
2081 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { validity_getterinfo.get() } },
2082 },
2083 setter: JSPropertySpec_Accessor {
2084 native: JSNativeWrapper { op: None, info: ptr::null() },
2085 }
2086 }
2087 }
2088 }
2089,
2090 JSPropertySpec {
2091 name: JSPropertySpec_Name { string_: c"validationMessage".as_ptr() },
2092 attributes_: (JSPROP_ENUMERATE),
2093 kind_: (JSPropertySpec_Kind::NativeAccessor),
2094 u: JSPropertySpec_AccessorsOrValue {
2095 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2096 getter: JSPropertySpec_Accessor {
2097 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { validationMessage_getterinfo.get() } },
2098 },
2099 setter: JSPropertySpec_Accessor {
2100 native: JSNativeWrapper { op: None, info: ptr::null() },
2101 }
2102 }
2103 }
2104 }
2105,
2106 JSPropertySpec {
2107 name: JSPropertySpec_Name { string_: c"labels".as_ptr() },
2108 attributes_: (JSPROP_ENUMERATE),
2109 kind_: (JSPropertySpec_Kind::NativeAccessor),
2110 u: JSPropertySpec_AccessorsOrValue {
2111 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2112 getter: JSPropertySpec_Accessor {
2113 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { labels_getterinfo.get() } },
2114 },
2115 setter: JSPropertySpec_Accessor {
2116 native: JSNativeWrapper { op: None, info: ptr::null() },
2117 }
2118 }
2119 }
2120 }
2121,
2122 JSPropertySpec {
2123 name: JSPropertySpec_Name { string_: c"states".as_ptr() },
2124 attributes_: (JSPROP_ENUMERATE),
2125 kind_: (JSPropertySpec_Kind::NativeAccessor),
2126 u: JSPropertySpec_AccessorsOrValue {
2127 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
2128 getter: JSPropertySpec_Accessor {
2129 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { states_getterinfo.get() } },
2130 },
2131 setter: JSPropertySpec_Accessor {
2132 native: JSNativeWrapper { op: None, info: ptr::null() },
2133 }
2134 }
2135 }
2136 }
2137,
2138 JSPropertySpec::ZERO]))[..]
2139,
2140&Box::leak(Box::new([
2141 JSPropertySpec {
2142 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
2143 attributes_: (JSPROP_READONLY),
2144 kind_: (JSPropertySpec_Kind::Value),
2145 u: JSPropertySpec_AccessorsOrValue {
2146 value: JSPropertySpec_ValueWrapper {
2147 type_: JSPropertySpec_ValueWrapper_Type::String,
2148 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
2149 string: c"ElementInternals".as_ptr(),
2150 }
2151 }
2152 }
2153 }
2154,
2155 JSPropertySpec::ZERO]))[..]
2156])));
2157}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
2158
2159pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
2160 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
2161 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
2162}
2163pub fn GetProtoObject<D: DomTypes>
2164(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
2165 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::ElementInternals), CreateInterfaceObjects::<D>, rval)
2167}
2168
2169
2170static PrototypeClass: JSClass = JSClass {
2171 name: c"ElementInternalsPrototype".as_ptr(),
2172 flags:
2173 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
2175 cOps: ptr::null(),
2176 spec: ptr::null(),
2177 ext: ptr::null(),
2178 oOps: ptr::null(),
2179};
2180
2181
2182static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
2183
2184pub(crate) fn init_interface_object<D: DomTypes>() {
2185 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
2186 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
2187 b"function ElementInternals() {\n [native code]\n}",
2188 PrototypeList::ID::ElementInternals,
2189 0,
2190 ));
2191}
2192
2193pub fn DefineDOMInterface<D: DomTypes>
2194(cx: SafeJSContext, global: HandleObject){
2195 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::ElementInternals),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
2196}
2197
2198pub fn ConstructorEnabled<D: DomTypes>
2199(aCx: SafeJSContext, aObj: HandleObject) -> bool{
2200 is_exposed_in(aObj, Globals::WINDOW)
2201}
2202
2203unsafe fn CreateInterfaceObjects<D: DomTypes>
2204(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
2205
2206 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
2207 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
2208 assert!(!prototype_proto.is_null());
2209
2210 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
2211 create_interface_prototype_object::<D>(cx,
2212 global,
2213 prototype_proto.handle(),
2214 &PrototypeClass,
2215 sMethods.get(),
2216 sAttributes.get(),
2217 &[],
2218 &[],
2219 prototype.handle_mut());
2220 assert!(!prototype.is_null());
2221 assert!((*cache)[PrototypeList::ID::ElementInternals as usize].is_null());
2222 (*cache)[PrototypeList::ID::ElementInternals as usize] = prototype.get();
2223 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::ElementInternals as isize),
2224 ptr::null_mut(),
2225 prototype.get());
2226
2227 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
2228 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
2229
2230 assert!(!interface_proto.is_null());
2231
2232 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
2233 create_noncallback_interface_object::<D>(cx,
2234 global,
2235 interface_proto.handle(),
2236 INTERFACE_OBJECT_CLASS.get(),
2237 &[],
2238 &[],
2239 &[],
2240 prototype.handle(),
2241 c"ElementInternals",
2242 0,
2243 &[],
2244 interface.handle_mut());
2245 assert!(!interface.is_null());
2246}
2247
2248
2249 pub(crate) fn init_statics<D: DomTypes>() {
2250 init_interface_object::<D>();
2251 init_domjs_class::<D>();
2252 crate::codegen::GenericBindings::ElementInternalsBinding::ElementInternals_Binding::init_setFormValue_methodinfo::<D>();
2253crate::codegen::GenericBindings::ElementInternalsBinding::ElementInternals_Binding::init_setValidity_methodinfo::<D>();
2254crate::codegen::GenericBindings::ElementInternalsBinding::ElementInternals_Binding::init_checkValidity_methodinfo::<D>();
2255crate::codegen::GenericBindings::ElementInternalsBinding::ElementInternals_Binding::init_reportValidity_methodinfo::<D>();
2256 init_shadowRoot_getterinfo::<D>();
2257init_form_getterinfo::<D>();
2258init_willValidate_getterinfo::<D>();
2259init_validity_getterinfo::<D>();
2260init_validationMessage_getterinfo::<D>();
2261init_labels_getterinfo::<D>();
2262init_states_getterinfo::<D>();
2263
2264
2265 init_sMethods_specs::<D>();
2266init_sMethods_prefs::<D>();
2267init_sAttributes_specs::<D>();
2268init_sAttributes_prefs::<D>();
2269 }
2270 } pub use self::CustomStateSetSetlike_Binding::{Wrap as CustomStateSetSetlikeWrap, CustomStateSetSetlikeMethods, GetProtoObject as CustomStateSetSetlikeGetProtoObject};
2274pub mod CustomStateSetSetlike_Binding {
2275use crate::import::module::*;
2276
2277unsafe extern "C" fn next<D: DomTypes>
2278(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
2279 let mut result = false;
2280 wrap_panic(&mut || result = (|| {
2281 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
2282 let this = &*(this as *const crate::iterable::IterableIterator<D, D::CustomStateSet>);
2283 let args = &*args;
2284 let argc = args.argc_;
2285 let result: Result<NonNull<JSObject>, Error> = this.Next(SafeJSContext::from_ptr(cx.raw_cx()));
2286 let result = match result {
2287 Ok(result) => result,
2288 Err(e) => {
2289 <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());
2290 return false;
2291 },
2292 };
2293
2294 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
2295 return true;
2296 })());
2297 result
2298}
2299
2300
2301static next_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
2302
2303pub(crate) fn init_next_methodinfo<D: DomTypes>() {
2304 next_methodinfo.set(JSJitInfo {
2305 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
2306 method: Some(next::<D>)
2307 },
2308 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
2309 protoID: PrototypeList::ID::CustomStateSetSetlike as u16,
2310 },
2311 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
2312 _bitfield_align_1: [],
2313 _bitfield_1: __BindgenBitfieldUnit::new(
2314 new_jsjitinfo_bitfield_1!(
2315 JSJitInfo_OpType::Method as u8,
2316 JSJitInfo_AliasSet::AliasEverything as u8,
2317 JSValueType::JSVAL_TYPE_OBJECT as u8,
2318 false,
2319 false,
2320 false,
2321 false,
2322 false,
2323 false,
2324 0,
2325 ).to_ne_bytes()
2326 ),
2327});
2328}
2329unsafe extern "C" fn _finalize<D: DomTypes>
2330(_cx: *mut GCContext, obj: *mut JSObject){
2331 wrap_panic(&mut || {
2332
2333 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::CustomStateSet>>(obj).unwrap();
2334 finalize_common(this);
2335 })
2336}
2337
2338unsafe extern "C" fn _trace<D: DomTypes>
2339(trc: *mut JSTracer, obj: *mut JSObject){
2340 wrap_panic(&mut || {
2341
2342 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::CustomStateSet>>(obj).unwrap();
2343 if this.is_null() { return; } (*this).trace(trc);
2345 })
2346}
2347
2348
2349static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
2350
2351pub(crate) fn init_class_ops<D: DomTypes>() {
2352 CLASS_OPS.set(JSClassOps {
2353 addProperty: None,
2354 delProperty: None,
2355 enumerate: None,
2356 newEnumerate: None,
2357 resolve: None,
2358 mayResolve: None,
2359 finalize: Some(_finalize::<D>),
2360 call: None,
2361 construct: None,
2362 trace: Some(_trace::<D>),
2363 });
2364}
2365
2366pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
2367
2368pub(crate) fn init_domjs_class<D: DomTypes>() {
2369 init_class_ops::<D>();
2370 Class.set(DOMJSClass {
2371 base: JSClass {
2372 name: c"CustomStateSetSetlike".as_ptr(),
2373 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
2374 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
2375 ,
2376 cOps: unsafe { CLASS_OPS.get() },
2377 spec: ptr::null(),
2378 ext: ptr::null(),
2379 oOps: ptr::null(),
2380 },
2381 dom_class:
2382DOMClass {
2383 interface_chain: [ PrototypeList::ID::CustomStateSetSetlike, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
2384 depth: 0,
2385 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
2386 malloc_size_of: malloc_size_of_including_raw_self::<crate::iterable::IterableIterator<D, D::CustomStateSet>> as unsafe fn(&mut _, _) -> _,
2387 global: Globals::EMPTY,
2388},
2389 });
2390}
2391
2392#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
2393(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<crate::iterable::IterableIterator<D, D::CustomStateSet>>, _can_gc: CanGc) -> DomRoot<crate::iterable::IterableIterator<D, D::CustomStateSet>>{
2394
2395 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
2396
2397 let scope = scope.reflector().get_jsobject();
2398 assert!(!scope.get().is_null());
2399 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
2400 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
2401
2402 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
2403 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
2404 assert!(!canonical_proto.is_null());
2405
2406
2407 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
2408 if let Some(given) = given_proto {
2409 proto.set(*given);
2410 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
2411 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
2412 }
2413 } else {
2414 proto.set(*canonical_proto);
2415 }
2416 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
2417 cx.raw_cx(),
2418 &Class.get().base,
2419 proto.handle(),
2420 ));
2421 assert!(!obj.is_null());
2422 JS_SetReservedSlot(
2423 obj.get(),
2424 DOM_OBJECT_SLOT,
2425 &PrivateValue(raw.as_ptr() as *const libc::c_void),
2426 );
2427
2428 let root = raw.reflect_with(obj.get());
2429
2430
2431
2432 DomRoot::from_ref(&*root)
2433}
2434
2435pub trait CustomStateSetSetlikeMethods<D: DomTypes> {
2436 fn Next(&self, r#cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
2437}
2438static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
2439
2440pub(crate) fn init_sMethods_specs<D: DomTypes>() {
2441 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
2442 JSFunctionSpec {
2443 name: JSPropertySpec_Name { string_: c"next".as_ptr() },
2444 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { next_methodinfo.get() } as *const _ as *const JSJitInfo },
2445 nargs: 0,
2446 flags: (JSPROP_ENUMERATE) as u16,
2447 selfHostedName: ptr::null()
2448 },
2449 JSFunctionSpec {
2450 name: JSPropertySpec_Name { string_: ptr::null() },
2451 call: JSNativeWrapper { op: None, info: ptr::null() },
2452 nargs: 0,
2453 flags: 0,
2454 selfHostedName: ptr::null()
2455 }]))[..]
2456])));
2457}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
2458
2459pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
2460 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sMethods_specs.get() })[0])])));
2461}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
2462
2463pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
2464 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
2465 JSPropertySpec {
2466 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
2467 attributes_: (JSPROP_READONLY),
2468 kind_: (JSPropertySpec_Kind::Value),
2469 u: JSPropertySpec_AccessorsOrValue {
2470 value: JSPropertySpec_ValueWrapper {
2471 type_: JSPropertySpec_ValueWrapper_Type::String,
2472 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
2473 string: c"CustomStateSet Setlike".as_ptr(),
2474 }
2475 }
2476 }
2477 }
2478,
2479 JSPropertySpec::ZERO]))[..]
2480])));
2481}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
2482
2483pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
2484 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
2485}
2486pub fn GetProtoObject<D: DomTypes>
2487(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
2488 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::CustomStateSetSetlike), CreateInterfaceObjects::<D>, rval)
2490}
2491
2492
2493static PrototypeClass: JSClass = JSClass {
2494 name: c"CustomStateSetSetlikePrototype".as_ptr(),
2495 flags:
2496 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
2498 cOps: ptr::null(),
2499 spec: ptr::null(),
2500 ext: ptr::null(),
2501 oOps: ptr::null(),
2502};
2503
2504unsafe fn CreateInterfaceObjects<D: DomTypes>
2505(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
2506
2507 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
2508 prototype_proto.set(GetRealmIteratorPrototype(cx.raw_cx()));
2509 assert!(!prototype_proto.is_null());
2510
2511 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
2512 create_interface_prototype_object::<D>(cx,
2513 global,
2514 prototype_proto.handle(),
2515 &PrototypeClass,
2516 sMethods.get(),
2517 sAttributes.get(),
2518 &[],
2519 &[],
2520 prototype.handle_mut());
2521 assert!(!prototype.is_null());
2522 assert!((*cache)[PrototypeList::ID::CustomStateSetSetlike as usize].is_null());
2523 (*cache)[PrototypeList::ID::CustomStateSetSetlike as usize] = prototype.get();
2524 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::CustomStateSetSetlike as isize),
2525 ptr::null_mut(),
2526 prototype.get());
2527
2528}
2529
2530
2531 pub(crate) fn init_statics<D: DomTypes>() {
2532
2533 init_domjs_class::<D>();
2534 crate::codegen::GenericBindings::ElementInternalsBinding::CustomStateSetSetlike_Binding::init_next_methodinfo::<D>();
2535
2536
2537
2538 init_sMethods_specs::<D>();
2539init_sMethods_prefs::<D>();
2540init_sAttributes_specs::<D>();
2541init_sAttributes_prefs::<D>();
2542 }
2543 }