mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
auto merge of #4979 : Ms2ger/servo/audit-ints, r=Manishearth
This commit is contained in:
commit
276f74b1dd
17 changed files with 73 additions and 73 deletions
|
@ -1014,7 +1014,7 @@ class CGArgumentConverter(CGThing):
|
|||
seqType = CGTemplatedType("Vec", declType)
|
||||
|
||||
variadicConversion = string.Template(
|
||||
"let mut vector: ${seqType} = Vec::with_capacity((${argc} - ${index}) as uint);\n"
|
||||
"let mut vector: ${seqType} = Vec::with_capacity((${argc} - ${index}) as usize);\n"
|
||||
"for variadicArg in range(${index}, ${argc}) {\n"
|
||||
"${inner}\n"
|
||||
" vector.push(slot);\n"
|
||||
|
@ -1484,7 +1484,7 @@ const Class_name: [u8; %i] = %s;
|
|||
static Class: DOMJSClass = DOMJSClass {
|
||||
base: js::Class {
|
||||
name: &Class_name as *const u8 as *const libc::c_char,
|
||||
flags: JSCLASS_IS_DOMJSCLASS | %s | (((%s) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT as uint), //JSCLASS_HAS_RESERVED_SLOTS(%s),
|
||||
flags: JSCLASS_IS_DOMJSCLASS | %s | (((%s) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT), //JSCLASS_HAS_RESERVED_SLOTS(%s),
|
||||
addProperty: Some(JS_PropertyStub),
|
||||
delProperty: Some(JS_PropertyStub),
|
||||
getProperty: Some(JS_PropertyStub),
|
||||
|
@ -1567,7 +1567,7 @@ class CGPrototypeJSClass(CGThing):
|
|||
const PrototypeClassName__: [u8; %s] = %s;
|
||||
static PrototypeClass: JSClass = JSClass {
|
||||
name: &PrototypeClassName__ as *const u8 as *const libc::c_char,
|
||||
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT as uint, //JSCLASS_HAS_RESERVED_SLOTS(1)
|
||||
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT, //JSCLASS_HAS_RESERVED_SLOTS(1)
|
||||
addProperty: Some(JS_PropertyStub),
|
||||
delProperty: Some(JS_PropertyStub),
|
||||
getProperty: Some(JS_PropertyStub),
|
||||
|
@ -1835,7 +1835,7 @@ def CreateBindingJSObject(descriptor, parent=None):
|
|||
if descriptor.proxy:
|
||||
assert not descriptor.isGlobal()
|
||||
create += """
|
||||
let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as uint];
|
||||
let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as usize];
|
||||
let mut private = PrivateValue(boxed::into_raw(object) as *const libc::c_void);
|
||||
let obj = with_compartment(cx, proto, || {
|
||||
NewProxyObject(cx, handler,
|
||||
|
@ -1855,7 +1855,7 @@ assert!(!obj.is_null());\
|
|||
create += """\
|
||||
assert!(!obj.is_null());
|
||||
|
||||
JS_SetReservedSlot(obj, DOM_OBJECT_SLOT as u32,
|
||||
JS_SetReservedSlot(obj, DOM_OBJECT_SLOT,
|
||||
PrivateValue(boxed::into_raw(object) as *const libc::c_void));"""
|
||||
return create
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ impl IDLInterface for ${type} {
|
|||
fn get_prototype_id() -> PrototypeList::ID {
|
||||
PrototypeList::ID::${type}
|
||||
}
|
||||
fn get_prototype_depth() -> uint {
|
||||
fn get_prototype_depth() -> usize {
|
||||
${depth}
|
||||
}
|
||||
}
|
||||
|
@ -2071,11 +2071,11 @@ assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
|||
|
||||
/* Check to see whether the interface objects are already installed */
|
||||
let proto_or_iface_array = get_proto_or_iface_array(global);
|
||||
let cached_object: *mut JSObject = *proto_or_iface_array.offset(%s as int);
|
||||
let cached_object: *mut JSObject = *proto_or_iface_array.offset(%s as isize);
|
||||
if cached_object.is_null() {
|
||||
let tmp: *mut JSObject = CreateInterfaceObjects(cx, global, receiver);
|
||||
assert!(!tmp.is_null());
|
||||
*proto_or_iface_array.offset(%s as int) = tmp;
|
||||
*proto_or_iface_array.offset(%s as isize) = tmp;
|
||||
tmp
|
||||
} else {
|
||||
cached_object
|
||||
|
@ -2800,7 +2800,7 @@ class CGEnum(CGThing):
|
|||
CGThing.__init__(self)
|
||||
|
||||
decl = """\
|
||||
#[repr(uint)]
|
||||
#[repr(usize)]
|
||||
#[derive(PartialEq, Copy)]
|
||||
#[jstraceable]
|
||||
pub enum %s {
|
||||
|
@ -2819,7 +2819,7 @@ pub const strings: &'static [&'static str] = &[
|
|||
|
||||
impl ToJSValConvertible for super::%s {
|
||||
fn to_jsval(&self, cx: *mut JSContext) -> JSVal {
|
||||
strings[*self as uint].to_jsval(cx)
|
||||
strings[*self as usize].to_jsval(cx)
|
||||
}
|
||||
}
|
||||
""" % (",\n ".join(['"%s"' % val for val in enum.values()]), enum.identifier.name)
|
||||
|
@ -4496,7 +4496,7 @@ class CGRegisterProxyHandlersMethod(CGAbstractMethod):
|
|||
|
||||
def definition_body(self):
|
||||
return CGList([
|
||||
CGGeneric("proxy_handlers[Proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
|
||||
CGGeneric("proxy_handlers[Proxies::%s as usize] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
|
||||
for desc in self.descriptors
|
||||
], "\n")
|
||||
|
||||
|
@ -5225,7 +5225,7 @@ class GlobalGenRoots():
|
|||
|
||||
return CGList([
|
||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy"),
|
||||
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy"),
|
||||
])
|
||||
|
|
|
@ -62,7 +62,7 @@ pub trait IDLInterface {
|
|||
fn get_prototype_id() -> PrototypeList::ID;
|
||||
/// Returns the prototype depth, i.e., the number of interfaces this
|
||||
/// interface inherits from.
|
||||
fn get_prototype_depth() -> uint;
|
||||
fn get_prototype_depth() -> usize;
|
||||
}
|
||||
|
||||
/// A trait to convert Rust types to `JSVal`s.
|
||||
|
@ -306,7 +306,7 @@ pub fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString {
|
|||
unsafe {
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, s, &mut length);
|
||||
let char_vec = slice::from_raw_parts(chars, length as uint);
|
||||
let char_vec = slice::from_raw_parts(chars, length as usize);
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ impl FromJSValConvertible for ByteString {
|
|||
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, string, &mut length);
|
||||
let char_vec = slice::from_raw_parts(chars, length as uint);
|
||||
let char_vec = slice::from_raw_parts(chars, length as usize);
|
||||
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
|
@ -410,8 +410,8 @@ pub fn is_dom_proxy(obj: *mut JSObject) -> bool {
|
|||
/// stored for non-proxy bindings.
|
||||
// We use slot 0 for holding the raw object. This is safe for both
|
||||
// globals and non-globals.
|
||||
pub const DOM_OBJECT_SLOT: uint = 0;
|
||||
const DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
|
||||
pub const DOM_OBJECT_SLOT: u32 = 0;
|
||||
const DOM_PROXY_OBJECT_SLOT: u32 = js::JSSLOT_PROXY_PRIVATE;
|
||||
|
||||
/// Returns the index of the slot wherein a pointer to the reflected DOM object
|
||||
/// is stored.
|
||||
|
@ -420,10 +420,10 @@ const DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
|
|||
pub unsafe fn dom_object_slot(obj: *mut JSObject) -> u32 {
|
||||
let clasp = JS_GetClass(obj);
|
||||
if is_dom_class(&*clasp) {
|
||||
DOM_OBJECT_SLOT as u32
|
||||
DOM_OBJECT_SLOT
|
||||
} else {
|
||||
assert!(is_dom_proxy(obj));
|
||||
DOM_PROXY_OBJECT_SLOT as u32
|
||||
DOM_PROXY_OBJECT_SLOT
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ pub trait TemporaryPushable<T> {
|
|||
/// Push a new value onto this container.
|
||||
fn push_unrooted(&mut self, val: &T);
|
||||
/// Insert a new value into this container.
|
||||
fn insert_unrooted(&mut self, index: uint, val: &T);
|
||||
fn insert_unrooted(&mut self, index: usize, val: &T);
|
||||
}
|
||||
|
||||
impl<T: Assignable<U>, U: Reflectable> TemporaryPushable<T> for Vec<JS<U>> {
|
||||
|
@ -593,7 +593,7 @@ impl<T: Assignable<U>, U: Reflectable> TemporaryPushable<T> for Vec<JS<U>> {
|
|||
self.push(unsafe { val.get_js() });
|
||||
}
|
||||
|
||||
fn insert_unrooted(&mut self, index: uint, val: &T) {
|
||||
fn insert_unrooted(&mut self, index: usize, val: &T) {
|
||||
self.insert(index, unsafe { val.get_js() });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ pub struct Trusted<T> {
|
|||
/// A pointer to the Rust DOM object of type T, but void to allow
|
||||
/// sending `Trusted<T>` between tasks, regardless of T's sendability.
|
||||
ptr: *const libc::c_void,
|
||||
refcount: Arc<Mutex<uint>>,
|
||||
refcount: Arc<Mutex<usize>>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
owner_thread: *const libc::c_void,
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ impl<T: Reflectable> Drop for Trusted<T> {
|
|||
/// from being garbage collected due to outstanding references.
|
||||
pub struct LiveDOMReferences {
|
||||
// keyed on pointer to Rust DOM object
|
||||
table: RefCell<HashMap<*const libc::c_void, Arc<Mutex<uint>>>>
|
||||
table: RefCell<HashMap<*const libc::c_void, Arc<Mutex<usize>>>>
|
||||
}
|
||||
|
||||
impl LiveDOMReferences {
|
||||
|
@ -136,7 +136,7 @@ impl LiveDOMReferences {
|
|||
});
|
||||
}
|
||||
|
||||
fn addref<T: Reflectable>(&self, cx: *mut JSContext, ptr: *const T) -> Arc<Mutex<uint>> {
|
||||
fn addref<T: Reflectable>(&self, cx: *mut JSContext, ptr: *const T) -> Arc<Mutex<usize>> {
|
||||
let mut table = self.table.borrow_mut();
|
||||
match table.entry(ptr as *const libc::c_void) {
|
||||
Occupied(mut entry) => {
|
||||
|
|
|
@ -34,7 +34,7 @@ impl ByteString {
|
|||
}
|
||||
|
||||
/// Returns the length.
|
||||
pub fn len(&self) -> uint {
|
||||
pub fn len(&self) -> usize {
|
||||
let ByteString(ref vector) = *self;
|
||||
vector.len()
|
||||
}
|
||||
|
|
|
@ -204,8 +204,8 @@ impl<A: JSTraceable, B: JSTraceable> JSTraceable for (A, B) {
|
|||
|
||||
|
||||
no_jsmanaged_fields!(bool, f32, f64, String, Url);
|
||||
no_jsmanaged_fields!(uint, u8, u16, u32, u64);
|
||||
no_jsmanaged_fields!(int, i8, i16, i32, i64);
|
||||
no_jsmanaged_fields!(usize, u8, u16, u32, u64);
|
||||
no_jsmanaged_fields!(isize, i8, i16, i32, i64);
|
||||
no_jsmanaged_fields!(Sender<T>);
|
||||
no_jsmanaged_fields!(Receiver<T>);
|
||||
no_jsmanaged_fields!(Rect<T>);
|
||||
|
|
|
@ -335,7 +335,7 @@ pub unsafe extern fn throwing_constructor(cx: *mut JSContext, _argc: c_uint,
|
|||
/// Fails if the argument is not a DOM global.
|
||||
pub fn initialize_global(global: *mut JSObject) {
|
||||
let proto_array = box ()
|
||||
([0 as *mut JSObject; PrototypeList::ID::Count as uint]);
|
||||
([0 as *mut JSObject; PrototypeList::ID::Count as usize]);
|
||||
unsafe {
|
||||
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
||||
let box_ = boxed::into_raw(proto_array);
|
||||
|
@ -460,7 +460,7 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: jsid) -> Option<u32> {
|
|||
pub fn find_enum_string_index(cx: *mut JSContext,
|
||||
v: JSVal,
|
||||
values: &[&'static str])
|
||||
-> Result<Option<uint>, ()> {
|
||||
-> Result<Option<usize>, ()> {
|
||||
unsafe {
|
||||
let jsstr = JS_ValueToString(cx, v);
|
||||
if jsstr.is_null() {
|
||||
|
@ -474,9 +474,9 @@ pub fn find_enum_string_index(cx: *mut JSContext,
|
|||
}
|
||||
|
||||
Ok(values.iter().position(|value| {
|
||||
value.len() == length as uint &&
|
||||
range(0, length as uint).all(|j| {
|
||||
value.as_bytes()[j] as u16 == *chars.offset(j as int)
|
||||
value.len() == length as usize &&
|
||||
range(0, length as usize).all(|j| {
|
||||
value.as_bytes()[j] as u16 == *chars.offset(j as isize)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
|||
}
|
||||
|
||||
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
|
||||
Ok(self.data.borrow()[offset as uint .. count as uint].to_owned())
|
||||
Ok(self.data.borrow()[offset as usize .. count as usize].to_owned())
|
||||
}
|
||||
|
||||
fn AppendData(self, arg: DOMString) -> ErrorResult {
|
||||
|
@ -107,9 +107,9 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
|||
} else {
|
||||
count
|
||||
};
|
||||
let mut data = self.data.borrow()[..offset as uint].to_owned();
|
||||
let mut data = self.data.borrow()[..offset as usize].to_owned();
|
||||
data.push_str(arg.as_slice());
|
||||
data.push_str(&self.data.borrow()[(offset + count) as uint..]);
|
||||
data.push_str(&self.data.borrow()[(offset + count) as usize..]);
|
||||
*self.data.borrow_mut() = data;
|
||||
// FIXME: Once we have `Range`, we should implement step7 to step11
|
||||
Ok(())
|
||||
|
|
|
@ -109,17 +109,18 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
}
|
||||
|
||||
fn Item(self, index: u32) -> DOMString {
|
||||
let index = index as usize;
|
||||
let owner = self.owner.root();
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
let style_attribute = elem.style_attribute().borrow();
|
||||
let result = style_attribute.as_ref().and_then(|declarations| {
|
||||
if index as uint > declarations.normal.len() {
|
||||
if index > declarations.normal.len() {
|
||||
declarations.important
|
||||
.get(index as uint - declarations.normal.len())
|
||||
.get(index - declarations.normal.len())
|
||||
.map(|decl| format!("{:?} !important", decl))
|
||||
} else {
|
||||
declarations.normal
|
||||
.get(index as uint)
|
||||
.get(index)
|
||||
.map(|decl| format!("{:?}", decl))
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,30 +13,30 @@ use util::str::DOMString;
|
|||
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
#[repr(uint)]
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum DOMErrorName {
|
||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR as uint,
|
||||
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR as uint,
|
||||
WrongDocumentError = DOMExceptionConstants::WRONG_DOCUMENT_ERR as uint,
|
||||
InvalidCharacterError = DOMExceptionConstants::INVALID_CHARACTER_ERR as uint,
|
||||
NoModificationAllowedError = DOMExceptionConstants::NO_MODIFICATION_ALLOWED_ERR as uint,
|
||||
NotFoundError = DOMExceptionConstants::NOT_FOUND_ERR as uint,
|
||||
NotSupportedError = DOMExceptionConstants::NOT_SUPPORTED_ERR as uint,
|
||||
InvalidStateError = DOMExceptionConstants::INVALID_STATE_ERR as uint,
|
||||
SyntaxError = DOMExceptionConstants::SYNTAX_ERR as uint,
|
||||
InvalidModificationError = DOMExceptionConstants::INVALID_MODIFICATION_ERR as uint,
|
||||
NamespaceError = DOMExceptionConstants::NAMESPACE_ERR as uint,
|
||||
InvalidAccessError = DOMExceptionConstants::INVALID_ACCESS_ERR as uint,
|
||||
SecurityError = DOMExceptionConstants::SECURITY_ERR as uint,
|
||||
NetworkError = DOMExceptionConstants::NETWORK_ERR as uint,
|
||||
AbortError = DOMExceptionConstants::ABORT_ERR as uint,
|
||||
URLMismatchError = DOMExceptionConstants::URL_MISMATCH_ERR as uint,
|
||||
QuotaExceededError = DOMExceptionConstants::QUOTA_EXCEEDED_ERR as uint,
|
||||
TimeoutError = DOMExceptionConstants::TIMEOUT_ERR as uint,
|
||||
InvalidNodeTypeError = DOMExceptionConstants::INVALID_NODE_TYPE_ERR as uint,
|
||||
DataCloneError = DOMExceptionConstants::DATA_CLONE_ERR as uint,
|
||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
||||
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
|
||||
WrongDocumentError = DOMExceptionConstants::WRONG_DOCUMENT_ERR,
|
||||
InvalidCharacterError = DOMExceptionConstants::INVALID_CHARACTER_ERR,
|
||||
NoModificationAllowedError = DOMExceptionConstants::NO_MODIFICATION_ALLOWED_ERR,
|
||||
NotFoundError = DOMExceptionConstants::NOT_FOUND_ERR,
|
||||
NotSupportedError = DOMExceptionConstants::NOT_SUPPORTED_ERR,
|
||||
InvalidStateError = DOMExceptionConstants::INVALID_STATE_ERR,
|
||||
SyntaxError = DOMExceptionConstants::SYNTAX_ERR,
|
||||
InvalidModificationError = DOMExceptionConstants::INVALID_MODIFICATION_ERR,
|
||||
NamespaceError = DOMExceptionConstants::NAMESPACE_ERR,
|
||||
InvalidAccessError = DOMExceptionConstants::INVALID_ACCESS_ERR,
|
||||
SecurityError = DOMExceptionConstants::SECURITY_ERR,
|
||||
NetworkError = DOMExceptionConstants::NETWORK_ERR,
|
||||
AbortError = DOMExceptionConstants::ABORT_ERR,
|
||||
URLMismatchError = DOMExceptionConstants::URL_MISMATCH_ERR,
|
||||
QuotaExceededError = DOMExceptionConstants::QUOTA_EXCEEDED_ERR,
|
||||
TimeoutError = DOMExceptionConstants::TIMEOUT_ERR,
|
||||
InvalidNodeTypeError = DOMExceptionConstants::INVALID_NODE_TYPE_ERR,
|
||||
DataCloneError = DOMExceptionConstants::DATA_CLONE_ERR,
|
||||
EncodingError
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
|
|||
-> Fallible<Temporary<Document>> {
|
||||
let window = self.window.root();
|
||||
let url = window.r().get_url();
|
||||
let content_type = DOMParserBinding::SupportedTypeValues::strings[ty as uint].to_owned();
|
||||
let content_type = DOMParserBinding::SupportedTypeValues::strings[ty as usize].to_owned();
|
||||
match ty {
|
||||
Text_html => {
|
||||
let document = Document::new(window.r(), Some(url.clone()),
|
||||
|
|
|
@ -43,7 +43,7 @@ impl<'a> DOMRectListMethods for JSRef<'a, DOMRectList> {
|
|||
fn Item(self, index: u32) -> Option<Temporary<DOMRect>> {
|
||||
let rects = &self.rects;
|
||||
if index < rects.len() as u32 {
|
||||
Some(Temporary::new(rects[index as uint].clone()))
|
||||
Some(Temporary::new(rects[index as usize].clone()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
|||
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
|
||||
fn Item(self, index: u32) -> Option<DOMString> {
|
||||
self.attribute().root().and_then(|attr| attr.r().value().tokens().and_then(|tokens| {
|
||||
tokens.get(index as uint).map(|token| token.as_slice().to_owned())
|
||||
tokens.get(index as usize).map(|token| token.as_slice().to_owned())
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,12 @@ use time;
|
|||
|
||||
#[jstraceable]
|
||||
#[derive(Copy)]
|
||||
#[repr(u16)]
|
||||
pub enum EventPhase {
|
||||
None = EventConstants::NONE as int,
|
||||
Capturing = EventConstants::CAPTURING_PHASE as int,
|
||||
AtTarget = EventConstants::AT_TARGET as int,
|
||||
Bubbling = EventConstants::BUBBLING_PHASE as int,
|
||||
None = EventConstants::NONE,
|
||||
Capturing = EventConstants::CAPTURING_PHASE,
|
||||
AtTarget = EventConstants::AT_TARGET,
|
||||
Bubbling = EventConstants::BUBBLING_PHASE,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
|
|
@ -189,16 +189,17 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
|||
|
||||
// http://dom.spec.whatwg.org/#dom-htmlcollection-item
|
||||
fn Item(self, index: u32) -> Option<Temporary<Element>> {
|
||||
let index = index as usize;
|
||||
match self.collection {
|
||||
CollectionTypeId::Static(ref elems) => elems
|
||||
.as_slice()
|
||||
.get(index as uint)
|
||||
.get(index)
|
||||
.map(|elem| Temporary::new(elem.clone())),
|
||||
CollectionTypeId::Live(ref root, ref filter) => {
|
||||
let root = root.root();
|
||||
HTMLCollection::traverse(root.r())
|
||||
.filter(|element| filter.filter(*element, root.r()))
|
||||
.nth(index as uint)
|
||||
.nth(index)
|
||||
.clone()
|
||||
.map(Temporary::from_rooted)
|
||||
}
|
||||
|
|
|
@ -60,10 +60,10 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
|||
fn Item(self, index: u32) -> Option<Temporary<Node>> {
|
||||
match self.list_type {
|
||||
_ if index >= self.Length() => None,
|
||||
NodeListType::Simple(ref elems) => Some(Temporary::new(elems[index as uint].clone())),
|
||||
NodeListType::Simple(ref elems) => Some(Temporary::new(elems[index as usize].clone())),
|
||||
NodeListType::Children(ref node) => {
|
||||
let node = node.root();
|
||||
node.r().children().nth(index as uint)
|
||||
node.r().children().nth(index as usize)
|
||||
.map(|child| Temporary::from_rooted(child))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ use js::jsval::{JSVal, UndefinedValue};
|
|||
use url::UrlParser;
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
|
||||
pub type TrustedWorkerAddress = Trusted<Worker>;
|
||||
|
@ -36,7 +35,6 @@ pub type TrustedWorkerAddress = Trusted<Worker>;
|
|||
#[dom_struct]
|
||||
pub struct Worker {
|
||||
eventtarget: EventTarget,
|
||||
refcount: Cell<uint>,
|
||||
global: GlobalField,
|
||||
/// Sender to the Receiver associated with the DedicatedWorkerGlobalScope
|
||||
/// this Worker created.
|
||||
|
@ -47,7 +45,6 @@ impl Worker {
|
|||
fn new_inherited(global: GlobalRef, sender: Sender<(TrustedWorkerAddress, ScriptMsg)>) -> Worker {
|
||||
Worker {
|
||||
eventtarget: EventTarget::new_inherited(EventTargetTypeId::Worker),
|
||||
refcount: Cell::new(0),
|
||||
global: GlobalField::from_rooted(&global),
|
||||
sender: sender,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue