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