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