mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #4575 : mttr/servo/warnings, r=jdm
Notes: * This adds `#![allow(missing_copy_implementations)]` to components/*/lib.rs. I'm not sure how to approach the missing Copy warnings (are there things for which Copy should NOT be implemented, and how can I tell?) so I stuck this in to make life easier when looking through the warnings. I can easily remove this if necessary. * This leaves the following type of warnings, which I couldn't figure out how to approach (I'll investigate it later if no one else wants to). ``` css/matching.rs:72:23: 72:35 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default css/matching.rs:72 this_as_query.equiv(other) ^~~~~~~~~~~~ css/matching.rs:95:10: 95:49 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default css/matching.rs:95 impl<'a> Equiv<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsCacheQuery<'a> { ```
This commit is contained in:
commit
0793137631
36 changed files with 88 additions and 74 deletions
|
@ -272,9 +272,8 @@ 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);
|
||||
slice::raw::buf_as_slice(chars, length as uint, |char_vec| {
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
})
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,14 +327,14 @@ impl FromJSValConvertible<()> for ByteString {
|
|||
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, string, &mut length);
|
||||
slice::raw::buf_as_slice(chars, length as uint, |char_vec| {
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
Err(())
|
||||
} else {
|
||||
Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect()))
|
||||
}
|
||||
})
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
Err(())
|
||||
} else {
|
||||
Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ use dom::node::Node;
|
|||
use js::jsapi::JSObject;
|
||||
use js::jsval::JSVal;
|
||||
use layout_interface::TrustedNodeAddress;
|
||||
use script_task::StackRoots;
|
||||
use script_task::STACK_ROOTS;
|
||||
|
||||
use servo_util::smallvec::{SmallVec, SmallVec16};
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
|
@ -101,7 +101,7 @@ impl<T: Reflectable> Temporary<T> {
|
|||
|
||||
/// Create a stack-bounded root for this value.
|
||||
pub fn root(self) -> Root<T> {
|
||||
StackRoots.with(|ref collection| {
|
||||
STACK_ROOTS.with(|ref collection| {
|
||||
let RootCollectionPtr(collection) = collection.get().unwrap();
|
||||
unsafe {
|
||||
Root::new(&*collection, &self.inner)
|
||||
|
@ -164,7 +164,7 @@ impl<T: Reflectable> JS<T> {
|
|||
|
||||
/// Root this JS-owned value to prevent its collection as garbage.
|
||||
pub fn root(&self) -> Root<T> {
|
||||
StackRoots.with(|ref collection| {
|
||||
STACK_ROOTS.with(|ref collection| {
|
||||
let RootCollectionPtr(collection) = collection.get().unwrap();
|
||||
unsafe {
|
||||
Root::new(&*collection, self)
|
||||
|
|
|
@ -36,7 +36,7 @@ use std::collections::hash_map::{HashMap, Vacant, Occupied};
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
thread_local!(pub static LiveReferences: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None)))
|
||||
thread_local!(pub static LIVE_REFERENCES: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None)))
|
||||
|
||||
|
||||
/// A safe wrapper around a raw pointer to a DOM object that can be
|
||||
|
@ -57,7 +57,7 @@ impl<T: Reflectable> Trusted<T> {
|
|||
/// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's
|
||||
/// lifetime.
|
||||
pub fn new(cx: *mut JSContext, ptr: JSRef<T>, script_chan: Box<ScriptChan + Send>) -> Trusted<T> {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
let refcount = live_references.addref(cx, &*ptr as *const T);
|
||||
|
@ -74,7 +74,7 @@ impl<T: Reflectable> Trusted<T> {
|
|||
/// a different thread than the original value from which this `Trusted<T>` was
|
||||
/// obtained.
|
||||
pub fn to_temporary(&self) -> Temporary<T> {
|
||||
assert!(LiveReferences.with(|ref r| {
|
||||
assert!(LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
self.owner_thread == (&*live_references) as *const _ as *const libc::c_void
|
||||
|
@ -123,7 +123,7 @@ pub struct LiveDOMReferences {
|
|||
impl LiveDOMReferences {
|
||||
/// Set up the task-local data required for storing the outstanding DOM references.
|
||||
pub fn initialize() {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
*r.borrow_mut() = Some(LiveDOMReferences {
|
||||
table: RefCell::new(HashMap::new()),
|
||||
})
|
||||
|
@ -152,7 +152,7 @@ impl LiveDOMReferences {
|
|||
|
||||
/// Unpin the given DOM object if its refcount is 0.
|
||||
pub fn cleanup(cx: *mut JSContext, raw_reflectable: *const libc::c_void) {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
let reflectable = raw_reflectable as *const Reflector;
|
||||
|
|
|
@ -87,14 +87,14 @@ impl EventTarget {
|
|||
}
|
||||
|
||||
pub fn get_listeners(&self, type_: &str) -> Option<Vec<EventListener>> {
|
||||
self.handlers.borrow().find_equiv(type_).map(|listeners| {
|
||||
self.handlers.borrow().get(type_).map(|listeners| {
|
||||
listeners.iter().map(|entry| entry.listener.get_listener()).collect()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_listeners_for(&self, type_: &str, desired_phase: ListenerPhase)
|
||||
-> Option<Vec<EventListener>> {
|
||||
self.handlers.borrow().find_equiv(type_).map(|listeners| {
|
||||
self.handlers.borrow().get(type_).map(|listeners| {
|
||||
let filtered = listeners.iter().filter(|entry| entry.phase == desired_phase);
|
||||
filtered.map(|entry| entry.listener.get_listener()).collect()
|
||||
})
|
||||
|
|
|
@ -81,7 +81,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
|||
}
|
||||
|
||||
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||
if self.data.borrow().contains_key_equiv(&name) {
|
||||
if self.data.borrow().contains_key(&name) {
|
||||
match (*self.data.borrow())[name][0].clone() {
|
||||
FormDatum::StringData(ref s) => Some(eString(s.clone())),
|
||||
FormDatum::FileData(ref f) => {
|
||||
|
@ -94,7 +94,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
|||
}
|
||||
|
||||
fn Has(self, name: DOMString) -> bool {
|
||||
self.data.borrow().contains_key_equiv(&name)
|
||||
self.data.borrow().contains_key(&name)
|
||||
}
|
||||
#[allow(unrooted_must_root)]
|
||||
fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
||||
|
|
|
@ -246,7 +246,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
|||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
// TODO: This is an incorrect way of getting controls owned
|
||||
// by the form, but good enough until html5ever lands
|
||||
let mut data_set = node.traverse_preorder().filter_map(|child| {
|
||||
let data_set = node.traverse_preorder().filter_map(|child| {
|
||||
if child.get_disabled_state() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -782,7 +782,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
fn query_selector_all(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||
// Step 1.
|
||||
unsafe {
|
||||
self.query_selector_iter(selectors).map(|mut iter| {
|
||||
self.query_selector_iter(selectors).map(|iter| {
|
||||
let window = window_from_node(self).root();
|
||||
NodeList::new_simple_list(window.r(), iter.collect())
|
||||
})
|
||||
|
|
|
@ -80,11 +80,11 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
|
|||
}
|
||||
|
||||
fn Get(self, name: DOMString) -> Option<DOMString> {
|
||||
self.data.borrow().find_equiv(&name).map(|v| v[0].clone())
|
||||
self.data.borrow().get(&name).map(|v| v[0].clone())
|
||||
}
|
||||
|
||||
fn Has(self, name: DOMString) -> bool {
|
||||
self.data.borrow().contains_key_equiv(&name)
|
||||
self.data.borrow().contains_key(&name)
|
||||
}
|
||||
|
||||
fn Set(self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -923,7 +923,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
|
||||
fn dispatch_response_progress_event(self, type_: DOMString) {
|
||||
let len = self.response.borrow().len() as u64;
|
||||
let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {x.len() as u64});
|
||||
let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {**x as u64});
|
||||
self.dispatch_progress_event(false, type_, len, total);
|
||||
}
|
||||
fn set_timeout(self, timeout: u32) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue