script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
FormDataBinding.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::BlobBinding::Blob_Binding;
6use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
7use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
8use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
9use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
10use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
11use crate::import::base::*;
12
13pub use self::GenericUnionTypes::FileOrUSVString as FormDataEntryValue;
14
15pub use self::FormData_Binding::{Wrap as FormDataWrap, FormDataMethods, GetProtoObject as FormDataGetProtoObject, DefineDOMInterface as FormDataDefineDOMInterface};
16pub mod FormData_Binding {
17use crate::codegen::GenericBindings::BlobBinding::Blob_Binding;
18use crate::codegen::GenericBindings::ElementBinding::Element_Binding;
19use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
20use crate::codegen::GenericBindings::HTMLElementBinding::HTMLElement_Binding;
21use crate::codegen::GenericBindings::NodeBinding::Node_Binding;
22use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
23use crate::import::module::*;
24
25unsafe extern "C" fn append<D: DomTypes>
26(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27    let mut result = false;
28    wrap_panic(&mut || result = (|| {
29        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30        let this = &*(this as *const D::FormData);
31        let args = &*args;
32        let argc = args.argc_;
33
34        let argcount = cmp::min(argc, 3);
35        match argcount {
36            2 => {
37                let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
38                    Ok(ConversionResult::Success(value)) => value,
39                    Ok(ConversionResult::Failure(error)) => {
40                        throw_type_error(cx.raw_cx(), &error);
41                return false;
42
43                    }
44                    _ => {
45                        return false;
46
47                    },
48                }
49                ;
50                if HandleValue::from_raw(args.get(1)).get().is_object() {
51                    '_block: {
52                    let arg1: DomRoot<D::Blob> = match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
53                        Ok(val) => val,
54                        Err(()) => {
55                            break '_block;
56                        }
57                    }
58                    ;
59                    let arg2: Option<USVString> = if args.get(2).is_undefined() {
60                        None
61                    } else {
62                        Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
63                            Ok(ConversionResult::Success(value)) => value,
64                            Ok(ConversionResult::Failure(error)) => {
65                                throw_type_error(cx.raw_cx(), &error);
66                        return false;
67
68                            }
69                            _ => {
70                                return false;
71
72                            },
73                        }
74                        )
75                    };
76                    let result: () = this.Append_(arg0, &arg1, arg2);
77
78                    (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
79                    return true;
80                    }
81                }
82                let arg1: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
83                    Ok(ConversionResult::Success(value)) => value,
84                    Ok(ConversionResult::Failure(error)) => {
85                        throw_type_error(cx.raw_cx(), &error);
86                return false;
87
88                    }
89                    _ => {
90                        return false;
91
92                    },
93                }
94                ;
95                let result: () = this.Append(arg0, arg1);
96
97                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
98                return true;
99            }
100            3 => {
101                let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
102                    Ok(ConversionResult::Success(value)) => value,
103                    Ok(ConversionResult::Failure(error)) => {
104                        throw_type_error(cx.raw_cx(), &error);
105                return false;
106
107                    }
108                    _ => {
109                        return false;
110
111                    },
112                }
113                ;
114                let arg1: DomRoot<D::Blob> = if HandleValue::from_raw(args.get(1)).get().is_object() {
115                    match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
116                        Ok(val) => val,
117                        Err(()) => {
118                            throw_type_error(cx.raw_cx(), "value does not implement interface Blob.");
119                            return false;
120
121                        }
122                    }
123
124                } else {
125                    throw_type_error(cx.raw_cx(), "Value is not an object.");
126                    return false;
127
128                };
129                let arg2: Option<USVString> = if args.get(2).is_undefined() {
130                    None
131                } else {
132                    Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
133                        Ok(ConversionResult::Success(value)) => value,
134                        Ok(ConversionResult::Failure(error)) => {
135                            throw_type_error(cx.raw_cx(), &error);
136                    return false;
137
138                        }
139                        _ => {
140                            return false;
141
142                        },
143                    }
144                    )
145                };
146                let result: () = this.Append_(arg0, &arg1, arg2);
147
148                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
149                return true;
150            }
151            _ => {
152                throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.append\".");
153                return false;
154            }
155        }
156    })());
157    result
158}
159
160
161static append_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
162
163pub(crate) fn init_append_methodinfo<D: DomTypes>() {
164    append_methodinfo.set(JSJitInfo {
165    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
166        method: Some(append::<D>)
167    },
168    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
169        protoID: PrototypeList::ID::FormData as u16,
170    },
171    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
172    _bitfield_align_1: [],
173    _bitfield_1: __BindgenBitfieldUnit::new(
174        new_jsjitinfo_bitfield_1!(
175            JSJitInfo_OpType::Method as u8,
176            JSJitInfo_AliasSet::AliasEverything as u8,
177            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
178            false,
179            false,
180            false,
181            false,
182            false,
183            false,
184            0,
185        ).to_ne_bytes()
186    ),
187});
188}
189unsafe extern "C" fn delete<D: DomTypes>
190(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
191    let mut result = false;
192    wrap_panic(&mut || result = (|| {
193        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
194        let this = &*(this as *const D::FormData);
195        let args = &*args;
196        let argc = args.argc_;
197
198        if argc < 1 {
199            throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.delete\".");
200            return false;
201        }
202        let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
203            Ok(ConversionResult::Success(value)) => value,
204            Ok(ConversionResult::Failure(error)) => {
205                throw_type_error(cx.raw_cx(), &error);
206        return false;
207
208            }
209            _ => {
210                return false;
211
212            },
213        }
214        ;
215        let result: () = this.Delete(arg0);
216
217        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
218        return true;
219    })());
220    result
221}
222
223
224static delete_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
225
226pub(crate) fn init_delete_methodinfo<D: DomTypes>() {
227    delete_methodinfo.set(JSJitInfo {
228    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
229        method: Some(delete::<D>)
230    },
231    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
232        protoID: PrototypeList::ID::FormData as u16,
233    },
234    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
235    _bitfield_align_1: [],
236    _bitfield_1: __BindgenBitfieldUnit::new(
237        new_jsjitinfo_bitfield_1!(
238            JSJitInfo_OpType::Method as u8,
239            JSJitInfo_AliasSet::AliasEverything as u8,
240            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
241            false,
242            false,
243            false,
244            false,
245            false,
246            false,
247            0,
248        ).to_ne_bytes()
249    ),
250});
251}
252unsafe extern "C" fn get<D: DomTypes>
253(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
254    let mut result = false;
255    wrap_panic(&mut || result = (|| {
256        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
257        let this = &*(this as *const D::FormData);
258        let args = &*args;
259        let argc = args.argc_;
260
261        if argc < 1 {
262            throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.get\".");
263            return false;
264        }
265        let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
266            Ok(ConversionResult::Success(value)) => value,
267            Ok(ConversionResult::Failure(error)) => {
268                throw_type_error(cx.raw_cx(), &error);
269        return false;
270
271            }
272            _ => {
273                return false;
274
275            },
276        }
277        ;
278        let result: Option<GenericUnionTypes::FileOrUSVString::<D>> = this.Get(arg0);
279
280        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
281        return true;
282    })());
283    result
284}
285
286
287static get_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
288
289pub(crate) fn init_get_methodinfo<D: DomTypes>() {
290    get_methodinfo.set(JSJitInfo {
291    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
292        method: Some(get::<D>)
293    },
294    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
295        protoID: PrototypeList::ID::FormData as u16,
296    },
297    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
298    _bitfield_align_1: [],
299    _bitfield_1: __BindgenBitfieldUnit::new(
300        new_jsjitinfo_bitfield_1!(
301            JSJitInfo_OpType::Method as u8,
302            JSJitInfo_AliasSet::AliasEverything as u8,
303            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
304            false,
305            false,
306            false,
307            false,
308            false,
309            false,
310            0,
311        ).to_ne_bytes()
312    ),
313});
314}
315unsafe extern "C" fn getAll<D: DomTypes>
316(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
317    let mut result = false;
318    wrap_panic(&mut || result = (|| {
319        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
320        let this = &*(this as *const D::FormData);
321        let args = &*args;
322        let argc = args.argc_;
323
324        if argc < 1 {
325            throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.getAll\".");
326            return false;
327        }
328        let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
329            Ok(ConversionResult::Success(value)) => value,
330            Ok(ConversionResult::Failure(error)) => {
331                throw_type_error(cx.raw_cx(), &error);
332        return false;
333
334            }
335            _ => {
336                return false;
337
338            },
339        }
340        ;
341        let result: Vec<GenericUnionTypes::FileOrUSVString::<D>> = this.GetAll(arg0);
342
343        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
344        return true;
345    })());
346    result
347}
348
349
350static getAll_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
351
352pub(crate) fn init_getAll_methodinfo<D: DomTypes>() {
353    getAll_methodinfo.set(JSJitInfo {
354    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
355        method: Some(getAll::<D>)
356    },
357    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
358        protoID: PrototypeList::ID::FormData as u16,
359    },
360    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
361    _bitfield_align_1: [],
362    _bitfield_1: __BindgenBitfieldUnit::new(
363        new_jsjitinfo_bitfield_1!(
364            JSJitInfo_OpType::Method as u8,
365            JSJitInfo_AliasSet::AliasEverything as u8,
366            JSValueType::JSVAL_TYPE_OBJECT as u8,
367            false,
368            false,
369            false,
370            false,
371            false,
372            false,
373            0,
374        ).to_ne_bytes()
375    ),
376});
377}
378unsafe extern "C" fn has<D: DomTypes>
379(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
380    let mut result = false;
381    wrap_panic(&mut || result = (|| {
382        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
383        let this = &*(this as *const D::FormData);
384        let args = &*args;
385        let argc = args.argc_;
386
387        if argc < 1 {
388            throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.has\".");
389            return false;
390        }
391        let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
392            Ok(ConversionResult::Success(value)) => value,
393            Ok(ConversionResult::Failure(error)) => {
394                throw_type_error(cx.raw_cx(), &error);
395        return false;
396
397            }
398            _ => {
399                return false;
400
401            },
402        }
403        ;
404        let result: bool = this.Has(arg0);
405
406        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
407        return true;
408    })());
409    result
410}
411
412
413static has_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
414
415pub(crate) fn init_has_methodinfo<D: DomTypes>() {
416    has_methodinfo.set(JSJitInfo {
417    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
418        method: Some(has::<D>)
419    },
420    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
421        protoID: PrototypeList::ID::FormData as u16,
422    },
423    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
424    _bitfield_align_1: [],
425    _bitfield_1: __BindgenBitfieldUnit::new(
426        new_jsjitinfo_bitfield_1!(
427            JSJitInfo_OpType::Method as u8,
428            JSJitInfo_AliasSet::AliasEverything as u8,
429            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
430            false,
431            false,
432            false,
433            false,
434            false,
435            false,
436            0,
437        ).to_ne_bytes()
438    ),
439});
440}
441unsafe extern "C" fn set<D: DomTypes>
442(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
443    let mut result = false;
444    wrap_panic(&mut || result = (|| {
445        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
446        let this = &*(this as *const D::FormData);
447        let args = &*args;
448        let argc = args.argc_;
449
450        let argcount = cmp::min(argc, 3);
451        match argcount {
452            2 => {
453                let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
454                    Ok(ConversionResult::Success(value)) => value,
455                    Ok(ConversionResult::Failure(error)) => {
456                        throw_type_error(cx.raw_cx(), &error);
457                return false;
458
459                    }
460                    _ => {
461                        return false;
462
463                    },
464                }
465                ;
466                if HandleValue::from_raw(args.get(1)).get().is_object() {
467                    '_block: {
468                    let arg1: DomRoot<D::Blob> = match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
469                        Ok(val) => val,
470                        Err(()) => {
471                            break '_block;
472                        }
473                    }
474                    ;
475                    let arg2: Option<USVString> = if args.get(2).is_undefined() {
476                        None
477                    } else {
478                        Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
479                            Ok(ConversionResult::Success(value)) => value,
480                            Ok(ConversionResult::Failure(error)) => {
481                                throw_type_error(cx.raw_cx(), &error);
482                        return false;
483
484                            }
485                            _ => {
486                                return false;
487
488                            },
489                        }
490                        )
491                    };
492                    let result: () = this.Set_(arg0, &arg1, arg2);
493
494                    (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
495                    return true;
496                    }
497                }
498                let arg1: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
499                    Ok(ConversionResult::Success(value)) => value,
500                    Ok(ConversionResult::Failure(error)) => {
501                        throw_type_error(cx.raw_cx(), &error);
502                return false;
503
504                    }
505                    _ => {
506                        return false;
507
508                    },
509                }
510                ;
511                let result: () = this.Set(arg0, arg1);
512
513                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
514                return true;
515            }
516            3 => {
517                let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
518                    Ok(ConversionResult::Success(value)) => value,
519                    Ok(ConversionResult::Failure(error)) => {
520                        throw_type_error(cx.raw_cx(), &error);
521                return false;
522
523                    }
524                    _ => {
525                        return false;
526
527                    },
528                }
529                ;
530                let arg1: DomRoot<D::Blob> = if HandleValue::from_raw(args.get(1)).get().is_object() {
531                    match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
532                        Ok(val) => val,
533                        Err(()) => {
534                            throw_type_error(cx.raw_cx(), "value does not implement interface Blob.");
535                            return false;
536
537                        }
538                    }
539
540                } else {
541                    throw_type_error(cx.raw_cx(), "Value is not an object.");
542                    return false;
543
544                };
545                let arg2: Option<USVString> = if args.get(2).is_undefined() {
546                    None
547                } else {
548                    Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
549                        Ok(ConversionResult::Success(value)) => value,
550                        Ok(ConversionResult::Failure(error)) => {
551                            throw_type_error(cx.raw_cx(), &error);
552                    return false;
553
554                        }
555                        _ => {
556                            return false;
557
558                        },
559                    }
560                    )
561                };
562                let result: () = this.Set_(arg0, &arg1, arg2);
563
564                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
565                return true;
566            }
567            _ => {
568                throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.set\".");
569                return false;
570            }
571        }
572    })());
573    result
574}
575
576
577static set_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
578
579pub(crate) fn init_set_methodinfo<D: DomTypes>() {
580    set_methodinfo.set(JSJitInfo {
581    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
582        method: Some(set::<D>)
583    },
584    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
585        protoID: PrototypeList::ID::FormData as u16,
586    },
587    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
588    _bitfield_align_1: [],
589    _bitfield_1: __BindgenBitfieldUnit::new(
590        new_jsjitinfo_bitfield_1!(
591            JSJitInfo_OpType::Method as u8,
592            JSJitInfo_AliasSet::AliasEverything as u8,
593            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
594            false,
595            false,
596            false,
597            false,
598            false,
599            false,
600            0,
601        ).to_ne_bytes()
602    ),
603});
604}
605unsafe extern "C" fn entries<D: DomTypes>
606(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
607    let mut result = false;
608    wrap_panic(&mut || result = (|| {
609        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
610        let this = &*(this as *const D::FormData);
611        let args = &*args;
612        let argc = args.argc_;
613        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
614        let result = IterableIterator::new(this, IteratorType::Entries, InRealm::already(&realm));
615
616
617        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
618        return true;
619    })());
620    result
621}
622
623const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
624static entries_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
625
626pub(crate) fn init_entries_methodinfo<D: DomTypes>() {
627    entries_methodinfo.set(JSTypedMethodJitInfo {
628        base:   JSJitInfo {
629      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
630          method: Some(entries::<D>)
631      },
632      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
633          protoID: PrototypeList::ID::FormData as u16,
634      },
635      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
636      _bitfield_align_1: [],
637      _bitfield_1: __BindgenBitfieldUnit::new(
638          new_jsjitinfo_bitfield_1!(
639              JSJitInfo_OpType::Method as u8,
640              JSJitInfo_AliasSet::AliasEverything as u8,
641              JSValueType::JSVAL_TYPE_OBJECT as u8,
642              false,
643              false,
644              false,
645              false,
646              false,
647              true,
648              0,
649          ).to_ne_bytes()
650      ),
651  },
652        argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
653    });
654}
655
656unsafe extern "C" fn keys<D: DomTypes>
657(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
658    let mut result = false;
659    wrap_panic(&mut || result = (|| {
660        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
661        let this = &*(this as *const D::FormData);
662        let args = &*args;
663        let argc = args.argc_;
664        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
665        let result = IterableIterator::new(this, IteratorType::Keys, InRealm::already(&realm));
666
667
668        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
669        return true;
670    })());
671    result
672}
673
674const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
675static keys_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
676
677pub(crate) fn init_keys_methodinfo<D: DomTypes>() {
678    keys_methodinfo.set(JSTypedMethodJitInfo {
679        base:   JSJitInfo {
680      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
681          method: Some(keys::<D>)
682      },
683      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
684          protoID: PrototypeList::ID::FormData as u16,
685      },
686      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
687      _bitfield_align_1: [],
688      _bitfield_1: __BindgenBitfieldUnit::new(
689          new_jsjitinfo_bitfield_1!(
690              JSJitInfo_OpType::Method as u8,
691              JSJitInfo_AliasSet::AliasEverything as u8,
692              JSValueType::JSVAL_TYPE_OBJECT as u8,
693              false,
694              false,
695              false,
696              false,
697              false,
698              true,
699              0,
700          ).to_ne_bytes()
701      ),
702  },
703        argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
704    });
705}
706
707unsafe extern "C" fn values<D: DomTypes>
708(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
709    let mut result = false;
710    wrap_panic(&mut || result = (|| {
711        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
712        let this = &*(this as *const D::FormData);
713        let args = &*args;
714        let argc = args.argc_;
715        let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
716        let result = IterableIterator::new(this, IteratorType::Values, InRealm::already(&realm));
717
718
719        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
720        return true;
721    })());
722    result
723}
724
725const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
726static values_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
727
728pub(crate) fn init_values_methodinfo<D: DomTypes>() {
729    values_methodinfo.set(JSTypedMethodJitInfo {
730        base:   JSJitInfo {
731      __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
732          method: Some(values::<D>)
733      },
734      __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
735          protoID: PrototypeList::ID::FormData as u16,
736      },
737      __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
738      _bitfield_align_1: [],
739      _bitfield_1: __BindgenBitfieldUnit::new(
740          new_jsjitinfo_bitfield_1!(
741              JSJitInfo_OpType::Method as u8,
742              JSJitInfo_AliasSet::AliasEverything as u8,
743              JSValueType::JSVAL_TYPE_OBJECT as u8,
744              false,
745              false,
746              false,
747              false,
748              false,
749              true,
750              0,
751          ).to_ne_bytes()
752      ),
753  },
754        argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
755    });
756}
757
758unsafe extern "C" fn forEach<D: DomTypes>
759(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
760    let mut result = false;
761    wrap_panic(&mut || result = (|| {
762        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
763        let this = &*(this as *const D::FormData);
764        let args = &*args;
765        let argc = args.argc_;
766
767        if argc < 1 {
768            throw_type_error(cx.raw_cx(), "Not enough arguments to \"FormData.forEach\".");
769            return false;
770        }
771        let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
772            HandleValue::from_raw(args.get(0)).get().to_object()
773        } else {
774            throw_type_error(cx.raw_cx(), "Value is not an object.");
775            return false;
776
777        };
778        let arg1: HandleValue = if args.get(1).is_undefined() {
779            HandleValue::undefined()
780        } else {
781            HandleValue::from_raw(args.get(1))
782        };
783        if !IsCallable(arg0) {
784          throw_type_error(cx.raw_cx(), "Argument 1 of FormData.forEach is not callable.");
785          return false;
786        }
787        rooted!(&in(cx) let arg0 = ObjectValue(arg0));
788        rooted!(&in(cx) let mut call_arg1 = UndefinedValue());
789        rooted!(&in(cx) let mut call_arg2 = UndefinedValue());
790        rooted_vec!(let mut call_args);
791        call_args.push(UndefinedValue());
792        call_args.push(UndefinedValue());
793        call_args.push(ObjectValue(*_obj));
794        rooted!(&in(cx) let mut ignoredReturnVal = UndefinedValue());
795
796        // This has to be a while loop since get_iterable_length() may change during
797        // the callback, and we need to avoid iterator invalidation.
798        //
799        // It is possible for this to loop infinitely, but that matches the spec
800        // and other browsers.
801        //
802        // https://heycam.github.io/webidl/#es-forEach
803        let mut i = 0;
804        while i < (*this).get_iterable_length() {
805          (*this).get_value_at_index(i).to_jsval(cx.raw_cx(), call_arg1.handle_mut());
806          (*this).get_key_at_index(i).to_jsval(cx.raw_cx(), call_arg2.handle_mut());
807          call_args[0] = call_arg1.handle().get();
808          call_args[1] = call_arg2.handle().get();
809          let call_args_handle = HandleValueArray::from(&call_args);
810          if !Call(cx.raw_cx(), arg1, arg0.handle(), &call_args_handle,
811                   ignoredReturnVal.handle_mut()) {
812            return false;
813          }
814
815          i += 1;
816        }
817
818        let result = ();
819
820
821        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
822        return true;
823    })());
824    result
825}
826
827
828static forEach_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
829
830pub(crate) fn init_forEach_methodinfo<D: DomTypes>() {
831    forEach_methodinfo.set(JSJitInfo {
832    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
833        method: Some(forEach::<D>)
834    },
835    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
836        protoID: PrototypeList::ID::FormData as u16,
837    },
838    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
839    _bitfield_align_1: [],
840    _bitfield_1: __BindgenBitfieldUnit::new(
841        new_jsjitinfo_bitfield_1!(
842            JSJitInfo_OpType::Method as u8,
843            JSJitInfo_AliasSet::AliasEverything as u8,
844            JSValueType::JSVAL_TYPE_UNDEFINED as u8,
845            false,
846            false,
847            false,
848            false,
849            false,
850            false,
851            0,
852        ).to_ne_bytes()
853    ),
854});
855}
856unsafe extern "C" fn _finalize<D: DomTypes>
857(_cx: *mut GCContext, obj: *mut JSObject){
858    wrap_panic(&mut || {
859
860        let this = native_from_object_static::<D::FormData>(obj).unwrap();
861        finalize_common(this);
862    })
863}
864
865unsafe extern "C" fn _trace<D: DomTypes>
866(trc: *mut JSTracer, obj: *mut JSObject){
867    wrap_panic(&mut || {
868
869        let this = native_from_object_static::<D::FormData>(obj).unwrap();
870        if this.is_null() { return; } // GC during obj creation
871        (*this).trace(trc);
872    })
873}
874
875
876static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
877
878pub(crate) fn init_class_ops<D: DomTypes>() {
879    CLASS_OPS.set(JSClassOps {
880        addProperty: None,
881        delProperty: None,
882        enumerate: None,
883        newEnumerate: None,
884        resolve: None,
885        mayResolve: None,
886        finalize: Some(_finalize::<D>),
887        call: None,
888        construct: None,
889        trace: Some(_trace::<D>),
890    });
891}
892
893pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
894
895pub(crate) fn init_domjs_class<D: DomTypes>() {
896    init_class_ops::<D>();
897    Class.set(DOMJSClass {
898        base: JSClass {
899            name: c"FormData".as_ptr(),
900            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
901                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
902                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
903            cOps: unsafe { CLASS_OPS.get() },
904            spec: ptr::null(),
905            ext: ptr::null(),
906            oOps: ptr::null(),
907        },
908        dom_class:
909DOMClass {
910    interface_chain: [ PrototypeList::ID::FormData, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
911    depth: 0,
912    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
913    malloc_size_of: malloc_size_of_including_raw_self::<D::FormData> as unsafe fn(&mut _, _) -> _,
914    global: Globals::EMPTY,
915},
916    });
917}
918
919#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
920(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::FormData>, _can_gc: CanGc) -> DomRoot<D::FormData>{
921
922    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
923
924    let scope = scope.reflector().get_jsobject();
925    assert!(!scope.get().is_null());
926    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
927    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
928
929    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
930    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
931    assert!(!canonical_proto.is_null());
932
933
934    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
935    if let Some(given) = given_proto {
936        proto.set(*given);
937        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
938            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
939        }
940    } else {
941        proto.set(*canonical_proto);
942    }
943    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
944        cx.raw_cx(),
945        &Class.get().base,
946        proto.handle(),
947    ));
948    assert!(!obj.is_null());
949    JS_SetReservedSlot(
950        obj.get(),
951        DOM_OBJECT_SLOT,
952        &PrivateValue(raw.as_ptr() as *const libc::c_void),
953    );
954
955    let root = raw.reflect_with(obj.get());
956
957
958
959    DomRoot::from_ref(&*root)
960}
961
962pub trait FormDataMethods<D: DomTypes> {
963    fn Append(&self, r#name: USVString, r#value: USVString);
964    fn Append_(&self, r#name: USVString, r#value: &D::Blob, r#filename: Option<USVString>);
965    fn Delete(&self, r#name: USVString);
966    fn Get(&self, r#name: USVString) -> Option<GenericUnionTypes::FileOrUSVString::<D>>;
967    fn GetAll(&self, r#name: USVString) -> Vec<GenericUnionTypes::FileOrUSVString::<D>>;
968    fn Has(&self, r#name: USVString) -> bool;
969    fn Set(&self, r#name: USVString, r#value: USVString);
970    fn Set_(&self, r#name: USVString, r#value: &D::Blob, r#filename: Option<USVString>);
971    fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#form: Option<&D::HTMLFormElement>, r#submitter: Option<&D::HTMLElement>) -> Fallible<DomRoot<D::FormData>>;
972}
973static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
974
975pub(crate) fn init_sMethods_specs<D: DomTypes>() {
976    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
977    JSFunctionSpec {
978        name: JSPropertySpec_Name { string_: c"append".as_ptr() },
979        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { append_methodinfo.get() } as *const _ as *const JSJitInfo },
980        nargs: 2,
981        flags: (JSPROP_ENUMERATE) as u16,
982        selfHostedName: ptr::null()
983    },
984    JSFunctionSpec {
985        name: JSPropertySpec_Name { string_: c"delete".as_ptr() },
986        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { delete_methodinfo.get() } as *const _ as *const JSJitInfo },
987        nargs: 1,
988        flags: (JSPROP_ENUMERATE) as u16,
989        selfHostedName: ptr::null()
990    },
991    JSFunctionSpec {
992        name: JSPropertySpec_Name { string_: c"get".as_ptr() },
993        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { get_methodinfo.get() } as *const _ as *const JSJitInfo },
994        nargs: 1,
995        flags: (JSPROP_ENUMERATE) as u16,
996        selfHostedName: ptr::null()
997    },
998    JSFunctionSpec {
999        name: JSPropertySpec_Name { string_: c"getAll".as_ptr() },
1000        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getAll_methodinfo.get() } as *const _ as *const JSJitInfo },
1001        nargs: 1,
1002        flags: (JSPROP_ENUMERATE) as u16,
1003        selfHostedName: ptr::null()
1004    },
1005    JSFunctionSpec {
1006        name: JSPropertySpec_Name { string_: c"has".as_ptr() },
1007        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
1008        nargs: 1,
1009        flags: (JSPROP_ENUMERATE) as u16,
1010        selfHostedName: ptr::null()
1011    },
1012    JSFunctionSpec {
1013        name: JSPropertySpec_Name { string_: c"set".as_ptr() },
1014        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { set_methodinfo.get() } as *const _ as *const JSJitInfo },
1015        nargs: 2,
1016        flags: (JSPROP_ENUMERATE) as u16,
1017        selfHostedName: ptr::null()
1018    },
1019    JSFunctionSpec {
1020        name: JSPropertySpec_Name { string_: c"entries".as_ptr() },
1021        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { entries_methodinfo.get() } as *const _ as *const JSJitInfo },
1022        nargs: 0,
1023        flags: (JSPROP_ENUMERATE) as u16,
1024        selfHostedName: ptr::null()
1025    },
1026    JSFunctionSpec {
1027        name: JSPropertySpec_Name { string_: c"keys".as_ptr() },
1028        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { keys_methodinfo.get() } as *const _ as *const JSJitInfo },
1029        nargs: 0,
1030        flags: (JSPROP_ENUMERATE) as u16,
1031        selfHostedName: ptr::null()
1032    },
1033    JSFunctionSpec {
1034        name: JSPropertySpec_Name { string_: c"values".as_ptr() },
1035        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { values_methodinfo.get() } as *const _ as *const JSJitInfo },
1036        nargs: 0,
1037        flags: (JSPROP_ENUMERATE) as u16,
1038        selfHostedName: ptr::null()
1039    },
1040    JSFunctionSpec {
1041        name: JSPropertySpec_Name { string_: c"forEach".as_ptr() },
1042        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { forEach_methodinfo.get() } as *const _ as *const JSJitInfo },
1043        nargs: 1,
1044        flags: (JSPROP_ENUMERATE) as u16,
1045        selfHostedName: ptr::null()
1046    },
1047    JSFunctionSpec {
1048        name: JSPropertySpec_Name { string_: ptr::null() },
1049        call: JSNativeWrapper { op: None, info: ptr::null() },
1050        nargs: 0,
1051        flags: 0,
1052        selfHostedName: ptr::null()
1053    }]))[..]
1054])));
1055}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1056
1057pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1058    sMethods.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
1059}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1060
1061pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1062    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1063    JSPropertySpec {
1064                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1065                    attributes_: (JSPROP_READONLY),
1066                    kind_: (JSPropertySpec_Kind::Value),
1067                    u: JSPropertySpec_AccessorsOrValue {
1068                        value: JSPropertySpec_ValueWrapper {
1069                            type_: JSPropertySpec_ValueWrapper_Type::String,
1070                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1071                                string: c"FormData".as_ptr(),
1072                            }
1073                        }
1074                    }
1075                }
1076,
1077    JSPropertySpec::ZERO]))[..]
1078])));
1079}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1080
1081pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1082    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
1083}
1084pub fn GetProtoObject<D: DomTypes>
1085(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1086    /* Get the interface prototype object for this class.  This will create the
1087       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::FormData), CreateInterfaceObjects::<D>, rval)
1088}
1089
1090
1091static PrototypeClass: JSClass = JSClass {
1092    name: c"FormDataPrototype".as_ptr(),
1093    flags:
1094        // JSCLASS_HAS_RESERVED_SLOTS()
1095        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1096    cOps: ptr::null(),
1097    spec: ptr::null(),
1098    ext: ptr::null(),
1099    oOps: ptr::null(),
1100};
1101
1102unsafe extern "C" fn _constructor<D: DomTypes>
1103(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
1104    let mut result = false;
1105    wrap_panic(&mut || result = {
1106        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1107        let args = CallArgs::from_vp(vp, argc);
1108        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
1109
1110                    call_default_constructor::<D>(
1111                        SafeJSContext::from_ptr(cx.raw_cx()),
1112                        &args,
1113                        &global,
1114                        PrototypeList::ID::FormData,
1115                        "FormData",
1116                        CreateInterfaceObjects::<D>,
1117                        |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
1118                            let arg0: Option<DomRoot<D::HTMLFormElement>> = if args.get(0).is_undefined() {
1119            None
1120        } else {
1121            Some(if HandleValue::from_raw(args.get(0)).get().is_object() {
1122                match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
1123                    Ok(val) => val,
1124                    Err(()) => {
1125                        throw_type_error(cx.raw_cx(), "value does not implement interface HTMLFormElement.");
1126                        return false;
1127
1128                    }
1129                }
1130
1131            } else {
1132                throw_type_error(cx.raw_cx(), "Value is not an object.");
1133                return false;
1134
1135            })
1136        };
1137        let arg1: Option<DomRoot<D::HTMLElement>> = if args.get(1).is_undefined() {
1138            None
1139        } else if HandleValue::from_raw(args.get(1)).get().is_object() {
1140            Some(match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
1141                Ok(val) => val,
1142                Err(()) => {
1143                    throw_type_error(cx.raw_cx(), "value does not implement interface HTMLElement.");
1144                    return false;
1145
1146                }
1147            }
1148            )
1149        } else if HandleValue::from_raw(args.get(1)).get().is_null_or_undefined() {
1150            None
1151        } else {
1152            throw_type_error(cx.raw_cx(), "Value is not an object.");
1153            return false;
1154
1155        };
1156        let result: Result<DomRoot<D::FormData>, Error> = <D::FormData>::Constructor(global, Some(desired_proto), CanGc::note(), arg0.as_deref(), arg1.as_deref());
1157        let result = match result {
1158            Ok(result) => result,
1159            Err(e) => {
1160                <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1161                return false;
1162            },
1163        };
1164
1165        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1166        return true;
1167                        }
1168                    )
1169
1170    });
1171    result
1172}
1173
1174
1175static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
1176
1177pub(crate) fn init_interface_object<D: DomTypes>() {
1178    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
1179        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
1180        b"function FormData() {\n    [native code]\n}",
1181        PrototypeList::ID::FormData,
1182        0,
1183    ));
1184}
1185
1186pub fn DefineDOMInterface<D: DomTypes>
1187(cx: SafeJSContext, global: HandleObject){
1188    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::FormData),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
1189}
1190
1191pub fn ConstructorEnabled<D: DomTypes>
1192(aCx: SafeJSContext, aObj: HandleObject) -> bool{
1193    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW)
1194}
1195
1196unsafe fn CreateInterfaceObjects<D: DomTypes>
1197(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1198
1199    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1200    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
1201    assert!(!prototype_proto.is_null());
1202
1203    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1204    create_interface_prototype_object::<D>(cx,
1205                                      global,
1206                                      prototype_proto.handle(),
1207                                      &PrototypeClass,
1208                                      sMethods.get(),
1209                                      sAttributes.get(),
1210                                      &[],
1211                                      &[],
1212                                      prototype.handle_mut());
1213    assert!(!prototype.is_null());
1214    assert!((*cache)[PrototypeList::ID::FormData as usize].is_null());
1215    (*cache)[PrototypeList::ID::FormData as usize] = prototype.get();
1216    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::FormData as isize),
1217                                  ptr::null_mut(),
1218                                  prototype.get());
1219
1220    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
1221    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
1222
1223    assert!(!interface_proto.is_null());
1224
1225    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
1226    create_noncallback_interface_object::<D>(cx,
1227                                        global,
1228                                        interface_proto.handle(),
1229                                        INTERFACE_OBJECT_CLASS.get(),
1230                                        &[],
1231                                        &[],
1232                                        &[],
1233                                        prototype.handle(),
1234                                        c"FormData",
1235                                        0,
1236                                        &[],
1237                                        interface.handle_mut());
1238    assert!(!interface.is_null());
1239    // Set up aliases on the interface prototype object we just created.
1240
1241    rooted!(&in(cx) let mut aliasedVal = UndefinedValue());
1242
1243    assert!(JS_GetProperty(cx.raw_cx(), prototype.handle(),
1244                           c"entries".as_ptr() as *const u8 as *const _,
1245                           aliasedVal.handle_mut()));
1246    rooted!(&in(cx) let mut iteratorId: jsid);
1247    RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(cx.raw_cx(), SymbolCode::iterator),                                   iteratorId.handle_mut());
1248
1249    assert!(JS_DefinePropertyById2(cx.raw_cx(), prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
1250
1251}
1252
1253
1254        pub(crate) fn init_statics<D: DomTypes>() {
1255            init_interface_object::<D>();
1256            init_domjs_class::<D>();
1257            crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_append_methodinfo::<D>();
1258crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_delete_methodinfo::<D>();
1259crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_get_methodinfo::<D>();
1260crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_getAll_methodinfo::<D>();
1261crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_has_methodinfo::<D>();
1262crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_set_methodinfo::<D>();
1263crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_entries_methodinfo::<D>();
1264crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_keys_methodinfo::<D>();
1265crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_values_methodinfo::<D>();
1266crate::codegen::GenericBindings::FormDataBinding::FormData_Binding::init_forEach_methodinfo::<D>();
1267
1268
1269
1270            init_sMethods_specs::<D>();
1271init_sMethods_prefs::<D>();
1272init_sAttributes_specs::<D>();
1273init_sAttributes_prefs::<D>();
1274        }
1275        } // mod FormData_Binding
1276
1277
1278pub use self::FormDataIterator_Binding::{Wrap as FormDataIteratorWrap, FormDataIteratorMethods, GetProtoObject as FormDataIteratorGetProtoObject};
1279pub mod FormDataIterator_Binding {
1280use crate::import::module::*;
1281
1282unsafe extern "C" fn next<D: DomTypes>
1283(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
1284    let mut result = false;
1285    wrap_panic(&mut || result = (|| {
1286        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1287        let this = &*(this as *const IterableIterator<D, D::FormData>);
1288        let args = &*args;
1289        let argc = args.argc_;
1290        let result: Result<NonNull<JSObject>, Error> = this.Next(SafeJSContext::from_ptr(cx.raw_cx()));
1291        let result = match result {
1292            Ok(result) => result,
1293            Err(e) => {
1294                <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());
1295                return false;
1296            },
1297        };
1298
1299        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1300        return true;
1301    })());
1302    result
1303}
1304
1305
1306static next_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1307
1308pub(crate) fn init_next_methodinfo<D: DomTypes>() {
1309    next_methodinfo.set(JSJitInfo {
1310    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1311        method: Some(next::<D>)
1312    },
1313    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1314        protoID: PrototypeList::ID::FormDataIterator as u16,
1315    },
1316    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1317    _bitfield_align_1: [],
1318    _bitfield_1: __BindgenBitfieldUnit::new(
1319        new_jsjitinfo_bitfield_1!(
1320            JSJitInfo_OpType::Method as u8,
1321            JSJitInfo_AliasSet::AliasEverything as u8,
1322            JSValueType::JSVAL_TYPE_OBJECT as u8,
1323            false,
1324            false,
1325            false,
1326            false,
1327            false,
1328            false,
1329            0,
1330        ).to_ne_bytes()
1331    ),
1332});
1333}
1334unsafe extern "C" fn _finalize<D: DomTypes>
1335(_cx: *mut GCContext, obj: *mut JSObject){
1336    wrap_panic(&mut || {
1337
1338        let this = native_from_object_static::<IterableIterator<D, D::FormData>>(obj).unwrap();
1339        finalize_common(this);
1340    })
1341}
1342
1343unsafe extern "C" fn _trace<D: DomTypes>
1344(trc: *mut JSTracer, obj: *mut JSObject){
1345    wrap_panic(&mut || {
1346
1347        let this = native_from_object_static::<IterableIterator<D, D::FormData>>(obj).unwrap();
1348        if this.is_null() { return; } // GC during obj creation
1349        (*this).trace(trc);
1350    })
1351}
1352
1353
1354static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1355
1356pub(crate) fn init_class_ops<D: DomTypes>() {
1357    CLASS_OPS.set(JSClassOps {
1358        addProperty: None,
1359        delProperty: None,
1360        enumerate: None,
1361        newEnumerate: None,
1362        resolve: None,
1363        mayResolve: None,
1364        finalize: Some(_finalize::<D>),
1365        call: None,
1366        construct: None,
1367        trace: Some(_trace::<D>),
1368    });
1369}
1370
1371pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1372
1373pub(crate) fn init_domjs_class<D: DomTypes>() {
1374    init_class_ops::<D>();
1375    Class.set(DOMJSClass {
1376        base: JSClass {
1377            name: c"FormDataIterator".as_ptr(),
1378            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1379                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1380                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
1381            cOps: unsafe { CLASS_OPS.get() },
1382            spec: ptr::null(),
1383            ext: ptr::null(),
1384            oOps: ptr::null(),
1385        },
1386        dom_class:
1387DOMClass {
1388    interface_chain: [ PrototypeList::ID::FormDataIterator, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1389    depth: 0,
1390    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
1391    malloc_size_of: malloc_size_of_including_raw_self::<IterableIterator<D, D::FormData>> as unsafe fn(&mut _, _) -> _,
1392    global: Globals::EMPTY,
1393},
1394    });
1395}
1396
1397#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1398(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<IterableIterator<D, D::FormData>>, _can_gc: CanGc) -> DomRoot<IterableIterator<D, D::FormData>>{
1399
1400    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1401
1402    let scope = scope.reflector().get_jsobject();
1403    assert!(!scope.get().is_null());
1404    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1405    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1406
1407    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1408    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1409    assert!(!canonical_proto.is_null());
1410
1411
1412    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1413    if let Some(given) = given_proto {
1414        proto.set(*given);
1415        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1416            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1417        }
1418    } else {
1419        proto.set(*canonical_proto);
1420    }
1421    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1422        cx.raw_cx(),
1423        &Class.get().base,
1424        proto.handle(),
1425    ));
1426    assert!(!obj.is_null());
1427    JS_SetReservedSlot(
1428        obj.get(),
1429        DOM_OBJECT_SLOT,
1430        &PrivateValue(raw.as_ptr() as *const libc::c_void),
1431    );
1432
1433    let root = raw.reflect_with(obj.get());
1434
1435
1436
1437    DomRoot::from_ref(&*root)
1438}
1439
1440pub trait FormDataIteratorMethods<D: DomTypes> {
1441    fn Next(&self, r#cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
1442}
1443static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1444
1445pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1446    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1447    JSFunctionSpec {
1448        name: JSPropertySpec_Name { string_: c"next".as_ptr() },
1449        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { next_methodinfo.get() } as *const _ as *const JSJitInfo },
1450        nargs: 0,
1451        flags: (JSPROP_ENUMERATE) as u16,
1452        selfHostedName: ptr::null()
1453    },
1454    JSFunctionSpec {
1455        name: JSPropertySpec_Name { string_: ptr::null() },
1456        call: JSNativeWrapper { op: None, info: ptr::null() },
1457        nargs: 0,
1458        flags: 0,
1459        selfHostedName: ptr::null()
1460    }]))[..]
1461])));
1462}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1463
1464pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1465    sMethods.set(Box::leak(Box::new([    Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
1466}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1467
1468pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1469    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1470    JSPropertySpec {
1471                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1472                    attributes_: (JSPROP_READONLY),
1473                    kind_: (JSPropertySpec_Kind::Value),
1474                    u: JSPropertySpec_AccessorsOrValue {
1475                        value: JSPropertySpec_ValueWrapper {
1476                            type_: JSPropertySpec_ValueWrapper_Type::String,
1477                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1478                                string: c"FormData Iterator".as_ptr(),
1479                            }
1480                        }
1481                    }
1482                }
1483,
1484    JSPropertySpec::ZERO]))[..]
1485])));
1486}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1487
1488pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1489    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
1490}
1491pub fn GetProtoObject<D: DomTypes>
1492(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1493    /* Get the interface prototype object for this class.  This will create the
1494       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::FormDataIterator), CreateInterfaceObjects::<D>, rval)
1495}
1496
1497
1498static PrototypeClass: JSClass = JSClass {
1499    name: c"FormDataIteratorPrototype".as_ptr(),
1500    flags:
1501        // JSCLASS_HAS_RESERVED_SLOTS()
1502        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1503    cOps: ptr::null(),
1504    spec: ptr::null(),
1505    ext: ptr::null(),
1506    oOps: ptr::null(),
1507};
1508
1509unsafe fn CreateInterfaceObjects<D: DomTypes>
1510(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
1511
1512    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
1513    prototype_proto.set(GetRealmIteratorPrototype(cx.raw_cx()));
1514    assert!(!prototype_proto.is_null());
1515
1516    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
1517    create_interface_prototype_object::<D>(cx,
1518                                      global,
1519                                      prototype_proto.handle(),
1520                                      &PrototypeClass,
1521                                      sMethods.get(),
1522                                      sAttributes.get(),
1523                                      &[],
1524                                      &[],
1525                                      prototype.handle_mut());
1526    assert!(!prototype.is_null());
1527    assert!((*cache)[PrototypeList::ID::FormDataIterator as usize].is_null());
1528    (*cache)[PrototypeList::ID::FormDataIterator as usize] = prototype.get();
1529    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::FormDataIterator as isize),
1530                                  ptr::null_mut(),
1531                                  prototype.get());
1532
1533}
1534
1535
1536        pub(crate) fn init_statics<D: DomTypes>() {
1537
1538            init_domjs_class::<D>();
1539            crate::codegen::GenericBindings::FormDataBinding::FormDataIterator_Binding::init_next_methodinfo::<D>();
1540
1541
1542
1543            init_sMethods_specs::<D>();
1544init_sMethods_prefs::<D>();
1545init_sAttributes_specs::<D>();
1546init_sAttributes_prefs::<D>();
1547        }
1548        } // mod FormDataIterator_Binding
1549
1550