diff --git a/Cargo.lock b/Cargo.lock index 873a86647a9..75170722149 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,7 +230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "blurmac" version = "0.1.0" -source = "git+https://github.com/servo/devices#eeb6eaddb79c019bb5c85558b3410b836da57a57" +source = "git+https://github.com/servo/devices#967e13521ac9825a6664f1ed3fb2d2025cac0371" dependencies = [ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -238,19 +238,19 @@ dependencies = [ [[package]] name = "blurmock" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "blurz" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dbus 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "dbus 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -777,11 +777,11 @@ dependencies = [ [[package]] name = "dbus" -version = "0.5.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libdbus-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -820,12 +820,12 @@ dependencies = [ [[package]] name = "device" version = "0.0.1" -source = "git+https://github.com/servo/devices#eeb6eaddb79c019bb5c85558b3410b836da57a57" +source = "git+https://github.com/servo/devices#967e13521ac9825a6664f1ed3fb2d2025cac0371" dependencies = [ "blurdroid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "blurmac 0.1.0 (git+https://github.com/servo/devices)", - "blurmock 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "blurz 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "blurmock 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "blurz 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1619,6 +1619,11 @@ dependencies = [ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "histogram" version = "0.6.8" @@ -2043,7 +2048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libdbus-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3137,11 +3142,6 @@ name = "rustc-demangle" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "safemem" version = "0.2.0" @@ -3333,7 +3333,6 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "profile_traits 0.0.1", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "servo_atoms 0.0.1", "servo_channel 0.0.1", @@ -3583,8 +3582,8 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "servo_geometry 0.0.1", "servo_url 0.0.1", "std_test_override 0.0.1", @@ -4761,8 +4760,8 @@ dependencies = [ "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" "checksum blurdroid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "19b23557dd27704797128f9db2816416bef20dad62d4a9768714eeb65f07d296" "checksum blurmac 0.1.0 (git+https://github.com/servo/devices)" = "" -"checksum blurmock 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "68dd72da3a3bb40f3d3bdd366c4cf8e2b1d208c366304f382c80cef8126ca8da" -"checksum blurz 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e73bda0f4c71c63a047351070097f3f507e6718e86b9ee525173371ef7b94b73" +"checksum blurmock 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9c150fd617830fd121919bbd500a784507e8af1bae744efcf587591c65c375d4" +"checksum blurz 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6dae8337ff67fe8ead29a28a0115605753e6a5205d4b6017e9f42f198c3c50a" "checksum boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbec60c560f322d8e3cd403f91d8908cfd965fff53ba97154bd1b9d90149d98e" "checksum brotli 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6236055e28bc092d6d370f3219e6939d8ba8352b397e290391bb8af0d94f25" "checksum brotli-decompressor 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "471bf19486c9aaf5b817ed04c49ccc8acd8d28c70d5114e710e8b9f530df89cd" @@ -4809,7 +4808,7 @@ dependencies = [ "checksum darling 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a78af487e4eb8f4421a1770687b328af6bb4494ca93435210678c6eea875c11" "checksum darling_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b315f49c7b6db3708bca6e6913c194581a44ec619b7a39e131d4dd63733a3698" "checksum darling_macro 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb69a38fdeaeaf3db712e1df170de67ee9dfc24fb88ca3e9d21e703ec25a4d8e" -"checksum dbus 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "acd824d45fad5ff0e178fcb3c040f13780e73f63a0a6d5cde59e7894f251ab0e" +"checksum dbus 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d975a175aa2dced1a6cd410b89a1bf23918f301eab2b6f7c5e608291b757639" "checksum deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebb02aaf4b775afc96684b8402510a338086974e38570a1f65bea8c202eb77a7" "checksum device 0.0.1 (git+https://github.com/servo/devices)" = "" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" @@ -4880,6 +4879,7 @@ dependencies = [ "checksum headers-ext 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6657fda27978455d69652a0c817d5c73d6d3694d97027924477a1e1c66e33f61" "checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc" "checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum histogram 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1bdcec4094c1ca961b685384ea7af76af5718230b3f34657d1a71fd2dcf4cc9d" "checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364" "checksum http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "24f58e8c2d8e886055c3ead7b28793e1455270b5fb39650984c224bc538ba581" @@ -4912,7 +4912,7 @@ dependencies = [ "checksum leak 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73" "checksum leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc" "checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1" -"checksum libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8720f9274907052cb50313f91201597868da9d625f8dd125f2aca5bddb7e83a1" +"checksum libdbus-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "99c78106156a964aadc1c59f7798276967be6705243b60f3ab7e131e3841db88" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" "checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" @@ -5005,7 +5005,6 @@ dependencies = [ "checksum rust-webvr 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "9629ce5b5c3cda05259d225e639851daf39c55c170358d3056205dd205deaab2" "checksum rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "712e22ba3c03a7075b40842ae91029a0ab96a81f95e97c0cf623800ec0cbac07" "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a" diff --git a/components/config/Cargo.toml b/components/config/Cargo.toml index f08bf834deb..8f49daba0e3 100644 --- a/components/config/Cargo.toml +++ b/components/config/Cargo.toml @@ -19,8 +19,8 @@ getopts = "0.2.11" lazy_static = "1" log = "0.4" num_cpus = "1.1.0" -rustc-serialize = "0.3" serde = "1.0" +serde_json = "1.0" servo_geometry = {path = "../geometry"} servo_url = {path = "../url"} url = "1.2" diff --git a/components/config/lib.rs b/components/config/lib.rs index d1a63520f11..7f24eeb7c5c 100644 --- a/components/config/lib.rs +++ b/components/config/lib.rs @@ -14,9 +14,9 @@ extern crate lazy_static; #[macro_use] extern crate log; extern crate num_cpus; -extern crate rustc_serialize; #[macro_use] extern crate serde; +extern crate serde_json; extern crate servo_geometry; extern crate servo_url; extern crate url; diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 5b47a1a51a7..58a7648683a 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -6,7 +6,7 @@ use crate::basedir::default_config_dir; use crate::opts; use embedder_traits::resources::{self, Resource}; use num_cpus; -use rustc_serialize::json::{Json, ToJson}; +use serde_json::{self, Value}; use std::borrow::ToOwned; use std::cmp::max; use std::collections::HashMap; @@ -34,13 +34,17 @@ pub enum PrefValue { } impl PrefValue { - pub fn from_json(data: Json) -> Result { + pub fn from_json(data: Value) -> Result { let value = match data { - Json::Boolean(x) => PrefValue::Boolean(x), - Json::String(x) => PrefValue::String(x), - Json::F64(x) => PrefValue::Number(x), - Json::I64(x) => PrefValue::Number(x as f64), - Json::U64(x) => PrefValue::Number(x as f64), + Value::Bool(x) => PrefValue::Boolean(x), + Value::String(x) => PrefValue::String(x), + Value::Number(x) => { + if let Some(v) = x.as_f64() { + PrefValue::Number(v) + } else { + return Err(()); + } + }, _ => return Err(()), }; Ok(value) @@ -75,17 +79,6 @@ impl PrefValue { } } -impl ToJson for PrefValue { - fn to_json(&self) -> Json { - match *self { - PrefValue::Boolean(x) => Json::Boolean(x), - PrefValue::String(ref x) => Json::String(x.clone()), - PrefValue::Number(x) => Json::F64(x), - PrefValue::Missing => Json::Null, - } - } -} - #[derive(Clone, Debug, Deserialize, Serialize)] pub enum Pref { NoDefault(Arc), @@ -101,7 +94,7 @@ impl Pref { Pref::WithDefault(Arc::new(value), None) } - fn from_json(data: Json) -> Result { + fn from_json(data: Value) -> Result { let value = PrefValue::from_json(data)?; Ok(Pref::new_default(value)) } @@ -126,12 +119,6 @@ impl Pref { } } -impl ToJson for Pref { - fn to_json(&self) -> Json { - self.value().to_json() - } -} - pub fn default_prefs() -> Preferences { let prefs = Preferences(Arc::new(RwLock::new(HashMap::new()))); prefs.set( @@ -142,13 +129,13 @@ pub fn default_prefs() -> Preferences { } pub fn read_prefs(txt: &str) -> Result, ()> { - let json = Json::from_str(txt).or_else(|e| { + let json: Value = serde_json::from_str(txt).or_else(|e| { println!("Ignoring invalid JSON in preferences: {:?}.", e); Err(()) })?; let mut prefs = HashMap::new(); - if let Json::Object(obj) = json { + if let Value::Object(obj) = json { for (name, value) in obj.into_iter() { match Pref::from_json(value) { Ok(x) => { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index a8df59ca21c..330a1194d90 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -4420,7 +4420,7 @@ impl DocumentMethods for Document { } fn update_with_current_time_ms(marker: &Cell) { - if marker.get() == Default::default() { + if marker.get() == 0 { let time = time::get_time(); let current_time_ms = time.sec * 1000 + time.nsec as i64 / 1000000; marker.set(current_time_ms as u64); diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 250c14aa977..3b8430e4922 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -29,7 +29,6 @@ malloc_size_of_derive = { path = "../malloc_size_of_derive" } msg = {path = "../msg"} net_traits = {path = "../net_traits"} profile_traits = {path = "../profile_traits"} -rustc-serialize = "0.3.4" serde = "1.0" servo_atoms = {path = "../atoms"} servo_channel = {path = "../channel"} diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 5f54c4c6ce1..acc261033c9 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -29,7 +29,6 @@ extern crate malloc_size_of_derive; extern crate msg; extern crate net_traits; extern crate profile_traits; -extern crate rustc_serialize; #[macro_use] extern crate serde; extern crate servo_atoms; diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs index 98c2e37a22e..5e49864eb09 100644 --- a/components/script_traits/webdriver_msg.rs +++ b/components/script_traits/webdriver_msg.rs @@ -9,7 +9,6 @@ use euclid::Rect; use hyper_serde::Serde; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::BrowsingContextId; -use rustc_serialize::json::{Json, ToJson}; use servo_url::ServoUrl; #[derive(Debug, Deserialize, Serialize)] @@ -75,18 +74,6 @@ pub enum WebDriverFrameId { Parent, } -impl ToJson for WebDriverJSValue { - fn to_json(&self) -> Json { - match *self { - WebDriverJSValue::Undefined => Json::Null, - WebDriverJSValue::Null => Json::Null, - WebDriverJSValue::Boolean(ref x) => x.to_json(), - WebDriverJSValue::Number(ref x) => x.to_json(), - WebDriverJSValue::String(ref x) => x.to_json(), - } - } -} - #[derive(Debug, Deserialize, Serialize)] pub enum LoadStatus { LoadComplete,