script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
URLPatternBinding.rs

1/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
2
3#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
6use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
7use crate::import::base::*;
8use crate::record::Record;
9
10pub use self::GenericUnionTypes::USVStringOrURLPatternInit as URLPatternInput;
11
12#[derive(JSTraceable, Clone)]
13pub struct URLPatternInit {
14    pub baseURL: Option<USVString>,
15    pub hash: Option<USVString>,
16    pub hostname: Option<USVString>,
17    pub password: Option<USVString>,
18    pub pathname: Option<USVString>,
19    pub port: Option<USVString>,
20    pub protocol: Option<USVString>,
21    pub search: Option<USVString>,
22    pub username: Option<USVString>,
23}
24impl Default for URLPatternInit {
25    fn default() -> Self {
26        Self::empty()
27    }
28}
29
30impl URLPatternInit {
31    pub fn empty() -> Self {
32        Self {
33                baseURL: None,
34                hash: None,
35                hostname: None,
36                password: None,
37                pathname: None,
38                port: None,
39                protocol: None,
40                search: None,
41                username: None,
42        }
43    }
44    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
45                      -> Result<ConversionResult<URLPatternInit>, ()> {
46        unsafe {
47            let object = if val.get().is_null_or_undefined() {
48                ptr::null_mut()
49            } else if val.get().is_object() {
50                val.get().to_object()
51            } else {
52                return Ok(ConversionResult::Failure("Value is not an object.".into()));
53            };
54            rooted!(&in(cx) let object = object);
55        let dictionary = URLPatternInit {
56                baseURL: {
57                    rooted!(&in(cx) let mut rval = UndefinedValue());
58                    if get_dictionary_property(cx.raw_cx(), object.handle(), "baseURL", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
59                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
60                                Ok(ConversionResult::Success(value)) => value,
61                                Ok(ConversionResult::Failure(error)) => {
62                                    throw_type_error(cx.raw_cx(), &error);
63                            return Err(());
64
65                                }
66                                _ => {
67                                    return Err(());
68
69                                },
70                            }
71                            )
72                    } else {
73                            None
74                    }
75                },
76                hash: {
77                    rooted!(&in(cx) let mut rval = UndefinedValue());
78                    if get_dictionary_property(cx.raw_cx(), object.handle(), "hash", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
79                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
80                                Ok(ConversionResult::Success(value)) => value,
81                                Ok(ConversionResult::Failure(error)) => {
82                                    throw_type_error(cx.raw_cx(), &error);
83                            return Err(());
84
85                                }
86                                _ => {
87                                    return Err(());
88
89                                },
90                            }
91                            )
92                    } else {
93                            None
94                    }
95                },
96                hostname: {
97                    rooted!(&in(cx) let mut rval = UndefinedValue());
98                    if get_dictionary_property(cx.raw_cx(), object.handle(), "hostname", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
99                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
100                                Ok(ConversionResult::Success(value)) => value,
101                                Ok(ConversionResult::Failure(error)) => {
102                                    throw_type_error(cx.raw_cx(), &error);
103                            return Err(());
104
105                                }
106                                _ => {
107                                    return Err(());
108
109                                },
110                            }
111                            )
112                    } else {
113                            None
114                    }
115                },
116                password: {
117                    rooted!(&in(cx) let mut rval = UndefinedValue());
118                    if get_dictionary_property(cx.raw_cx(), object.handle(), "password", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
119                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
120                                Ok(ConversionResult::Success(value)) => value,
121                                Ok(ConversionResult::Failure(error)) => {
122                                    throw_type_error(cx.raw_cx(), &error);
123                            return Err(());
124
125                                }
126                                _ => {
127                                    return Err(());
128
129                                },
130                            }
131                            )
132                    } else {
133                            None
134                    }
135                },
136                pathname: {
137                    rooted!(&in(cx) let mut rval = UndefinedValue());
138                    if get_dictionary_property(cx.raw_cx(), object.handle(), "pathname", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
139                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
140                                Ok(ConversionResult::Success(value)) => value,
141                                Ok(ConversionResult::Failure(error)) => {
142                                    throw_type_error(cx.raw_cx(), &error);
143                            return Err(());
144
145                                }
146                                _ => {
147                                    return Err(());
148
149                                },
150                            }
151                            )
152                    } else {
153                            None
154                    }
155                },
156                port: {
157                    rooted!(&in(cx) let mut rval = UndefinedValue());
158                    if get_dictionary_property(cx.raw_cx(), object.handle(), "port", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
159                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
160                                Ok(ConversionResult::Success(value)) => value,
161                                Ok(ConversionResult::Failure(error)) => {
162                                    throw_type_error(cx.raw_cx(), &error);
163                            return Err(());
164
165                                }
166                                _ => {
167                                    return Err(());
168
169                                },
170                            }
171                            )
172                    } else {
173                            None
174                    }
175                },
176                protocol: {
177                    rooted!(&in(cx) let mut rval = UndefinedValue());
178                    if get_dictionary_property(cx.raw_cx(), object.handle(), "protocol", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
179                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
180                                Ok(ConversionResult::Success(value)) => value,
181                                Ok(ConversionResult::Failure(error)) => {
182                                    throw_type_error(cx.raw_cx(), &error);
183                            return Err(());
184
185                                }
186                                _ => {
187                                    return Err(());
188
189                                },
190                            }
191                            )
192                    } else {
193                            None
194                    }
195                },
196                search: {
197                    rooted!(&in(cx) let mut rval = UndefinedValue());
198                    if get_dictionary_property(cx.raw_cx(), object.handle(), "search", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
199                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
200                                Ok(ConversionResult::Success(value)) => value,
201                                Ok(ConversionResult::Failure(error)) => {
202                                    throw_type_error(cx.raw_cx(), &error);
203                            return Err(());
204
205                                }
206                                _ => {
207                                    return Err(());
208
209                                },
210                            }
211                            )
212                    } else {
213                            None
214                    }
215                },
216                username: {
217                    rooted!(&in(cx) let mut rval = UndefinedValue());
218                    if get_dictionary_property(cx.raw_cx(), object.handle(), "username", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
219                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
220                                Ok(ConversionResult::Success(value)) => value,
221                                Ok(ConversionResult::Failure(error)) => {
222                                    throw_type_error(cx.raw_cx(), &error);
223                            return Err(());
224
225                                }
226                                _ => {
227                                    return Err(());
228
229                                },
230                            }
231                            )
232                    } else {
233                            None
234                    }
235                },
236        };
237            Ok(ConversionResult::Success(dictionary))
238        }
239    }
240}
241
242impl FromJSValConvertible for URLPatternInit {
243    type Config = ();
244    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
245                         -> Result<ConversionResult<URLPatternInit>, ()> {
246        URLPatternInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
247    }
248}
249
250impl URLPatternInit {
251    #[allow(clippy::wrong_self_convention)]
252    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
253        if let Some(ref baseURL) = self.baseURL {
254            rooted!(in(cx) let mut baseURL_js = UndefinedValue());
255            baseURL.to_jsval(cx, baseURL_js.handle_mut());
256            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "baseURL", baseURL_js.handle()).unwrap();
257        }
258        if let Some(ref hash) = self.hash {
259            rooted!(in(cx) let mut hash_js = UndefinedValue());
260            hash.to_jsval(cx, hash_js.handle_mut());
261            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "hash", hash_js.handle()).unwrap();
262        }
263        if let Some(ref hostname) = self.hostname {
264            rooted!(in(cx) let mut hostname_js = UndefinedValue());
265            hostname.to_jsval(cx, hostname_js.handle_mut());
266            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "hostname", hostname_js.handle()).unwrap();
267        }
268        if let Some(ref password) = self.password {
269            rooted!(in(cx) let mut password_js = UndefinedValue());
270            password.to_jsval(cx, password_js.handle_mut());
271            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "password", password_js.handle()).unwrap();
272        }
273        if let Some(ref pathname) = self.pathname {
274            rooted!(in(cx) let mut pathname_js = UndefinedValue());
275            pathname.to_jsval(cx, pathname_js.handle_mut());
276            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "pathname", pathname_js.handle()).unwrap();
277        }
278        if let Some(ref port) = self.port {
279            rooted!(in(cx) let mut port_js = UndefinedValue());
280            port.to_jsval(cx, port_js.handle_mut());
281            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "port", port_js.handle()).unwrap();
282        }
283        if let Some(ref protocol) = self.protocol {
284            rooted!(in(cx) let mut protocol_js = UndefinedValue());
285            protocol.to_jsval(cx, protocol_js.handle_mut());
286            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "protocol", protocol_js.handle()).unwrap();
287        }
288        if let Some(ref search) = self.search {
289            rooted!(in(cx) let mut search_js = UndefinedValue());
290            search.to_jsval(cx, search_js.handle_mut());
291            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "search", search_js.handle()).unwrap();
292        }
293        if let Some(ref username) = self.username {
294            rooted!(in(cx) let mut username_js = UndefinedValue());
295            username.to_jsval(cx, username_js.handle_mut());
296            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "username", username_js.handle()).unwrap();
297        }
298    }
299}
300
301impl ToJSValConvertible for URLPatternInit {
302    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
303        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
304        self.to_jsobject(cx, obj.handle_mut());
305        rval.set(ObjectOrNullValue(obj.get()))
306    }
307}
308
309
310#[derive(JSTraceable)]
311pub struct URLPatternOptions {
312    pub ignoreCase: bool,
313}
314impl Default for URLPatternOptions {
315    fn default() -> Self {
316        Self::empty()
317    }
318}
319
320impl URLPatternOptions {
321    pub fn empty() -> Self {
322        Self {
323                ignoreCase: false,
324        }
325    }
326    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
327                      -> Result<ConversionResult<URLPatternOptions>, ()> {
328        unsafe {
329            let object = if val.get().is_null_or_undefined() {
330                ptr::null_mut()
331            } else if val.get().is_object() {
332                val.get().to_object()
333            } else {
334                return Ok(ConversionResult::Failure("Value is not an object.".into()));
335            };
336            rooted!(&in(cx) let object = object);
337        let dictionary = URLPatternOptions {
338                ignoreCase: {
339                    rooted!(&in(cx) let mut rval = UndefinedValue());
340                    if get_dictionary_property(cx.raw_cx(), object.handle(), "ignoreCase", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
341                            match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
342                                Ok(ConversionResult::Success(value)) => value,
343                                Ok(ConversionResult::Failure(error)) => {
344                                    throw_type_error(cx.raw_cx(), &error);
345                            return Err(());
346
347                                }
348                                _ => {
349                                    return Err(());
350
351                                },
352                            }
353
354                    } else {
355                            false
356                    }
357                },
358        };
359            Ok(ConversionResult::Success(dictionary))
360        }
361    }
362}
363
364impl FromJSValConvertible for URLPatternOptions {
365    type Config = ();
366    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
367                         -> Result<ConversionResult<URLPatternOptions>, ()> {
368        URLPatternOptions::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
369    }
370}
371
372impl URLPatternOptions {
373    #[allow(clippy::wrong_self_convention)]
374    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
375        let ignoreCase = &self.ignoreCase;
376        rooted!(in(cx) let mut ignoreCase_js = UndefinedValue());
377        ignoreCase.to_jsval(cx, ignoreCase_js.handle_mut());
378        set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "ignoreCase", ignoreCase_js.handle()).unwrap();
379    }
380}
381
382impl ToJSValConvertible for URLPatternOptions {
383    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
384        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
385        self.to_jsobject(cx, obj.handle_mut());
386        rval.set(ObjectOrNullValue(obj.get()))
387    }
388}
389
390
391#[derive(JSTraceable)]
392pub struct URLPatternResult {
393    pub hash: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
394    pub hostname: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
395    pub inputs: Option<Vec<GenericUnionTypes::USVStringOrURLPatternInit>>,
396    pub password: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
397    pub pathname: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
398    pub port: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
399    pub protocol: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
400    pub search: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
401    pub username: Option<crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult>,
402}
403impl Default for URLPatternResult {
404    fn default() -> Self {
405        Self::empty()
406    }
407}
408
409impl URLPatternResult {
410    pub fn empty() -> Self {
411        Self {
412                hash: None,
413                hostname: None,
414                inputs: None,
415                password: None,
416                pathname: None,
417                port: None,
418                protocol: None,
419                search: None,
420                username: None,
421        }
422    }
423    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
424                      -> Result<ConversionResult<URLPatternResult>, ()> {
425        unsafe {
426            let object = if val.get().is_null_or_undefined() {
427                ptr::null_mut()
428            } else if val.get().is_object() {
429                val.get().to_object()
430            } else {
431                return Ok(ConversionResult::Failure("Value is not an object.".into()));
432            };
433            rooted!(&in(cx) let object = object);
434        let dictionary = URLPatternResult {
435                hash: {
436                    rooted!(&in(cx) let mut rval = UndefinedValue());
437                    if get_dictionary_property(cx.raw_cx(), object.handle(), "hash", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
438                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
439                                Ok(ConversionResult::Success(value)) => value,
440                                Ok(ConversionResult::Failure(error)) => {
441                                    throw_type_error(cx.raw_cx(), &error);
442                            return Err(());
443
444                                }
445                                _ => {
446                                    return Err(());
447
448                                },
449                            }
450                            )
451                    } else {
452                            None
453                    }
454                },
455                hostname: {
456                    rooted!(&in(cx) let mut rval = UndefinedValue());
457                    if get_dictionary_property(cx.raw_cx(), object.handle(), "hostname", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
458                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
459                                Ok(ConversionResult::Success(value)) => value,
460                                Ok(ConversionResult::Failure(error)) => {
461                                    throw_type_error(cx.raw_cx(), &error);
462                            return Err(());
463
464                                }
465                                _ => {
466                                    return Err(());
467
468                                },
469                            }
470                            )
471                    } else {
472                            None
473                    }
474                },
475                inputs: {
476                    rooted!(&in(cx) let mut rval = UndefinedValue());
477                    if get_dictionary_property(cx.raw_cx(), object.handle(), "inputs", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
478                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
479                                Ok(ConversionResult::Success(value)) => value,
480                                Ok(ConversionResult::Failure(error)) => {
481                                    throw_type_error(cx.raw_cx(), &error);
482                            return Err(());
483
484                                }
485                                _ => {
486                                    return Err(());
487
488                                },
489                            }
490                            )
491                    } else {
492                            None
493                    }
494                },
495                password: {
496                    rooted!(&in(cx) let mut rval = UndefinedValue());
497                    if get_dictionary_property(cx.raw_cx(), object.handle(), "password", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
498                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
499                                Ok(ConversionResult::Success(value)) => value,
500                                Ok(ConversionResult::Failure(error)) => {
501                                    throw_type_error(cx.raw_cx(), &error);
502                            return Err(());
503
504                                }
505                                _ => {
506                                    return Err(());
507
508                                },
509                            }
510                            )
511                    } else {
512                            None
513                    }
514                },
515                pathname: {
516                    rooted!(&in(cx) let mut rval = UndefinedValue());
517                    if get_dictionary_property(cx.raw_cx(), object.handle(), "pathname", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
518                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
519                                Ok(ConversionResult::Success(value)) => value,
520                                Ok(ConversionResult::Failure(error)) => {
521                                    throw_type_error(cx.raw_cx(), &error);
522                            return Err(());
523
524                                }
525                                _ => {
526                                    return Err(());
527
528                                },
529                            }
530                            )
531                    } else {
532                            None
533                    }
534                },
535                port: {
536                    rooted!(&in(cx) let mut rval = UndefinedValue());
537                    if get_dictionary_property(cx.raw_cx(), object.handle(), "port", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
538                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
539                                Ok(ConversionResult::Success(value)) => value,
540                                Ok(ConversionResult::Failure(error)) => {
541                                    throw_type_error(cx.raw_cx(), &error);
542                            return Err(());
543
544                                }
545                                _ => {
546                                    return Err(());
547
548                                },
549                            }
550                            )
551                    } else {
552                            None
553                    }
554                },
555                protocol: {
556                    rooted!(&in(cx) let mut rval = UndefinedValue());
557                    if get_dictionary_property(cx.raw_cx(), object.handle(), "protocol", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
558                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
559                                Ok(ConversionResult::Success(value)) => value,
560                                Ok(ConversionResult::Failure(error)) => {
561                                    throw_type_error(cx.raw_cx(), &error);
562                            return Err(());
563
564                                }
565                                _ => {
566                                    return Err(());
567
568                                },
569                            }
570                            )
571                    } else {
572                            None
573                    }
574                },
575                search: {
576                    rooted!(&in(cx) let mut rval = UndefinedValue());
577                    if get_dictionary_property(cx.raw_cx(), object.handle(), "search", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
578                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
579                                Ok(ConversionResult::Success(value)) => value,
580                                Ok(ConversionResult::Failure(error)) => {
581                                    throw_type_error(cx.raw_cx(), &error);
582                            return Err(());
583
584                                }
585                                _ => {
586                                    return Err(());
587
588                                },
589                            }
590                            )
591                    } else {
592                            None
593                    }
594                },
595                username: {
596                    rooted!(&in(cx) let mut rval = UndefinedValue());
597                    if get_dictionary_property(cx.raw_cx(), object.handle(), "username", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
598                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
599                                Ok(ConversionResult::Success(value)) => value,
600                                Ok(ConversionResult::Failure(error)) => {
601                                    throw_type_error(cx.raw_cx(), &error);
602                            return Err(());
603
604                                }
605                                _ => {
606                                    return Err(());
607
608                                },
609                            }
610                            )
611                    } else {
612                            None
613                    }
614                },
615        };
616            Ok(ConversionResult::Success(dictionary))
617        }
618    }
619}
620
621impl FromJSValConvertible for URLPatternResult {
622    type Config = ();
623    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
624                         -> Result<ConversionResult<URLPatternResult>, ()> {
625        URLPatternResult::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
626    }
627}
628
629impl URLPatternResult {
630    #[allow(clippy::wrong_self_convention)]
631    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
632        if let Some(ref hash) = self.hash {
633            rooted!(in(cx) let mut hash_js = UndefinedValue());
634            hash.to_jsval(cx, hash_js.handle_mut());
635            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "hash", hash_js.handle()).unwrap();
636        }
637        if let Some(ref hostname) = self.hostname {
638            rooted!(in(cx) let mut hostname_js = UndefinedValue());
639            hostname.to_jsval(cx, hostname_js.handle_mut());
640            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "hostname", hostname_js.handle()).unwrap();
641        }
642        if let Some(ref inputs) = self.inputs {
643            rooted!(in(cx) let mut inputs_js = UndefinedValue());
644            inputs.to_jsval(cx, inputs_js.handle_mut());
645            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "inputs", inputs_js.handle()).unwrap();
646        }
647        if let Some(ref password) = self.password {
648            rooted!(in(cx) let mut password_js = UndefinedValue());
649            password.to_jsval(cx, password_js.handle_mut());
650            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "password", password_js.handle()).unwrap();
651        }
652        if let Some(ref pathname) = self.pathname {
653            rooted!(in(cx) let mut pathname_js = UndefinedValue());
654            pathname.to_jsval(cx, pathname_js.handle_mut());
655            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "pathname", pathname_js.handle()).unwrap();
656        }
657        if let Some(ref port) = self.port {
658            rooted!(in(cx) let mut port_js = UndefinedValue());
659            port.to_jsval(cx, port_js.handle_mut());
660            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "port", port_js.handle()).unwrap();
661        }
662        if let Some(ref protocol) = self.protocol {
663            rooted!(in(cx) let mut protocol_js = UndefinedValue());
664            protocol.to_jsval(cx, protocol_js.handle_mut());
665            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "protocol", protocol_js.handle()).unwrap();
666        }
667        if let Some(ref search) = self.search {
668            rooted!(in(cx) let mut search_js = UndefinedValue());
669            search.to_jsval(cx, search_js.handle_mut());
670            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "search", search_js.handle()).unwrap();
671        }
672        if let Some(ref username) = self.username {
673            rooted!(in(cx) let mut username_js = UndefinedValue());
674            username.to_jsval(cx, username_js.handle_mut());
675            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "username", username_js.handle()).unwrap();
676        }
677    }
678}
679
680impl ToJSValConvertible for URLPatternResult {
681    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
682        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
683        self.to_jsobject(cx, obj.handle_mut());
684        rval.set(ObjectOrNullValue(obj.get()))
685    }
686}
687
688
689#[derive(JSTraceable)]
690pub struct URLPatternComponentResult {
691    pub groups: Option<Record<USVString, GenericUnionTypes::USVStringOrUndefined>>,
692    pub input: Option<USVString>,
693}
694impl Default for URLPatternComponentResult {
695    fn default() -> Self {
696        Self::empty()
697    }
698}
699
700impl URLPatternComponentResult {
701    pub fn empty() -> Self {
702        Self {
703                groups: None,
704                input: None,
705        }
706    }
707    pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
708                      -> Result<ConversionResult<URLPatternComponentResult>, ()> {
709        unsafe {
710            let object = if val.get().is_null_or_undefined() {
711                ptr::null_mut()
712            } else if val.get().is_object() {
713                val.get().to_object()
714            } else {
715                return Ok(ConversionResult::Failure("Value is not an object.".into()));
716            };
717            rooted!(&in(cx) let object = object);
718        let dictionary = URLPatternComponentResult {
719                groups: {
720                    rooted!(&in(cx) let mut rval = UndefinedValue());
721                    if get_dictionary_property(cx.raw_cx(), object.handle(), "groups", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
722                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
723                                Ok(ConversionResult::Success(value)) => value,
724                                Ok(ConversionResult::Failure(error)) => {
725                                    throw_type_error(cx.raw_cx(), &error);
726                            return Err(());
727
728                                }
729                                _ => {
730                                    return Err(());
731
732                                },
733                            }
734                            )
735                    } else {
736                            None
737                    }
738                },
739                input: {
740                    rooted!(&in(cx) let mut rval = UndefinedValue());
741                    if get_dictionary_property(cx.raw_cx(), object.handle(), "input", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
742                            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
743                                Ok(ConversionResult::Success(value)) => value,
744                                Ok(ConversionResult::Failure(error)) => {
745                                    throw_type_error(cx.raw_cx(), &error);
746                            return Err(());
747
748                                }
749                                _ => {
750                                    return Err(());
751
752                                },
753                            }
754                            )
755                    } else {
756                            None
757                    }
758                },
759        };
760            Ok(ConversionResult::Success(dictionary))
761        }
762    }
763}
764
765impl FromJSValConvertible for URLPatternComponentResult {
766    type Config = ();
767    unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
768                         -> Result<ConversionResult<URLPatternComponentResult>, ()> {
769        URLPatternComponentResult::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
770    }
771}
772
773impl URLPatternComponentResult {
774    #[allow(clippy::wrong_self_convention)]
775    pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
776        if let Some(ref groups) = self.groups {
777            rooted!(in(cx) let mut groups_js = UndefinedValue());
778            groups.to_jsval(cx, groups_js.handle_mut());
779            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "groups", groups_js.handle()).unwrap();
780        }
781        if let Some(ref input) = self.input {
782            rooted!(in(cx) let mut input_js = UndefinedValue());
783            input.to_jsval(cx, input_js.handle_mut());
784            set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "input", input_js.handle()).unwrap();
785        }
786    }
787}
788
789impl ToJSValConvertible for URLPatternComponentResult {
790    unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
791        rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
792        self.to_jsobject(cx, obj.handle_mut());
793        rval.set(ObjectOrNullValue(obj.get()))
794    }
795}
796
797
798pub use self::URLPattern_Binding::{Wrap, URLPatternMethods, GetProtoObject, DefineDOMInterface};
799pub mod URLPattern_Binding {
800use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
801use crate::codegen::GenericBindings::URLPatternBinding::URLPatternComponentResult;
802use crate::codegen::GenericBindings::URLPatternBinding::URLPatternInit;
803use crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions;
804use crate::codegen::GenericBindings::URLPatternBinding::URLPatternResult;
805use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
806use crate::import::module::*;
807
808unsafe extern "C" fn test<D: DomTypes>
809(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
810    let mut result = false;
811    wrap_panic(&mut || result = (|| {
812        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
813        let this = &*(this as *const D::URLPattern);
814        let args = &*args;
815        let argc = args.argc_;
816        let arg0: GenericUnionTypes::USVStringOrURLPatternInit = if args.get(0).is_undefined() {
817            GenericUnionTypes::USVStringOrURLPatternInit::URLPatternInit(crate::codegen::GenericBindings::URLPatternBinding::URLPatternInit::empty())
818        } else {
819            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
820                Ok(ConversionResult::Success(value)) => value,
821                Ok(ConversionResult::Failure(error)) => {
822                    throw_type_error(cx.raw_cx(), &error);
823            return false;
824
825                }
826                _ => {
827                    return false;
828
829                },
830            }
831
832        };
833        let arg1: Option<USVString> = if args.get(1).is_undefined() {
834            None
835        } else {
836            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
837                Ok(ConversionResult::Success(value)) => value,
838                Ok(ConversionResult::Failure(error)) => {
839                    throw_type_error(cx.raw_cx(), &error);
840            return false;
841
842                }
843                _ => {
844                    return false;
845
846                },
847            }
848            )
849        };
850        let result: Result<bool, Error> = this.Test(arg0, arg1);
851        let result = match result {
852            Ok(result) => result,
853            Err(e) => {
854                <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());
855                return false;
856            },
857        };
858
859        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
860        return true;
861    })());
862    result
863}
864
865
866static test_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
867
868pub(crate) fn init_test_methodinfo<D: DomTypes>() {
869    test_methodinfo.set(JSJitInfo {
870    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
871        method: Some(test::<D>)
872    },
873    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
874        protoID: PrototypeList::ID::URLPattern as u16,
875    },
876    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
877    _bitfield_align_1: [],
878    _bitfield_1: __BindgenBitfieldUnit::new(
879        new_jsjitinfo_bitfield_1!(
880            JSJitInfo_OpType::Method as u8,
881            JSJitInfo_AliasSet::AliasEverything as u8,
882            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
883            false,
884            false,
885            false,
886            false,
887            false,
888            false,
889            0,
890        ).to_ne_bytes()
891    ),
892});
893}
894unsafe extern "C" fn exec<D: DomTypes>
895(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
896    let mut result = false;
897    wrap_panic(&mut || result = (|| {
898        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
899        let this = &*(this as *const D::URLPattern);
900        let args = &*args;
901        let argc = args.argc_;
902        let arg0: GenericUnionTypes::USVStringOrURLPatternInit = if args.get(0).is_undefined() {
903            GenericUnionTypes::USVStringOrURLPatternInit::URLPatternInit(crate::codegen::GenericBindings::URLPatternBinding::URLPatternInit::empty())
904        } else {
905            match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
906                Ok(ConversionResult::Success(value)) => value,
907                Ok(ConversionResult::Failure(error)) => {
908                    throw_type_error(cx.raw_cx(), &error);
909            return false;
910
911                }
912                _ => {
913                    return false;
914
915                },
916            }
917
918        };
919        let arg1: Option<USVString> = if args.get(1).is_undefined() {
920            None
921        } else {
922            Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
923                Ok(ConversionResult::Success(value)) => value,
924                Ok(ConversionResult::Failure(error)) => {
925                    throw_type_error(cx.raw_cx(), &error);
926            return false;
927
928                }
929                _ => {
930                    return false;
931
932                },
933            }
934            )
935        };
936        let result: Result<Option<URLPatternResult>, Error> = this.Exec(arg0, arg1);
937        let result = match result {
938            Ok(result) => result,
939            Err(e) => {
940                <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());
941                return false;
942            },
943        };
944
945        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
946        return true;
947    })());
948    result
949}
950
951
952static exec_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
953
954pub(crate) fn init_exec_methodinfo<D: DomTypes>() {
955    exec_methodinfo.set(JSJitInfo {
956    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
957        method: Some(exec::<D>)
958    },
959    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
960        protoID: PrototypeList::ID::URLPattern as u16,
961    },
962    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
963    _bitfield_align_1: [],
964    _bitfield_1: __BindgenBitfieldUnit::new(
965        new_jsjitinfo_bitfield_1!(
966            JSJitInfo_OpType::Method as u8,
967            JSJitInfo_AliasSet::AliasEverything as u8,
968            JSValueType::JSVAL_TYPE_UNKNOWN as u8,
969            false,
970            false,
971            false,
972            false,
973            false,
974            false,
975            0,
976        ).to_ne_bytes()
977    ),
978});
979}
980unsafe extern "C" fn get_protocol<D: DomTypes>
981(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
982    let mut result = false;
983    wrap_panic(&mut || result = (|| {
984        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
985        let this = &*(this as *const D::URLPattern);
986        let result: USVString = this.Protocol();
987
988        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
989        return true;
990    })());
991    result
992}
993
994
995static protocol_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
996
997pub(crate) fn init_protocol_getterinfo<D: DomTypes>() {
998    protocol_getterinfo.set(JSJitInfo {
999    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1000        getter: Some(get_protocol::<D>)
1001    },
1002    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1003        protoID: PrototypeList::ID::URLPattern as u16,
1004    },
1005    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1006    _bitfield_align_1: [],
1007    _bitfield_1: __BindgenBitfieldUnit::new(
1008        new_jsjitinfo_bitfield_1!(
1009            JSJitInfo_OpType::Getter as u8,
1010            JSJitInfo_AliasSet::AliasEverything as u8,
1011            JSValueType::JSVAL_TYPE_STRING as u8,
1012            true,
1013            false,
1014            false,
1015            false,
1016            false,
1017            false,
1018            0,
1019        ).to_ne_bytes()
1020    ),
1021});
1022}
1023unsafe extern "C" fn get_username<D: DomTypes>
1024(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1025    let mut result = false;
1026    wrap_panic(&mut || result = (|| {
1027        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1028        let this = &*(this as *const D::URLPattern);
1029        let result: USVString = this.Username();
1030
1031        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1032        return true;
1033    })());
1034    result
1035}
1036
1037
1038static username_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1039
1040pub(crate) fn init_username_getterinfo<D: DomTypes>() {
1041    username_getterinfo.set(JSJitInfo {
1042    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1043        getter: Some(get_username::<D>)
1044    },
1045    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1046        protoID: PrototypeList::ID::URLPattern as u16,
1047    },
1048    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1049    _bitfield_align_1: [],
1050    _bitfield_1: __BindgenBitfieldUnit::new(
1051        new_jsjitinfo_bitfield_1!(
1052            JSJitInfo_OpType::Getter as u8,
1053            JSJitInfo_AliasSet::AliasEverything as u8,
1054            JSValueType::JSVAL_TYPE_STRING as u8,
1055            true,
1056            false,
1057            false,
1058            false,
1059            false,
1060            false,
1061            0,
1062        ).to_ne_bytes()
1063    ),
1064});
1065}
1066unsafe extern "C" fn get_password<D: DomTypes>
1067(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1068    let mut result = false;
1069    wrap_panic(&mut || result = (|| {
1070        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1071        let this = &*(this as *const D::URLPattern);
1072        let result: USVString = this.Password();
1073
1074        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1075        return true;
1076    })());
1077    result
1078}
1079
1080
1081static password_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1082
1083pub(crate) fn init_password_getterinfo<D: DomTypes>() {
1084    password_getterinfo.set(JSJitInfo {
1085    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1086        getter: Some(get_password::<D>)
1087    },
1088    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1089        protoID: PrototypeList::ID::URLPattern as u16,
1090    },
1091    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1092    _bitfield_align_1: [],
1093    _bitfield_1: __BindgenBitfieldUnit::new(
1094        new_jsjitinfo_bitfield_1!(
1095            JSJitInfo_OpType::Getter as u8,
1096            JSJitInfo_AliasSet::AliasEverything as u8,
1097            JSValueType::JSVAL_TYPE_STRING as u8,
1098            true,
1099            false,
1100            false,
1101            false,
1102            false,
1103            false,
1104            0,
1105        ).to_ne_bytes()
1106    ),
1107});
1108}
1109unsafe extern "C" fn get_hostname<D: DomTypes>
1110(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1111    let mut result = false;
1112    wrap_panic(&mut || result = (|| {
1113        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1114        let this = &*(this as *const D::URLPattern);
1115        let result: USVString = this.Hostname();
1116
1117        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1118        return true;
1119    })());
1120    result
1121}
1122
1123
1124static hostname_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1125
1126pub(crate) fn init_hostname_getterinfo<D: DomTypes>() {
1127    hostname_getterinfo.set(JSJitInfo {
1128    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1129        getter: Some(get_hostname::<D>)
1130    },
1131    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1132        protoID: PrototypeList::ID::URLPattern as u16,
1133    },
1134    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1135    _bitfield_align_1: [],
1136    _bitfield_1: __BindgenBitfieldUnit::new(
1137        new_jsjitinfo_bitfield_1!(
1138            JSJitInfo_OpType::Getter as u8,
1139            JSJitInfo_AliasSet::AliasEverything as u8,
1140            JSValueType::JSVAL_TYPE_STRING as u8,
1141            true,
1142            false,
1143            false,
1144            false,
1145            false,
1146            false,
1147            0,
1148        ).to_ne_bytes()
1149    ),
1150});
1151}
1152unsafe extern "C" fn get_port<D: DomTypes>
1153(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1154    let mut result = false;
1155    wrap_panic(&mut || result = (|| {
1156        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1157        let this = &*(this as *const D::URLPattern);
1158        let result: USVString = this.Port();
1159
1160        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1161        return true;
1162    })());
1163    result
1164}
1165
1166
1167static port_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1168
1169pub(crate) fn init_port_getterinfo<D: DomTypes>() {
1170    port_getterinfo.set(JSJitInfo {
1171    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1172        getter: Some(get_port::<D>)
1173    },
1174    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1175        protoID: PrototypeList::ID::URLPattern as u16,
1176    },
1177    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1178    _bitfield_align_1: [],
1179    _bitfield_1: __BindgenBitfieldUnit::new(
1180        new_jsjitinfo_bitfield_1!(
1181            JSJitInfo_OpType::Getter as u8,
1182            JSJitInfo_AliasSet::AliasEverything as u8,
1183            JSValueType::JSVAL_TYPE_STRING as u8,
1184            true,
1185            false,
1186            false,
1187            false,
1188            false,
1189            false,
1190            0,
1191        ).to_ne_bytes()
1192    ),
1193});
1194}
1195unsafe extern "C" fn get_pathname<D: DomTypes>
1196(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1197    let mut result = false;
1198    wrap_panic(&mut || result = (|| {
1199        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1200        let this = &*(this as *const D::URLPattern);
1201        let result: USVString = this.Pathname();
1202
1203        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1204        return true;
1205    })());
1206    result
1207}
1208
1209
1210static pathname_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1211
1212pub(crate) fn init_pathname_getterinfo<D: DomTypes>() {
1213    pathname_getterinfo.set(JSJitInfo {
1214    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1215        getter: Some(get_pathname::<D>)
1216    },
1217    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1218        protoID: PrototypeList::ID::URLPattern as u16,
1219    },
1220    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1221    _bitfield_align_1: [],
1222    _bitfield_1: __BindgenBitfieldUnit::new(
1223        new_jsjitinfo_bitfield_1!(
1224            JSJitInfo_OpType::Getter as u8,
1225            JSJitInfo_AliasSet::AliasEverything as u8,
1226            JSValueType::JSVAL_TYPE_STRING as u8,
1227            true,
1228            false,
1229            false,
1230            false,
1231            false,
1232            false,
1233            0,
1234        ).to_ne_bytes()
1235    ),
1236});
1237}
1238unsafe extern "C" fn get_search<D: DomTypes>
1239(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1240    let mut result = false;
1241    wrap_panic(&mut || result = (|| {
1242        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1243        let this = &*(this as *const D::URLPattern);
1244        let result: USVString = this.Search();
1245
1246        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1247        return true;
1248    })());
1249    result
1250}
1251
1252
1253static search_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1254
1255pub(crate) fn init_search_getterinfo<D: DomTypes>() {
1256    search_getterinfo.set(JSJitInfo {
1257    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1258        getter: Some(get_search::<D>)
1259    },
1260    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1261        protoID: PrototypeList::ID::URLPattern as u16,
1262    },
1263    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1264    _bitfield_align_1: [],
1265    _bitfield_1: __BindgenBitfieldUnit::new(
1266        new_jsjitinfo_bitfield_1!(
1267            JSJitInfo_OpType::Getter as u8,
1268            JSJitInfo_AliasSet::AliasEverything as u8,
1269            JSValueType::JSVAL_TYPE_STRING as u8,
1270            true,
1271            false,
1272            false,
1273            false,
1274            false,
1275            false,
1276            0,
1277        ).to_ne_bytes()
1278    ),
1279});
1280}
1281unsafe extern "C" fn get_hash<D: DomTypes>
1282(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> 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 D::URLPattern);
1287        let result: USVString = this.Hash();
1288
1289        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1290        return true;
1291    })());
1292    result
1293}
1294
1295
1296static hash_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1297
1298pub(crate) fn init_hash_getterinfo<D: DomTypes>() {
1299    hash_getterinfo.set(JSJitInfo {
1300    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1301        getter: Some(get_hash::<D>)
1302    },
1303    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1304        protoID: PrototypeList::ID::URLPattern as u16,
1305    },
1306    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1307    _bitfield_align_1: [],
1308    _bitfield_1: __BindgenBitfieldUnit::new(
1309        new_jsjitinfo_bitfield_1!(
1310            JSJitInfo_OpType::Getter as u8,
1311            JSJitInfo_AliasSet::AliasEverything as u8,
1312            JSValueType::JSVAL_TYPE_STRING as u8,
1313            true,
1314            false,
1315            false,
1316            false,
1317            false,
1318            false,
1319            0,
1320        ).to_ne_bytes()
1321    ),
1322});
1323}
1324unsafe extern "C" fn get_hasRegExpGroups<D: DomTypes>
1325(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
1326    let mut result = false;
1327    wrap_panic(&mut || result = (|| {
1328        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1329        let this = &*(this as *const D::URLPattern);
1330        let result: bool = this.HasRegExpGroups();
1331
1332        (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1333        return true;
1334    })());
1335    result
1336}
1337
1338
1339static hasRegExpGroups_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
1340
1341pub(crate) fn init_hasRegExpGroups_getterinfo<D: DomTypes>() {
1342    hasRegExpGroups_getterinfo.set(JSJitInfo {
1343    __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
1344        getter: Some(get_hasRegExpGroups::<D>)
1345    },
1346    __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
1347        protoID: PrototypeList::ID::URLPattern as u16,
1348    },
1349    __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
1350    _bitfield_align_1: [],
1351    _bitfield_1: __BindgenBitfieldUnit::new(
1352        new_jsjitinfo_bitfield_1!(
1353            JSJitInfo_OpType::Getter as u8,
1354            JSJitInfo_AliasSet::AliasEverything as u8,
1355            JSValueType::JSVAL_TYPE_BOOLEAN as u8,
1356            true,
1357            false,
1358            false,
1359            false,
1360            false,
1361            false,
1362            0,
1363        ).to_ne_bytes()
1364    ),
1365});
1366}
1367unsafe extern "C" fn _finalize<D: DomTypes>
1368(_cx: *mut GCContext, obj: *mut JSObject){
1369    wrap_panic(&mut || {
1370
1371        let this = native_from_object_static::<D::URLPattern>(obj).unwrap();
1372        finalize_common(this);
1373    })
1374}
1375
1376unsafe extern "C" fn _trace<D: DomTypes>
1377(trc: *mut JSTracer, obj: *mut JSObject){
1378    wrap_panic(&mut || {
1379
1380        let this = native_from_object_static::<D::URLPattern>(obj).unwrap();
1381        if this.is_null() { return; } // GC during obj creation
1382        (*this).trace(trc);
1383    })
1384}
1385
1386
1387static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
1388
1389pub(crate) fn init_class_ops<D: DomTypes>() {
1390    CLASS_OPS.set(JSClassOps {
1391        addProperty: None,
1392        delProperty: None,
1393        enumerate: None,
1394        newEnumerate: None,
1395        resolve: None,
1396        mayResolve: None,
1397        finalize: Some(_finalize::<D>),
1398        call: None,
1399        construct: None,
1400        trace: Some(_trace::<D>),
1401    });
1402}
1403
1404pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
1405
1406pub(crate) fn init_domjs_class<D: DomTypes>() {
1407    init_class_ops::<D>();
1408    Class.set(DOMJSClass {
1409        base: JSClass {
1410            name: c"URLPattern".as_ptr(),
1411            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
1412                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
1413                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
1414            cOps: unsafe { CLASS_OPS.get() },
1415            spec: ptr::null(),
1416            ext: ptr::null(),
1417            oOps: ptr::null(),
1418        },
1419        dom_class:
1420DOMClass {
1421    interface_chain: [ PrototypeList::ID::URLPattern, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
1422    depth: 0,
1423    type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
1424    malloc_size_of: malloc_size_of_including_raw_self::<D::URLPattern> as unsafe fn(&mut _, _) -> _,
1425    global: Globals::EMPTY,
1426},
1427    });
1428}
1429
1430#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
1431(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::URLPattern>, _can_gc: CanGc) -> DomRoot<D::URLPattern>{
1432
1433    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
1434
1435    let scope = scope.reflector().get_jsobject();
1436    assert!(!scope.get().is_null());
1437    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
1438    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
1439
1440    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
1441    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
1442    assert!(!canonical_proto.is_null());
1443
1444
1445    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
1446    if let Some(given) = given_proto {
1447        proto.set(*given);
1448        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
1449            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
1450        }
1451    } else {
1452        proto.set(*canonical_proto);
1453    }
1454    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
1455        cx.raw_cx(),
1456        &Class.get().base,
1457        proto.handle(),
1458    ));
1459    assert!(!obj.is_null());
1460    JS_SetReservedSlot(
1461        obj.get(),
1462        DOM_OBJECT_SLOT,
1463        &PrivateValue(raw.as_ptr() as *const libc::c_void),
1464    );
1465
1466    let root = raw.reflect_with(obj.get());
1467
1468
1469
1470    DomRoot::from_ref(&*root)
1471}
1472
1473pub trait URLPatternMethods<D: DomTypes> {
1474    fn Test(&self, r#input: GenericUnionTypes::USVStringOrURLPatternInit, r#baseURL: Option<USVString>) -> Fallible<bool>;
1475    fn Exec(&self, r#input: GenericUnionTypes::USVStringOrURLPatternInit, r#baseURL: Option<USVString>) -> Fallible<Option<URLPatternResult>>;
1476    fn Protocol(&self, ) -> USVString;
1477    fn Username(&self, ) -> USVString;
1478    fn Password(&self, ) -> USVString;
1479    fn Hostname(&self, ) -> USVString;
1480    fn Port(&self, ) -> USVString;
1481    fn Pathname(&self, ) -> USVString;
1482    fn Search(&self, ) -> USVString;
1483    fn Hash(&self, ) -> USVString;
1484    fn HasRegExpGroups(&self, ) -> bool;
1485    fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#input: GenericUnionTypes::USVStringOrURLPatternInit, r#baseURL: USVString, r#options: &crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions) -> Fallible<DomRoot<D::URLPattern>>;
1486    fn Constructor_(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#input: GenericUnionTypes::USVStringOrURLPatternInit, r#options: &crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions) -> Fallible<DomRoot<D::URLPattern>>;
1487}
1488static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
1489
1490pub(crate) fn init_sMethods_specs<D: DomTypes>() {
1491    sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1492    JSFunctionSpec {
1493        name: JSPropertySpec_Name { string_: c"test".as_ptr() },
1494        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { test_methodinfo.get() } as *const _ as *const JSJitInfo },
1495        nargs: 0,
1496        flags: (JSPROP_ENUMERATE) as u16,
1497        selfHostedName: ptr::null()
1498    },
1499    JSFunctionSpec {
1500        name: JSPropertySpec_Name { string_: c"exec".as_ptr() },
1501        call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { exec_methodinfo.get() } as *const _ as *const JSJitInfo },
1502        nargs: 0,
1503        flags: (JSPROP_ENUMERATE) as u16,
1504        selfHostedName: ptr::null()
1505    },
1506    JSFunctionSpec {
1507        name: JSPropertySpec_Name { string_: ptr::null() },
1508        call: JSNativeWrapper { op: None, info: ptr::null() },
1509        nargs: 0,
1510        flags: 0,
1511        selfHostedName: ptr::null()
1512    }]))[..]
1513])));
1514}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
1515
1516pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
1517    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])])));
1518}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
1519
1520pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
1521    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
1522    JSPropertySpec {
1523                    name: JSPropertySpec_Name { string_: c"protocol".as_ptr() },
1524                    attributes_: (JSPROP_ENUMERATE),
1525                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1526                    u: JSPropertySpec_AccessorsOrValue {
1527                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1528                            getter: JSPropertySpec_Accessor {
1529                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { protocol_getterinfo.get() } },
1530                            },
1531                            setter: JSPropertySpec_Accessor {
1532                                native: JSNativeWrapper { op: None, info: ptr::null() },
1533                            }
1534                        }
1535                    }
1536                }
1537,
1538    JSPropertySpec {
1539                    name: JSPropertySpec_Name { string_: c"username".as_ptr() },
1540                    attributes_: (JSPROP_ENUMERATE),
1541                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1542                    u: JSPropertySpec_AccessorsOrValue {
1543                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1544                            getter: JSPropertySpec_Accessor {
1545                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { username_getterinfo.get() } },
1546                            },
1547                            setter: JSPropertySpec_Accessor {
1548                                native: JSNativeWrapper { op: None, info: ptr::null() },
1549                            }
1550                        }
1551                    }
1552                }
1553,
1554    JSPropertySpec {
1555                    name: JSPropertySpec_Name { string_: c"password".as_ptr() },
1556                    attributes_: (JSPROP_ENUMERATE),
1557                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1558                    u: JSPropertySpec_AccessorsOrValue {
1559                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1560                            getter: JSPropertySpec_Accessor {
1561                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { password_getterinfo.get() } },
1562                            },
1563                            setter: JSPropertySpec_Accessor {
1564                                native: JSNativeWrapper { op: None, info: ptr::null() },
1565                            }
1566                        }
1567                    }
1568                }
1569,
1570    JSPropertySpec {
1571                    name: JSPropertySpec_Name { string_: c"hostname".as_ptr() },
1572                    attributes_: (JSPROP_ENUMERATE),
1573                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1574                    u: JSPropertySpec_AccessorsOrValue {
1575                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1576                            getter: JSPropertySpec_Accessor {
1577                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { hostname_getterinfo.get() } },
1578                            },
1579                            setter: JSPropertySpec_Accessor {
1580                                native: JSNativeWrapper { op: None, info: ptr::null() },
1581                            }
1582                        }
1583                    }
1584                }
1585,
1586    JSPropertySpec {
1587                    name: JSPropertySpec_Name { string_: c"port".as_ptr() },
1588                    attributes_: (JSPROP_ENUMERATE),
1589                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1590                    u: JSPropertySpec_AccessorsOrValue {
1591                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1592                            getter: JSPropertySpec_Accessor {
1593                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { port_getterinfo.get() } },
1594                            },
1595                            setter: JSPropertySpec_Accessor {
1596                                native: JSNativeWrapper { op: None, info: ptr::null() },
1597                            }
1598                        }
1599                    }
1600                }
1601,
1602    JSPropertySpec {
1603                    name: JSPropertySpec_Name { string_: c"pathname".as_ptr() },
1604                    attributes_: (JSPROP_ENUMERATE),
1605                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1606                    u: JSPropertySpec_AccessorsOrValue {
1607                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1608                            getter: JSPropertySpec_Accessor {
1609                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { pathname_getterinfo.get() } },
1610                            },
1611                            setter: JSPropertySpec_Accessor {
1612                                native: JSNativeWrapper { op: None, info: ptr::null() },
1613                            }
1614                        }
1615                    }
1616                }
1617,
1618    JSPropertySpec {
1619                    name: JSPropertySpec_Name { string_: c"search".as_ptr() },
1620                    attributes_: (JSPROP_ENUMERATE),
1621                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1622                    u: JSPropertySpec_AccessorsOrValue {
1623                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1624                            getter: JSPropertySpec_Accessor {
1625                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { search_getterinfo.get() } },
1626                            },
1627                            setter: JSPropertySpec_Accessor {
1628                                native: JSNativeWrapper { op: None, info: ptr::null() },
1629                            }
1630                        }
1631                    }
1632                }
1633,
1634    JSPropertySpec {
1635                    name: JSPropertySpec_Name { string_: c"hash".as_ptr() },
1636                    attributes_: (JSPROP_ENUMERATE),
1637                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1638                    u: JSPropertySpec_AccessorsOrValue {
1639                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1640                            getter: JSPropertySpec_Accessor {
1641                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { hash_getterinfo.get() } },
1642                            },
1643                            setter: JSPropertySpec_Accessor {
1644                                native: JSNativeWrapper { op: None, info: ptr::null() },
1645                            }
1646                        }
1647                    }
1648                }
1649,
1650    JSPropertySpec {
1651                    name: JSPropertySpec_Name { string_: c"hasRegExpGroups".as_ptr() },
1652                    attributes_: (JSPROP_ENUMERATE),
1653                    kind_: (JSPropertySpec_Kind::NativeAccessor),
1654                    u: JSPropertySpec_AccessorsOrValue {
1655                        accessors: JSPropertySpec_AccessorsOrValue_Accessors {
1656                            getter: JSPropertySpec_Accessor {
1657                                native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { hasRegExpGroups_getterinfo.get() } },
1658                            },
1659                            setter: JSPropertySpec_Accessor {
1660                                native: JSNativeWrapper { op: None, info: ptr::null() },
1661                            }
1662                        }
1663                    }
1664                }
1665,
1666    JSPropertySpec::ZERO]))[..]
1667,
1668&Box::leak(Box::new([
1669    JSPropertySpec {
1670                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
1671                    attributes_: (JSPROP_READONLY),
1672                    kind_: (JSPropertySpec_Kind::Value),
1673                    u: JSPropertySpec_AccessorsOrValue {
1674                        value: JSPropertySpec_ValueWrapper {
1675                            type_: JSPropertySpec_ValueWrapper_Type::String,
1676                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
1677                                string: c"URLPattern".as_ptr(),
1678                            }
1679                        }
1680                    }
1681                }
1682,
1683    JSPropertySpec::ZERO]))[..]
1684])));
1685}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
1686
1687pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
1688    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]),
1689    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
1690}
1691pub fn GetProtoObject<D: DomTypes>
1692(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
1693    /* Get the interface prototype object for this class.  This will create the
1694       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::URLPattern), CreateInterfaceObjects::<D>, rval)
1695}
1696
1697
1698static PrototypeClass: JSClass = JSClass {
1699    name: c"URLPatternPrototype".as_ptr(),
1700    flags:
1701        // JSCLASS_HAS_RESERVED_SLOTS()
1702        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
1703    cOps: ptr::null(),
1704    spec: ptr::null(),
1705    ext: ptr::null(),
1706    oOps: ptr::null(),
1707};
1708
1709unsafe extern "C" fn _constructor<D: DomTypes>
1710(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
1711    let mut result = false;
1712    wrap_panic(&mut || result = {
1713        let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
1714        let args = CallArgs::from_vp(vp, argc);
1715        let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
1716
1717                    call_default_constructor::<D>(
1718                        SafeJSContext::from_ptr(cx.raw_cx()),
1719                        &args,
1720                        &global,
1721                        PrototypeList::ID::URLPattern,
1722                        "URLPattern",
1723                        CreateInterfaceObjects::<D>,
1724                        |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
1725
1726        let argcount = cmp::min(argc, 3);
1727        match argcount {
1728            0 => {
1729                let arg0: GenericUnionTypes::USVStringOrURLPatternInit = if args.get(0).is_undefined() {
1730                    GenericUnionTypes::USVStringOrURLPatternInit::URLPatternInit(crate::codegen::GenericBindings::URLPatternBinding::URLPatternInit::empty())
1731                } else {
1732                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1733                        Ok(ConversionResult::Success(value)) => value,
1734                        Ok(ConversionResult::Failure(error)) => {
1735                            throw_type_error(cx.raw_cx(), &error);
1736                    return false;
1737
1738                        }
1739                        _ => {
1740                            return false;
1741
1742                        },
1743                    }
1744
1745                };
1746                let arg1: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(1).is_undefined() {
1747                    crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1748                } else {
1749                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1750                        Ok(ConversionResult::Success(value)) => value,
1751                        Ok(ConversionResult::Failure(error)) => {
1752                            throw_type_error(cx.raw_cx(), &error);
1753                    return false;
1754
1755                        }
1756                        _ => {
1757                            return false;
1758
1759                        },
1760                    }
1761
1762                };
1763                let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor_(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
1764                let result = match result {
1765                    Ok(result) => result,
1766                    Err(e) => {
1767                        <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1768                        return false;
1769                    },
1770                };
1771
1772                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1773                return true;
1774            }
1775            1 => {
1776                let arg0: GenericUnionTypes::USVStringOrURLPatternInit = if args.get(0).is_undefined() {
1777                    GenericUnionTypes::USVStringOrURLPatternInit::URLPatternInit(crate::codegen::GenericBindings::URLPatternBinding::URLPatternInit::empty())
1778                } else {
1779                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1780                        Ok(ConversionResult::Success(value)) => value,
1781                        Ok(ConversionResult::Failure(error)) => {
1782                            throw_type_error(cx.raw_cx(), &error);
1783                    return false;
1784
1785                        }
1786                        _ => {
1787                            return false;
1788
1789                        },
1790                    }
1791
1792                };
1793                let arg1: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(1).is_undefined() {
1794                    crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1795                } else {
1796                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1797                        Ok(ConversionResult::Success(value)) => value,
1798                        Ok(ConversionResult::Failure(error)) => {
1799                            throw_type_error(cx.raw_cx(), &error);
1800                    return false;
1801
1802                        }
1803                        _ => {
1804                            return false;
1805
1806                        },
1807                    }
1808
1809                };
1810                let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor_(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
1811                let result = match result {
1812                    Ok(result) => result,
1813                    Err(e) => {
1814                        <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1815                        return false;
1816                    },
1817                };
1818
1819                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1820                return true;
1821            }
1822            2 => {
1823                let arg0: GenericUnionTypes::USVStringOrURLPatternInit = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1824                    Ok(ConversionResult::Success(value)) => value,
1825                    Ok(ConversionResult::Failure(error)) => {
1826                        throw_type_error(cx.raw_cx(), &error);
1827                return false;
1828
1829                    }
1830                    _ => {
1831                        return false;
1832
1833                    },
1834                }
1835                ;
1836                if HandleValue::from_raw(args.get(1)).get().is_null_or_undefined() {
1837                    let arg1: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(1).is_undefined() {
1838                        crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1839                    } else {
1840                        match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1841                            Ok(ConversionResult::Success(value)) => value,
1842                            Ok(ConversionResult::Failure(error)) => {
1843                                throw_type_error(cx.raw_cx(), &error);
1844                        return false;
1845
1846                            }
1847                            _ => {
1848                                return false;
1849
1850                            },
1851                        }
1852
1853                    };
1854                    let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor_(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
1855                    let result = match result {
1856                        Ok(result) => result,
1857                        Err(e) => {
1858                            <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1859                            return false;
1860                        },
1861                    };
1862
1863                    (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1864                    return true;
1865                }
1866                if HandleValue::from_raw(args.get(1)).get().is_object() {
1867                    let arg1: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(1).is_undefined() {
1868                        crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1869                    } else {
1870                        match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1871                            Ok(ConversionResult::Success(value)) => value,
1872                            Ok(ConversionResult::Failure(error)) => {
1873                                throw_type_error(cx.raw_cx(), &error);
1874                        return false;
1875
1876                            }
1877                            _ => {
1878                                return false;
1879
1880                            },
1881                        }
1882
1883                    };
1884                    let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor_(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
1885                    let result = match result {
1886                        Ok(result) => result,
1887                        Err(e) => {
1888                            <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1889                            return false;
1890                        },
1891                    };
1892
1893                    (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1894                    return true;
1895                }
1896                let arg1: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1897                    Ok(ConversionResult::Success(value)) => value,
1898                    Ok(ConversionResult::Failure(error)) => {
1899                        throw_type_error(cx.raw_cx(), &error);
1900                return false;
1901
1902                    }
1903                    _ => {
1904                        return false;
1905
1906                    },
1907                }
1908                ;
1909                let arg2: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(2).is_undefined() {
1910                    crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1911                } else {
1912                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
1913                        Ok(ConversionResult::Success(value)) => value,
1914                        Ok(ConversionResult::Failure(error)) => {
1915                            throw_type_error(cx.raw_cx(), &error);
1916                    return false;
1917
1918                        }
1919                        _ => {
1920                            return false;
1921
1922                        },
1923                    }
1924
1925                };
1926                let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor(global, Some(desired_proto), CanGc::note(), arg0, arg1, &arg2);
1927                let result = match result {
1928                    Ok(result) => result,
1929                    Err(e) => {
1930                        <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1931                        return false;
1932                    },
1933                };
1934
1935                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1936                return true;
1937            }
1938            3 => {
1939                let arg0: GenericUnionTypes::USVStringOrURLPatternInit = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
1940                    Ok(ConversionResult::Success(value)) => value,
1941                    Ok(ConversionResult::Failure(error)) => {
1942                        throw_type_error(cx.raw_cx(), &error);
1943                return false;
1944
1945                    }
1946                    _ => {
1947                        return false;
1948
1949                    },
1950                }
1951                ;
1952                let arg1: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
1953                    Ok(ConversionResult::Success(value)) => value,
1954                    Ok(ConversionResult::Failure(error)) => {
1955                        throw_type_error(cx.raw_cx(), &error);
1956                return false;
1957
1958                    }
1959                    _ => {
1960                        return false;
1961
1962                    },
1963                }
1964                ;
1965                let arg2: crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions = if args.get(2).is_undefined() {
1966                    crate::codegen::GenericBindings::URLPatternBinding::URLPatternOptions::empty()
1967                } else {
1968                    match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
1969                        Ok(ConversionResult::Success(value)) => value,
1970                        Ok(ConversionResult::Failure(error)) => {
1971                            throw_type_error(cx.raw_cx(), &error);
1972                    return false;
1973
1974                        }
1975                        _ => {
1976                            return false;
1977
1978                        },
1979                    }
1980
1981                };
1982                let result: Result<DomRoot<D::URLPattern>, Error> = <D::URLPattern>::Constructor(global, Some(desired_proto), CanGc::note(), arg0, arg1, &arg2);
1983                let result = match result {
1984                    Ok(result) => result,
1985                    Err(e) => {
1986                        <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), global.upcast::<D::GlobalScope>(), e, CanGc::note());
1987                        return false;
1988                    },
1989                };
1990
1991                (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
1992                return true;
1993            }
1994            _ => {
1995                throw_type_error(cx.raw_cx(), "Not enough arguments to \"URLPattern.constructor\".");
1996                return false;
1997            }
1998        }
1999                        }
2000                    )
2001
2002    });
2003    result
2004}
2005
2006
2007static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
2008
2009pub(crate) fn init_interface_object<D: DomTypes>() {
2010    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
2011        Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
2012        b"function URLPattern() {\n    [native code]\n}",
2013        PrototypeList::ID::URLPattern,
2014        0,
2015    ));
2016}
2017
2018pub fn DefineDOMInterface<D: DomTypes>
2019(cx: SafeJSContext, global: HandleObject){
2020    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::URLPattern),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
2021}
2022
2023pub fn ConstructorEnabled<D: DomTypes>
2024(aCx: SafeJSContext, aObj: HandleObject) -> bool{
2025    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW)
2026}
2027
2028unsafe fn CreateInterfaceObjects<D: DomTypes>
2029(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
2030
2031    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
2032    prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
2033    assert!(!prototype_proto.is_null());
2034
2035    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
2036    create_interface_prototype_object::<D>(cx,
2037                                      global,
2038                                      prototype_proto.handle(),
2039                                      &PrototypeClass,
2040                                      sMethods.get(),
2041                                      sAttributes.get(),
2042                                      &[],
2043                                      &[],
2044                                      prototype.handle_mut());
2045    assert!(!prototype.is_null());
2046    assert!((*cache)[PrototypeList::ID::URLPattern as usize].is_null());
2047    (*cache)[PrototypeList::ID::URLPattern as usize] = prototype.get();
2048    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::URLPattern as isize),
2049                                  ptr::null_mut(),
2050                                  prototype.get());
2051
2052    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
2053    interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
2054
2055    assert!(!interface_proto.is_null());
2056
2057    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
2058    create_noncallback_interface_object::<D>(cx,
2059                                        global,
2060                                        interface_proto.handle(),
2061                                        INTERFACE_OBJECT_CLASS.get(),
2062                                        &[],
2063                                        &[],
2064                                        &[],
2065                                        prototype.handle(),
2066                                        c"URLPattern",
2067                                        0,
2068                                        &[],
2069                                        interface.handle_mut());
2070    assert!(!interface.is_null());
2071}
2072
2073
2074        pub(crate) fn init_statics<D: DomTypes>() {
2075            init_interface_object::<D>();
2076            init_domjs_class::<D>();
2077            crate::codegen::GenericBindings::URLPatternBinding::URLPattern_Binding::init_test_methodinfo::<D>();
2078crate::codegen::GenericBindings::URLPatternBinding::URLPattern_Binding::init_exec_methodinfo::<D>();
2079            init_protocol_getterinfo::<D>();
2080init_username_getterinfo::<D>();
2081init_password_getterinfo::<D>();
2082init_hostname_getterinfo::<D>();
2083init_port_getterinfo::<D>();
2084init_pathname_getterinfo::<D>();
2085init_search_getterinfo::<D>();
2086init_hash_getterinfo::<D>();
2087init_hasRegExpGroups_getterinfo::<D>();
2088
2089
2090            init_sMethods_specs::<D>();
2091init_sMethods_prefs::<D>();
2092init_sAttributes_specs::<D>();
2093init_sAttributes_prefs::<D>();
2094        }
2095        } // mod URLPattern_Binding
2096
2097