mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Upgrade to rustc d2b30f7d3 2014-09-23
This commit is contained in:
parent
a58324f25b
commit
b3245fa407
51 changed files with 227 additions and 197 deletions
|
@ -23,7 +23,7 @@ use js::jsval::{UndefinedValue, NullValue, BooleanValue, Int32Value, UInt32Value
|
|||
use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue};
|
||||
use js::glue::RUST_JS_NumberValue;
|
||||
use libc;
|
||||
use std::default::Default;
|
||||
use std::default;
|
||||
use std::slice;
|
||||
|
||||
use dom::bindings::codegen::PrototypeList;
|
||||
|
@ -67,10 +67,10 @@ impl ToJSValConvertible for JSVal {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe fn convert_from_jsval<T: Default>(
|
||||
unsafe fn convert_from_jsval<T: default::Default>(
|
||||
cx: *mut JSContext, value: JSVal,
|
||||
convert_fn: unsafe extern "C" fn(*mut JSContext, JSVal, *mut T) -> JSBool) -> Result<T, ()> {
|
||||
let mut ret = Default::default();
|
||||
let mut ret = default::Default::default();
|
||||
if convert_fn(cx, value, &mut ret) == 0 {
|
||||
Err(())
|
||||
} else {
|
||||
|
@ -246,7 +246,7 @@ pub enum StringificationBehavior {
|
|||
Empty,
|
||||
}
|
||||
|
||||
impl Default for StringificationBehavior {
|
||||
impl default::Default for StringificationBehavior {
|
||||
fn default() -> StringificationBehavior {
|
||||
Default
|
||||
}
|
||||
|
@ -355,12 +355,12 @@ impl<T: ToJSValConvertible> ToJSValConvertible for Option<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<X: Default, T: FromJSValConvertible<X>> FromJSValConvertible<()> for Option<T> {
|
||||
impl<X: default::Default, T: FromJSValConvertible<X>> FromJSValConvertible<()> for Option<T> {
|
||||
fn from_jsval(cx: *mut JSContext, value: JSVal, _: ()) -> Result<Option<T>, ()> {
|
||||
if value.is_null_or_undefined() {
|
||||
Ok(None)
|
||||
} else {
|
||||
let option: X = Default::default();
|
||||
let option: X = default::Default::default();
|
||||
let result: Result<T, ()> = FromJSValConvertible::from_jsval(cx, value, option);
|
||||
result.map(Some)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use dom::bindings::conversions::FromJSValConvertible;
|
|||
use dom::bindings::js::{JS, JSRef, Root};
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
use dom::window::Window;
|
||||
use dom::window;
|
||||
use script_task::ScriptChan;
|
||||
|
||||
use servo_net::resource_task::ResourceTask;
|
||||
|
@ -27,13 +27,13 @@ use std::ptr;
|
|||
|
||||
/// A freely-copyable reference to a rooted global object.
|
||||
pub enum GlobalRef<'a> {
|
||||
Window(JSRef<'a, Window>),
|
||||
Window(JSRef<'a, window::Window>),
|
||||
Worker(JSRef<'a, WorkerGlobalScope>),
|
||||
}
|
||||
|
||||
/// A stack-based rooted reference to a global object.
|
||||
pub enum GlobalRoot<'a, 'b> {
|
||||
WindowRoot(Root<'a, 'b, Window>),
|
||||
WindowRoot(Root<'a, 'b, window::Window>),
|
||||
WorkerRoot(Root<'a, 'b, WorkerGlobalScope>),
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ pub enum GlobalRoot<'a, 'b> {
|
|||
#[jstraceable]
|
||||
#[must_root]
|
||||
pub enum GlobalField {
|
||||
WindowField(JS<Window>),
|
||||
WindowField(JS<window::Window>),
|
||||
WorkerField(JS<WorkerGlobalScope>),
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ impl<'a> GlobalRef<'a> {
|
|||
|
||||
/// Extract a `Window`, causing task failure if the global object is not
|
||||
/// a `Window`.
|
||||
pub fn as_window<'b>(&'b self) -> JSRef<'b, Window> {
|
||||
pub fn as_window<'b>(&'b self) -> JSRef<'b, window::Window> {
|
||||
match *self {
|
||||
Window(window) => window,
|
||||
Worker(_) => fail!("expected a Window scope"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue