#![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::*;
pub use self::Location_Binding::{Wrap, LocationMethods, GetProtoObject, DefineDOMInterface};
pub mod Location_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::Location;
unsafe extern fn get_href(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 Location);
let result: Result<USVString, Error> = this.GetHref();
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
}
unsafe extern fn set_href(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetHref(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const href_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_href)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const href_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_href)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_origin(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 Location);
let result: Result<USVString, Error> = this.GetOrigin();
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 origin_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_origin)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_protocol(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 Location);
let result: Result<USVString, Error> = this.GetProtocol();
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
}
unsafe extern fn set_protocol(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetProtocol(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const protocol_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_protocol)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const protocol_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_protocol)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_host(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 Location);
let result: Result<USVString, Error> = this.GetHost();
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
}
unsafe extern fn set_host(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetHost(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const host_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_host)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const host_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_host)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_hostname(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 Location);
let result: Result<USVString, Error> = this.GetHostname();
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
}
unsafe extern fn set_hostname(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetHostname(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const hostname_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_hostname)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const hostname_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_hostname)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_port(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 Location);
let result: Result<USVString, Error> = this.GetPort();
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
}
unsafe extern fn set_port(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetPort(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const port_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_port)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const port_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_port)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_pathname(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 Location);
let result: Result<USVString, Error> = this.GetPathname();
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
}
unsafe extern fn set_pathname(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetPathname(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const pathname_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_pathname)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const pathname_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_pathname)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_search(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 Location);
let result: Result<USVString, Error> = this.GetSearch();
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
}
unsafe extern fn set_search(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetSearch(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const search_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_search)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const search_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_search)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_hash(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 Location);
let result: Result<USVString, Error> = this.GetHash();
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
}
unsafe extern fn set_hash(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const Location);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.SetHash(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
true
})());
result
}
const hash_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_hash)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const hash_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_hash)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn assign(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 Location);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"Location.assign\".");
return false;
}
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.Assign(arg0);
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 assign_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(assign)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn replace(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 Location);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"Location.replace\".");
return false;
}
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.Replace(arg0);
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 replace_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(replace)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn reload(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 Location);
let args = &*args;
let argc = args.argc_;
let result: Result<(), Error> = this.Reload();
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 reload_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(reload)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn __stringifier(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 Location);
let args = &*args;
let argc = args.argc_;
let result: Result<USVString, Error> = this.GetHref();
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 __stringifier_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(__stringifier)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::Location 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_STRING as u8,
false,
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::<Location>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<Location>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub unsafe fn DefineProxyHandler() -> *const libc::c_void {
let traps = ProxyTraps {
enter: None,
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
defineProperty: Some(defineProperty),
ownPropertyKeys: Some(own_property_keys),
delete_: Some(delete),
enumerate: None,
getPrototypeIfOrdinary: Some(proxyhandler::maybe_cross_origin_get_prototype_if_ordinary_rawcx),
getPrototype: Some(getPrototype),
setPrototype: Some(proxyhandler::maybe_cross_origin_set_prototype_rawcx),
setImmutablePrototype: None,
preventExtensions: Some(proxyhandler::prevent_extensions),
isExtensible: Some(proxyhandler::is_extensible),
has: None,
get: Some(get),
set: Some(proxyhandler::maybe_cross_origin_set_rawcx),
call: None,
construct: None,
hasOwn: Some(hasOwn),
getOwnEnumerablePropertyKeys: Some(getOwnEnumerablePropertyKeys),
nativeCall: None,
objectClassIs: None,
className: Some(className),
fun_toString: None,
boxedValue_unbox: None,
defaultValue: None,
trace: Some(_trace),
finalize: Some(_finalize),
objectMoved: None,
isCallable: None,
isConstructor: None,
};
CreateProxyHandler(&traps, Class.as_void_ptr())
}
const sCrossOriginMethods: &[JSFunctionSpec] = &[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"replace\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &replace_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_READONLY) 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 sCrossOriginAttributes: &[JSPropertySpec] = &[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"href\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: None, info: 0 as *const JSJitInfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &href_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO
];
const CROSS_ORIGIN_PROPERTIES: proxyhandler::CrossOriginProperties =
proxyhandler::CrossOriginProperties {
attributes: sCrossOriginAttributes,
methods: sCrossOriginMethods,
};
#[inline] unsafe fn UnwrapProxy(obj: RawHandleObject) -> *const Location {
let mut slot = UndefinedValue();
GetProxyReservedSlot(obj.get(), 0, &mut slot);
let box_ = slot.to_private() as *const Location;
return box_;
}
static Class: DOMClass = DOMClass {
interface_chain: [ PrototypeList::ID::Location, 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::<Location> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
};
unsafe extern fn own_property_keys(cx: *mut JSContext, proxy: RawHandleObject, props: RawMutableHandleIdVector) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let unwrapped_proxy = UnwrapProxy(proxy);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return proxyhandler::cross_origin_own_property_keys(cx, proxy, &CROSS_ORIGIN_PROPERTIES, props);
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
get_expando_object(proxy, expando.handle_mut());
if !expando.is_null() &&
!GetPropertyKeys(*cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props) {
return false;
}
true
})());
result
}
unsafe extern fn getOwnEnumerablePropertyKeys(cx: *mut JSContext, proxy: RawHandleObject, props: RawMutableHandleIdVector) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let unwrapped_proxy = UnwrapProxy(proxy);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return true;
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
get_expando_object(proxy, expando.handle_mut());
if !expando.is_null() &&
!GetPropertyKeys(*cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props) {
return false;
}
true
})());
result
}
unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: RawHandleObject, id: RawHandleId, mut desc: RawMutableHandle<PropertyDescriptor>, is_none: *mut bool) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
if !proxyhandler::cross_origin_get_own_property_helper(
cx, proxy, &CROSS_ORIGIN_PROPERTIES, id, desc, &mut *is_none
) {
return false;
}
if *is_none {
return proxyhandler::cross_origin_property_fallback(cx, proxy, id, desc, &mut *is_none);
}
return true;
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
get_expando_object(proxy, expando.handle_mut());
let proxy_lt = Handle::from_raw(proxy);
let id_lt = Handle::from_raw(id);
if !expando.is_null() {
rooted!(in(*cx) let mut ignored = ptr::null_mut::<JSObject>());
if !JS_GetPropertyDescriptorById(*cx, expando.handle().into(), id, desc, ignored.handle_mut().into(), is_none) {
return false;
}
if !*is_none {
return true;
}
}
true
})());
result
}
unsafe extern fn className(cx: *mut JSContext, _proxy: RawHandleObject) -> *const libc::c_char {
b"Location\0" as *const u8 as *const libc::c_char
}
unsafe extern fn get(cx: *mut JSContext, proxy: RawHandleObject, receiver: RawHandleValue, id: RawHandleId, vp: RawMutableHandleValue) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return proxyhandler::cross_origin_get(cx, proxy, receiver, id, vp);
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
let proxy_lt = Handle::from_raw(proxy);
let vp_lt = MutableHandle::from_raw(vp);
let id_lt = Handle::from_raw(id);
let receiver_lt = Handle::from_raw(receiver);
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
get_expando_object(proxy, expando.handle_mut());
if !expando.is_null() {
let mut hasProp = false;
if !JS_HasPropertyById(*cx, expando.handle().into(), id, &mut hasProp) {
return false;
}
if hasProp {
return JS_ForwardGetPropertyTo(*cx, expando.handle().into(), id, receiver, vp);
}
}
let mut found = false;
if !get_property_on_prototype(*cx, proxy_lt, receiver_lt, id_lt, &mut found, vp_lt) {
return false;
}
if found {
return true;
}
vp.set(UndefinedValue());
true
})());
result
}
unsafe extern fn hasOwn(cx: *mut JSContext, proxy: RawHandleObject, id: RawHandleId, bp: *mut bool) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return proxyhandler::cross_origin_has_own(cx, proxy, &CROSS_ORIGIN_PROPERTIES, id, bp);
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
let proxy_lt = Handle::from_raw(proxy);
let id_lt = Handle::from_raw(id);
get_expando_object(proxy, expando.handle_mut());
if !expando.is_null() {
let ok = JS_HasPropertyById(*cx, expando.handle().into(), id, bp);
if !ok || *bp {
return ok;
}
}
*bp = false;
true
})());
result
}
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: RawHandleObject, id: RawHandleId, desc: RawHandle<PropertyDescriptor>, opresult: *mut ObjectOpResult) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return proxyhandler::report_cross_origin_denial(cx, id, "define");
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
return proxyhandler::define_property(*cx, proxy, id, desc, opresult);
})());
result
}
unsafe extern fn delete(cx: *mut JSContext, proxy: RawHandleObject, id: RawHandleId, res: *mut ObjectOpResult) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
return proxyhandler::report_cross_origin_denial(cx, id, "delete");
}
let _ac = JSAutoRealm::new(*cx, proxy.get());
return proxyhandler::delete(*cx, proxy, id, res);
})());
result
}
unsafe extern fn getPrototype(cx: *mut JSContext, proxy: RawHandleObject, proto: RawMutableHandleObject) -> bool {
let mut result = false;
wrap_panic(&mut || result = {
let cx = SafeJSContext::from_ptr(cx);
proxyhandler::maybe_cross_origin_get_prototype(cx, proxy, GetProtoObject, proto)
});
result
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<Location>) -> DomRoot<Location> {
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());
let handler: *const libc::c_void =
RegisterBindings::proxy_handlers::Location
.load(std::sync::atomic::Ordering::Acquire);
rooted!(in(*cx) let obj = NewProxyObject(
*cx,
handler,
Handle::from_raw(UndefinedHandleValue),
ptr::null_mut(),
ptr::null(),
true,
));
assert!(!obj.is_null());
SetProxyReservedSlot(
obj.get(),
0,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>());
ensure_expando_object(*cx, obj.handle().into(), expando.handle_mut());
let mut slot = UndefinedValue();
JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
unforgeable_holder.handle_mut().set(slot.to_object());
assert!(JS_InitializePropertiesFromCompatibleNativeObject(*cx, expando.handle(), unforgeable_holder.handle()));
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::location::Location {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for Location {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class)
}
}
impl PartialEq for Location {
fn eq(&self, other: &Location) -> bool {
self as *const Location == other
}
}
pub trait LocationMethods {
fn GetHref(&self) -> Fallible<USVString>;
fn SetHref(&self, value: USVString) -> ErrorResult;
fn GetOrigin(&self) -> Fallible<USVString>;
fn GetProtocol(&self) -> Fallible<USVString>;
fn SetProtocol(&self, value: USVString) -> ErrorResult;
fn GetHost(&self) -> Fallible<USVString>;
fn SetHost(&self, value: USVString) -> ErrorResult;
fn GetHostname(&self) -> Fallible<USVString>;
fn SetHostname(&self, value: USVString) -> ErrorResult;
fn GetPort(&self) -> Fallible<USVString>;
fn SetPort(&self, value: USVString) -> ErrorResult;
fn GetPathname(&self) -> Fallible<USVString>;
fn SetPathname(&self, value: USVString) -> ErrorResult;
fn GetSearch(&self) -> Fallible<USVString>;
fn SetSearch(&self, value: USVString) -> ErrorResult;
fn GetHash(&self) -> Fallible<USVString>;
fn SetHash(&self, value: USVString) -> ErrorResult;
fn Assign(&self, url: USVString) -> Fallible<()>;
fn Replace(&self, url: USVString) -> Fallible<()>;
fn Reload(&self) -> Fallible<()>;
}
const sLegacyUnforgeableMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"assign\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &assign_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"replace\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &replace_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"reload\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &reload_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"toString\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &__stringifier_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY) 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 sLegacyUnforgeableMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sLegacyUnforgeableMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
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"Location\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sLegacyUnforgeableAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"href\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &href_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &href_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"origin\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &origin_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"protocol\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &protocol_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &protocol_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"host\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &host_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &host_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"hostname\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &hostname_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &hostname_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"port\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &port_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &port_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"pathname\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &pathname_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &pathname_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"search\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &search_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &search_setterinfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"hash\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &hash_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &hash_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sLegacyUnforgeableAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sLegacyUnforgeableAttributes_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::Location), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"LocationPrototype\0" as *const u8 as *const libc::c_char,
flags:
(1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function Location() {\n [native code]\n}",
PrototypeList::ID::Location,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::Location), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, 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,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::Location as usize].is_null());
(*cache)[PrototypeList::ID::Location as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::Location 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"Location\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
unforgeable_holder.handle_mut().set(
JS_NewObjectWithoutMetadata(*cx, ptr::null(), HandleObject::null()));
assert!(!unforgeable_holder.is_null());
define_guarded_properties(cx, unforgeable_holder.handle(), sLegacyUnforgeableAttributes, global);
define_guarded_methods(cx, unforgeable_holder.handle(), sLegacyUnforgeableMethods, global);
let val = ObjectValue(unforgeable_holder.get());
JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
}
}