#![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::DOMTokenList_Binding::{Wrap, DOMTokenListMethods, GetProtoObject, DefineDOMInterface};
pub mod DOMTokenList_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::DOMTokenList;
unsafe extern fn get_length(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 DOMTokenList);
let result: u32 = this.Length();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const length_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_length)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn item(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"DOMTokenList.item\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: Option<DOMString> = this.Item(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const item_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::Double as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const item_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(item)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_UNKNOWN as u8,
false,
true,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &item_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn contains(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"DOMTokenList.contains\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: bool = this.Contains(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const contains_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const contains_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(contains)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
false,
true,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &contains_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn add(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
let mut arg0 = vec![];
if argc > 0 {
arg0.reserve(argc as usize);
for variadicArg in 0..argc {
let slot: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(variadicArg)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
arg0.push(slot);
}
}
push_new_element_queue();
let result: Result<(), Error> = this.Add(arg0);
pop_current_element_queue();
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 add_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(add)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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 remove(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
let mut arg0 = vec![];
if argc > 0 {
arg0.reserve(argc as usize);
for variadicArg in 0..argc {
let slot: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(variadicArg)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
arg0.push(slot);
}
}
push_new_element_queue();
let result: Result<(), Error> = this.Remove(arg0);
pop_current_element_queue();
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 remove_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(remove)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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 toggle(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"DOMTokenList.toggle\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: Option<bool> = if args.get(1).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
})
};
push_new_element_queue();
let result: Result<bool, Error> = this.Toggle(arg0, arg1);
pop_current_element_queue();
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 toggle_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(toggle)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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_BOOLEAN 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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"DOMTokenList.replace\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
push_new_element_queue();
let result: Result<bool, Error> = this.Replace(arg0, arg1);
pop_current_element_queue();
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::DOMTokenList 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_BOOLEAN as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn supports(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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"DOMTokenList.supports\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<bool, Error> = this.Supports(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 supports_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const supports_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(supports)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
false,
false,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &supports_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn get_value(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 DOMTokenList);
push_new_element_queue();
let result: DOMString = this.Value();
pop_current_element_queue();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_value(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 DOMTokenList);
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
push_new_element_queue();
let result: () = this.SetValue(arg0);
pop_current_element_queue();
true
})());
result
}
const value_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_value)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const value_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_value)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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 __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 DOMTokenList);
let args = &*args;
let argc = args.argc_;
let result: DOMString = this.Value();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const __stringifier_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const __stringifier_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(__stringifier)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::DOMTokenList 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::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
true,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &__stringifier_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<DOMTokenList>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<DOMTokenList>(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(proxyhandler::define_property),
ownPropertyKeys: Some(own_property_keys),
delete_: Some(proxyhandler::delete),
enumerate: None,
getPrototypeIfOrdinary: Some(proxyhandler::get_prototype_if_ordinary),
getPrototype: None,
setPrototype: None,
setImmutablePrototype: None,
preventExtensions: Some(proxyhandler::prevent_extensions),
isExtensible: Some(proxyhandler::is_extensible),
has: None,
get: Some(get),
set: None,
call: None,
construct: None,
hasOwn: Some(hasOwn),
getOwnEnumerablePropertyKeys: Some(own_property_keys),
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())
}
#[inline] unsafe fn UnwrapProxy(obj: RawHandleObject) -> *const DOMTokenList {
let mut slot = UndefinedValue();
GetProxyReservedSlot(obj.get(), 0, &mut slot);
let box_ = slot.to_private() as *const DOMTokenList;
return box_;
}
static Class: DOMClass = DOMClass {
interface_chain: [ PrototypeList::ID::DOMTokenList, 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::<DOMTokenList> 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);
for i in 0..(*unwrapped_proxy).Length() {
rooted!(in(*cx) let mut rooted_jsid: jsid);
int_to_jsid(i as i32, rooted_jsid.handle_mut());
AppendToIdVector(props, rooted_jsid.handle());
}
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);
let index = get_array_index_from_id(*cx, Handle::from_raw(id));
if let Some(index) = index {
let this = UnwrapProxy(proxy);
let this = &*this;
let result: Option<DOMString> = this.IndexedGetter(index);
if let Some(result) = result {
rooted!(in(*cx) let mut rval = UndefinedValue());
(result).to_jsval(*cx, rval.handle_mut());
set_property_descriptor(
MutableHandle::from_raw(desc),
rval.handle(),
(JSPROP_ENUMERATE | JSPROP_READONLY) as u32,
&mut *is_none
);
return true;
}
}
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"DOMTokenList\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);
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);
let index = get_array_index_from_id(*cx, id_lt);
if let Some(index) = index {
let this = UnwrapProxy(proxy);
let this = &*this;
let result: Option<DOMString> = this.IndexedGetter(index);
if let Some(result) = result {
(result).to_jsval(*cx, vp_lt);
return true;
} } else {
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);
let index = get_array_index_from_id(*cx, Handle::from_raw(id));
if let Some(index) = index {
let this = UnwrapProxy(proxy);
let this = &*this;
let result: Option<DOMString> = this.IndexedGetter(index);
*bp = result.is_some();
return true;
}
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
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<DOMTokenList>) -> DomRoot<DOMTokenList> {
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::DOMTokenList
.load(std::sync::atomic::Ordering::Acquire);
rooted!(in(*cx) let obj = NewProxyObject(
*cx,
handler,
Handle::from_raw(UndefinedHandleValue),
canonical_proto.get(),
ptr::null(),
false,
));
assert!(!obj.is_null());
SetProxyReservedSlot(
obj.get(),
0,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::domtokenlist::DOMTokenList {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for DOMTokenList {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class)
}
}
impl PartialEq for DOMTokenList {
fn eq(&self, other: &DOMTokenList) -> bool {
self as *const DOMTokenList == other
}
}
pub trait DOMTokenListMethods {
fn Length(&self) -> u32;
fn Item(&self, index: u32) -> Option<DOMString>;
fn Contains(&self, token: DOMString) -> bool;
fn Add(&self, tokens: Vec<DOMString>) -> Fallible<()>;
fn Remove(&self, tokens: Vec<DOMString>) -> Fallible<()>;
fn Toggle(&self, token: DOMString, force: Option<bool>) -> Fallible<bool>;
fn Replace(&self, token: DOMString, newToken: DOMString) -> Fallible<bool>;
fn Supports(&self, token: DOMString) -> Fallible<bool>;
fn Value(&self) -> DOMString;
fn SetValue(&self, value: DOMString);
fn IndexedGetter(&self, index: u32) -> Option<DOMString>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"item\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &item_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"contains\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &contains_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"add\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &add_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"remove\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &remove_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"toggle\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &toggle_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) 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: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"supports\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &supports_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
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()
}]
,
&[
JSFunctionSpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::iterator as usize + 1 },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: b"$ArrayValues\0" as *const u8 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()
}]
,
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"keys\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: b"ArrayKeys\0" as *const u8 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"values\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: b"$ArrayValues\0" as *const u8 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"entries\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: b"ArrayEntries\0" as *const u8 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"forEach\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: b"ArrayForEach\0" as *const u8 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) 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::Satisfied, sMethods_specs[1]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[2])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"length\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: &length_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"value\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: &value_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &value_setterinfo },
}
}
}
}
,
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"DOMTokenList\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::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::DOMTokenList), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"DOMTokenListPrototype\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(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function DOMTokenList() {\n [native code]\n}",
PrototypeList::ID::DOMTokenList,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::DOMTokenList), 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,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::DOMTokenList as usize].is_null());
(*cache)[PrototypeList::ID::DOMTokenList as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::DOMTokenList 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"DOMTokenList\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
}