Fix some warnings caused by the SM upgrade

This commit is contained in:
Michael Wu 2015-06-19 22:07:08 -04:00
parent e7808c526c
commit b7301ca06c
13 changed files with 16 additions and 19 deletions

View file

@ -143,7 +143,7 @@ impl CallbackInterface {
/// Wraps the reflector for `p` into the compartment of `cx`. /// Wraps the reflector for `p` into the compartment of `cx`.
pub fn wrap_call_this_object<T: Reflectable>(cx: *mut JSContext, pub fn wrap_call_this_object<T: Reflectable>(cx: *mut JSContext,
p: &T, p: &T,
mut rval: MutableHandleObject) { rval: MutableHandleObject) {
rval.set(p.reflector().get_jsobject().get()); rval.set(p.reflector().get_jsobject().get());
assert!(!rval.get().is_null()); assert!(!rval.get().is_null());

View file

@ -8,7 +8,7 @@ use dom::bindings::trace::JSTraceable;
use js::jsapi::{JSTracer}; use js::jsapi::{JSTracer};
use util::task_state; use util::task_state;
use util::task_state::{SCRIPT, IN_GC}; use util::task_state::SCRIPT;
use std::cell::{BorrowState, RefCell, Ref, RefMut}; use std::cell::{BorrowState, RefCell, Ref, RefMut};

View file

@ -16,7 +16,6 @@ use js::jsapi::{JS_ReportErrorNumber1, JSErrorFormatString, JSExnType};
use js::jsapi::{JS_SaveFrameChain, JS_RestoreFrameChain}; use js::jsapi::{JS_SaveFrameChain, JS_RestoreFrameChain};
use js::jsapi::JSAutoCompartment; use js::jsapi::JSAutoCompartment;
use js::jsval::UndefinedValue; use js::jsval::UndefinedValue;
use js::JSFalse;
use libc; use libc;
use std::ffi::CString; use std::ffi::CString;

View file

@ -28,7 +28,7 @@ use dom::bindings::trace::trace_reflector;
use dom::bindings::utils::{Reflector, Reflectable}; use dom::bindings::utils::{Reflector, Reflectable};
use dom::node::Node; use dom::node::Node;
use js::jsapi::{JSObject, Heap, JSTracer}; use js::jsapi::{JSObject, Heap, JSTracer};
use js::jsval::{JSVal, UndefinedValue}; use js::jsval::JSVal;
use layout_interface::TrustedNodeAddress; use layout_interface::TrustedNodeAddress;
use script_task::STACK_ROOTS; use script_task::STACK_ROOTS;

View file

@ -84,9 +84,9 @@ pub unsafe extern fn delete(cx: *mut JSContext, proxy: HandleObject, id: HandleI
} }
/// Stub for ownPropertyKeys /// Stub for ownPropertyKeys
pub unsafe extern fn own_property_keys(cx: *mut JSContext, pub unsafe extern fn own_property_keys(_cx: *mut JSContext,
proxy: HandleObject, _proxy: HandleObject,
props: *mut AutoIdVector) -> u8 { _props: *mut AutoIdVector) -> u8 {
// FIXME: implement this // FIXME: implement this
// https://github.com/servo/servo/issues/6390 // https://github.com/servo/servo/issues/6390
JSTrue JSTrue

View file

@ -65,11 +65,11 @@ impl<T: Reflectable> Trusted<T> {
/// Create a new `Trusted<T>` instance from an existing DOM pointer. The DOM object will /// Create a new `Trusted<T>` instance from an existing DOM pointer. The DOM object will
/// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's /// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's
/// lifetime. /// lifetime.
pub fn new(cx: *mut JSContext, ptr: &T, script_chan: Box<ScriptChan + Send>) -> Trusted<T> { pub fn new(_cx: *mut JSContext, ptr: &T, script_chan: Box<ScriptChan + Send>) -> Trusted<T> {
LIVE_REFERENCES.with(|ref r| { LIVE_REFERENCES.with(|ref r| {
let r = r.borrow(); let r = r.borrow();
let live_references = r.as_ref().unwrap(); let live_references = r.as_ref().unwrap();
let refcount = live_references.addref(cx, &*ptr as *const T); let refcount = live_references.addref(&*ptr as *const T);
Trusted { Trusted {
ptr: &*ptr as *const T as *const libc::c_void, ptr: &*ptr as *const T as *const libc::c_void,
refcount: refcount, refcount: refcount,
@ -144,7 +144,7 @@ impl LiveDOMReferences {
}); });
} }
fn addref<T: Reflectable>(&self, cx: *mut JSContext, ptr: *const T) -> Arc<Mutex<usize>> { fn addref<T: Reflectable>(&self, ptr: *const T) -> Arc<Mutex<usize>> {
let mut table = self.table.borrow_mut(); let mut table = self.table.borrow_mut();
match table.entry(ptr as *const libc::c_void) { match table.entry(ptr as *const libc::c_void) {
Occupied(mut entry) => { Occupied(mut entry) => {
@ -161,7 +161,7 @@ impl LiveDOMReferences {
} }
/// Unpin the given DOM object if its refcount is 0. /// Unpin the given DOM object if its refcount is 0.
pub fn cleanup(cx: *mut JSContext, raw_reflectable: TrustedReference) { pub fn cleanup(raw_reflectable: TrustedReference) {
let TrustedReference(raw_reflectable) = raw_reflectable; let TrustedReference(raw_reflectable) = raw_reflectable;
LIVE_REFERENCES.with(|ref r| { LIVE_REFERENCES.with(|ref r| {
let r = r.borrow(); let r = r.borrow();

View file

@ -633,7 +633,7 @@ pub unsafe fn trace_global(tracer: *mut JSTracer, obj: *mut JSObject) {
} }
unsafe extern fn wrap(cx: *mut JSContext, unsafe extern fn wrap(cx: *mut JSContext,
existing: HandleObject, _existing: HandleObject,
obj: HandleObject) obj: HandleObject)
-> *mut JSObject { -> *mut JSObject {
// FIXME terrible idea. need security wrappers // FIXME terrible idea. need security wrappers

View file

@ -258,8 +258,7 @@ impl<'a> PrivateDedicatedWorkerGlobalScopeHelpers for &'a DedicatedWorkerGlobalS
runnable.handler() runnable.handler()
}, },
ScriptMsg::RefcountCleanup(addr) => { ScriptMsg::RefcountCleanup(addr) => {
let scope = WorkerGlobalScopeCast::from_ref(self); LiveDOMReferences::cleanup(addr);
LiveDOMReferences::cleanup(scope.get_cx(), addr);
} }
ScriptMsg::FireTimer(TimerSource::FromWorker, timer_id) => { ScriptMsg::FireTimer(TimerSource::FromWorker, timer_id) => {
let scope = WorkerGlobalScopeCast::from_ref(self); let scope = WorkerGlobalScopeCast::from_ref(self);

View file

@ -1719,7 +1719,7 @@ impl<'a> DocumentMethods for &'a Document {
} }
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter // https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
fn NamedGetter(self, cx: *mut JSContext, name: DOMString, found: &mut bool) fn NamedGetter(self, _cx: *mut JSContext, name: DOMString, found: &mut bool)
-> *mut JSObject { -> *mut JSObject {
#[jstraceable] #[jstraceable]
struct NamedElementFilter { struct NamedElementFilter {

View file

@ -26,7 +26,6 @@ use dom::webglrenderingcontext::{WebGLRenderingContext, LayoutCanvasWebGLRenderi
use util::str::{DOMString, parse_unsigned_integer}; use util::str::{DOMString, parse_unsigned_integer};
use js::jsapi::{JSContext, HandleValue}; use js::jsapi::{JSContext, HandleValue};
use js::jsval::JSVal;
use offscreen_gl_context::GLContextAttributes; use offscreen_gl_context::GLContextAttributes;
use euclid::size::Size2D; use euclid::size::Size2D;

View file

@ -67,7 +67,7 @@ impl<'a> StyleElementHelpers for &'a HTMLStyleElement {
let mq_attribute = element.get_attribute(&ns!(""), &atom!("media")); let mq_attribute = element.get_attribute(&ns!(""), &atom!("media"));
let mq_str = match mq_attribute { let mq_str = match mq_attribute {
Some(a) => String::from_str(&**a.r().value()), Some(a) => String::from(&**a.r().value()),
None => String::new(), None => String::new(),
}; };
let mut css_parser = CssParser::new(&mq_str); let mut css_parser = CssParser::new(&mq_str);

View file

@ -1046,7 +1046,7 @@ impl<'a> NodeHelpers for &'a Node {
/// If the given untrusted node address represents a valid DOM node in the given runtime, /// If the given untrusted node address represents a valid DOM node in the given runtime,
/// returns it. /// returns it.
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress) pub fn from_untrusted_node_address(_runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
-> Root<Node> { -> Root<Node> {
unsafe { unsafe {
// https://github.com/servo/servo/issues/6383 // https://github.com/servo/servo/issues/6383

View file

@ -780,7 +780,7 @@ impl ScriptTask {
ScriptMsg::MainThreadRunnableMsg(runnable) => ScriptMsg::MainThreadRunnableMsg(runnable) =>
runnable.handler(self), runnable.handler(self),
ScriptMsg::RefcountCleanup(addr) => ScriptMsg::RefcountCleanup(addr) =>
LiveDOMReferences::cleanup(self.get_cx(), addr), LiveDOMReferences::cleanup(addr),
ScriptMsg::DocumentLoadsComplete(id) => ScriptMsg::DocumentLoadsComplete(id) =>
self.handle_loads_complete(id), self.handle_loads_complete(id),
} }