#![allow(non_camel_case_types,non_upper_case_globals,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
use crate::dom::bindings::import::base::*;
use crate::dom::types::Request;
#[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum RequestDestination {
_empty,
Audio,
Document,
Embed,
Font,
Image,
Manifest,
Object,
Report,
Script,
Sharedworker,
Style,
Track,
Video,
Worker,
Xslt
}
pub mod RequestDestinationValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::RequestDestination)] = &[
("", super::RequestDestination::_empty),
("audio", super::RequestDestination::Audio),
("document", super::RequestDestination::Document),
("embed", super::RequestDestination::Embed),
("font", super::RequestDestination::Font),
("image", super::RequestDestination::Image),
("manifest", super::RequestDestination::Manifest),
("object", super::RequestDestination::Object),
("report", super::RequestDestination::Report),
("script", super::RequestDestination::Script),
("sharedworker", super::RequestDestination::Sharedworker),
("style", super::RequestDestination::Style),
("track", super::RequestDestination::Track),
("video", super::RequestDestination::Video),
("worker", super::RequestDestination::Worker),
("xslt", super::RequestDestination::Xslt),
];
impl super::RequestDestination {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::RequestDestination {
fn default() -> super::RequestDestination {
pairs[0].1
}
}
impl ToJSValConvertible for super::RequestDestination {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::RequestDestination {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::RequestDestination>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'RequestDestination'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum RequestMode {
Navigate,
Same_origin,
No_cors,
Cors
}
pub mod RequestModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::RequestMode)] = &[
("navigate", super::RequestMode::Navigate),
("same-origin", super::RequestMode::Same_origin),
("no-cors", super::RequestMode::No_cors),
("cors", super::RequestMode::Cors),
];
impl super::RequestMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::RequestMode {
fn default() -> super::RequestMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::RequestMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::RequestMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::RequestMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'RequestMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum RequestCredentials {
Omit,
Same_origin,
Include
}
pub mod RequestCredentialsValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::RequestCredentials)] = &[
("omit", super::RequestCredentials::Omit),
("same-origin", super::RequestCredentials::Same_origin),
("include", super::RequestCredentials::Include),
];
impl super::RequestCredentials {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::RequestCredentials {
fn default() -> super::RequestCredentials {
pairs[0].1
}
}
impl ToJSValConvertible for super::RequestCredentials {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::RequestCredentials {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::RequestCredentials>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'RequestCredentials'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum RequestCache {
Default,
No_store,
Reload,
No_cache,
Force_cache,
Only_if_cached
}
pub mod RequestCacheValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::RequestCache)] = &[
("default", super::RequestCache::Default),
("no-store", super::RequestCache::No_store),
("reload", super::RequestCache::Reload),
("no-cache", super::RequestCache::No_cache),
("force-cache", super::RequestCache::Force_cache),
("only-if-cached", super::RequestCache::Only_if_cached),
];
impl super::RequestCache {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::RequestCache {
fn default() -> super::RequestCache {
pairs[0].1
}
}
impl ToJSValConvertible for super::RequestCache {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::RequestCache {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::RequestCache>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'RequestCache'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum RequestRedirect {
Follow,
Error,
Manual
}
pub mod RequestRedirectValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::RequestRedirect)] = &[
("follow", super::RequestRedirect::Follow),
("error", super::RequestRedirect::Error),
("manual", super::RequestRedirect::Manual),
];
impl super::RequestRedirect {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::RequestRedirect {
fn default() -> super::RequestRedirect {
pairs[0].1
}
}
impl ToJSValConvertible for super::RequestRedirect {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::RequestRedirect {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::RequestRedirect>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'RequestRedirect'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ReferrerPolicy {
_empty,
No_referrer,
No_referrer_when_downgrade,
Origin,
Origin_when_cross_origin,
Unsafe_url,
Same_origin,
Strict_origin,
Strict_origin_when_cross_origin
}
pub mod ReferrerPolicyValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::ReferrerPolicy)] = &[
("", super::ReferrerPolicy::_empty),
("no-referrer", super::ReferrerPolicy::No_referrer),
("no-referrer-when-downgrade", super::ReferrerPolicy::No_referrer_when_downgrade),
("origin", super::ReferrerPolicy::Origin),
("origin-when-cross-origin", super::ReferrerPolicy::Origin_when_cross_origin),
("unsafe-url", super::ReferrerPolicy::Unsafe_url),
("same-origin", super::ReferrerPolicy::Same_origin),
("strict-origin", super::ReferrerPolicy::Strict_origin),
("strict-origin-when-cross-origin", super::ReferrerPolicy::Strict_origin_when_cross_origin),
];
impl super::ReferrerPolicy {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::ReferrerPolicy {
fn default() -> super::ReferrerPolicy {
pairs[0].1
}
}
impl ToJSValConvertible for super::ReferrerPolicy {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::ReferrerPolicy {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::ReferrerPolicy>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'ReferrerPolicy'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} pub use self::UnionTypes::RequestOrUSVString as RequestInfo;
#[derive(JSTraceable, Default)]
#[crown::unrooted_must_root_lint::must_root]
pub struct RequestInit {
pub body: Option<Option<UnionTypes::ReadableStreamOrXMLHttpRequestBodyInit >>,
pub cache: Option<RequestCache>,
pub credentials: Option<RequestCredentials>,
pub headers: Option<UnionTypes::ByteStringSequenceSequenceOrByteStringByteStringRecord>,
pub integrity: Option<DOMString>,
pub method: Option<ByteString>,
pub mode: Option<RequestMode>,
pub redirect: Option<RequestRedirect>,
pub referrer: Option<USVString>,
pub referrerPolicy: Option<ReferrerPolicy>,
pub window: RootedTraceableBox<Heap<JSVal>>,
}
impl RequestInit {
pub fn empty() -> RootedTraceableBox<Self> {
let mut dictionary = RootedTraceableBox::new(Self::default());
dictionary.body = None;
dictionary.cache = None;
dictionary.credentials = None;
dictionary.headers = None;
dictionary.integrity = None;
dictionary.method = None;
dictionary.mode = None;
dictionary.redirect = None;
dictionary.referrer = None;
dictionary.referrerPolicy = None;
dictionary.window = RootedTraceableBox::from_box(Heap::boxed(UndefinedValue()));
dictionary
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<RootedTraceableBox<RequestInit>>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = RootedTraceableBox::new(RequestInit {
body: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "body", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
cache: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "cache", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
credentials: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "credentials", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
headers: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "headers", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
integrity: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "integrity", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
method: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "method", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
mode: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mode", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
redirect: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "redirect", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
referrer: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "referrer", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
referrerPolicy: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "referrerPolicy", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
window: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "window", rval.handle_mut())? && !rval.is_undefined() {
RootedTraceableBox::from_box(Heap::boxed(rval.handle().get()))
} else {
RootedTraceableBox::from_box(Heap::boxed(UndefinedValue()))
}
},
});
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for RootedTraceableBox<RequestInit> {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<RootedTraceableBox<RequestInit>>, ()> {
RequestInit::new(SafeJSContext::from_ptr(cx), value)
}
}
impl RequestInit {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref body) = self.body {
rooted!(in(cx) let mut body_js = UndefinedValue());
body.to_jsval(cx, body_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "body", body_js.handle()).unwrap();
}
if let Some(ref cache) = self.cache {
rooted!(in(cx) let mut cache_js = UndefinedValue());
cache.to_jsval(cx, cache_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "cache", cache_js.handle()).unwrap();
}
if let Some(ref credentials) = self.credentials {
rooted!(in(cx) let mut credentials_js = UndefinedValue());
credentials.to_jsval(cx, credentials_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "credentials", credentials_js.handle()).unwrap();
}
if let Some(ref headers) = self.headers {
rooted!(in(cx) let mut headers_js = UndefinedValue());
headers.to_jsval(cx, headers_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "headers", headers_js.handle()).unwrap();
}
if let Some(ref integrity) = self.integrity {
rooted!(in(cx) let mut integrity_js = UndefinedValue());
integrity.to_jsval(cx, integrity_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "integrity", integrity_js.handle()).unwrap();
}
if let Some(ref method) = self.method {
rooted!(in(cx) let mut method_js = UndefinedValue());
method.to_jsval(cx, method_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "method", method_js.handle()).unwrap();
}
if let Some(ref mode) = self.mode {
rooted!(in(cx) let mut mode_js = UndefinedValue());
mode.to_jsval(cx, mode_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mode", mode_js.handle()).unwrap();
}
if let Some(ref redirect) = self.redirect {
rooted!(in(cx) let mut redirect_js = UndefinedValue());
redirect.to_jsval(cx, redirect_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "redirect", redirect_js.handle()).unwrap();
}
if let Some(ref referrer) = self.referrer {
rooted!(in(cx) let mut referrer_js = UndefinedValue());
referrer.to_jsval(cx, referrer_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "referrer", referrer_js.handle()).unwrap();
}
if let Some(ref referrerPolicy) = self.referrerPolicy {
rooted!(in(cx) let mut referrerPolicy_js = UndefinedValue());
referrerPolicy.to_jsval(cx, referrerPolicy_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "referrerPolicy", referrerPolicy_js.handle()).unwrap();
}
let window = &self.window;
rooted!(in(cx) let mut window_js = UndefinedValue());
window.to_jsval(cx, window_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "window", window_js.handle()).unwrap();
}
}
impl ToJSValConvertible for RequestInit {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
pub use self::Request_Binding::{Wrap, RequestMethods, GetProtoObject, DefineDOMInterface};
pub mod Request_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::RequestBinding::ReferrerPolicy;
use crate::dom::bindings::codegen::Bindings::RequestBinding::ReferrerPolicyValues;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCache;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCacheValues;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentials;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentialsValues;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestDestination;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestDestinationValues;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestMode;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestModeValues;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestRedirectValues;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::Headers;
use crate::dom::types::Request;
unsafe extern fn get_method(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: ByteString = this.Method();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const method_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_method)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_url(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: USVString = this.Url();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const url_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_url)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_headers(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: DomRoot<Headers> = this.Headers();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const headers_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_headers)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_destination(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: RequestDestination = this.Destination();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const destination_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_destination)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_referrer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: USVString = this.Referrer();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const referrer_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_referrer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_referrerPolicy(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: ReferrerPolicy = this.ReferrerPolicy();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const referrerPolicy_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_referrerPolicy)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_mode(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: RequestMode = this.Mode();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const mode_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_mode)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_credentials(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: RequestCredentials = this.Credentials();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const credentials_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_credentials)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_cache(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: RequestCache = this.Cache();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const cache_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_cache)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_redirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: RequestRedirect = this.Redirect();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const redirect_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_redirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_integrity(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: DOMString = this.Integrity();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const integrity_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_integrity)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn clone(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Result<DomRoot<Request>, Error> = this.Clone();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const clone_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(clone)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_bodyUsed(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: bool = this.BodyUsed();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const bodyUsed_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_bodyUsed)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_body(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let result: Option<NonNull<JSObject>> = this.GetBody(cx);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const body_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_body)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNKNOWN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn arrayBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.ArrayBuffer();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const arrayBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(arrayBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn blob(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.Blob();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const blob_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(blob)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn formData(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.FormData();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const formData_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(formData)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn json(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.Json();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const json_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(json)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn text(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Request);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.Text();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const text_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(text)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Request as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<Request>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<Request>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"Request\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::Request, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<Request> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl Request {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<Request>) -> DomRoot<Request> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::request::Request {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for Request {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for Request {
fn eq(&self, other: &Request) -> bool {
self as *const Request == other
}
}
pub trait RequestMethods {
fn Method(&self) -> ByteString;
fn Url(&self) -> USVString;
fn Headers(&self) -> DomRoot<Headers>;
fn Destination(&self) -> RequestDestination;
fn Referrer(&self) -> USVString;
fn ReferrerPolicy(&self) -> ReferrerPolicy;
fn Mode(&self) -> RequestMode;
fn Credentials(&self) -> RequestCredentials;
fn Cache(&self) -> RequestCache;
fn Redirect(&self) -> RequestRedirect;
fn Integrity(&self) -> DOMString;
fn Clone(&self) -> Fallible<DomRoot<Request>>;
fn BodyUsed(&self) -> bool;
fn GetBody(&self, cx: SafeJSContext) -> Option<NonNull<JSObject>>;
fn ArrayBuffer(&self) -> Rc<Promise>;
fn Blob(&self) -> Rc<Promise>;
fn FormData(&self) -> Rc<Promise>;
fn Json(&self) -> Rc<Promise>;
fn Text(&self) -> Rc<Promise>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"clone\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &clone_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"arrayBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &arrayBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"blob\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &blob_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"formData\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &formData_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"json\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &json_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"text\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &text_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::SERVICE_WORKER_GLOBAL_SCOPE), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"method\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &method_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"url\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &url_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"headers\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &headers_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"destination\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &destination_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"referrer\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &referrer_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"referrerPolicy\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &referrerPolicy_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"mode\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &mode_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"credentials\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &credentials_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"cache\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &cache_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"redirect\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &redirect_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"integrity\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &integrity_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"bodyUsed\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &bodyUsed_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"body\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &body_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"Request\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::SERVICE_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::Request), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"RequestPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let args = CallArgs::from_vp(vp, argc);
let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
if !callargs_is_constructing(&args) {
throw_constructor_without_new(*cx, "Request");
return false;
}
rooted!(in(*cx) let mut desired_proto = ptr::null_mut::<JSObject>());
let proto_result = get_desired_proto(
cx,
&args,
PrototypeList::ID::Request,
CreateInterfaceObjects,
desired_proto.handle_mut(),
);
assert!(proto_result.is_ok());
if proto_result.is_err() {
return false;
}
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"Request.constructor\".");
return false;
}
let arg0: UnionTypes::RequestOrUSVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: RootedTraceableBox<crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit> = if args.get(1).is_undefined() {
crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: Result<DomRoot<Request>, Error> = Request::Constructor(&global, Some(desired_proto.handle()), arg0, arg1);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.upcast::<GlobalScope>(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::call(_constructor);
&BEHAVIOR
},
b"function Request() {\n [native code]\n}",
PrototypeList::ID::Request,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::Request), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::SERVICE_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::Request as usize].is_null());
(*cache)[PrototypeList::ID::Request as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::Request as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"Request\0",
1,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
}