diff options
Diffstat (limited to 'components/devtools')
-rw-r--r-- | components/devtools/Cargo.toml | 11 | ||||
-rw-r--r-- | components/devtools/actor.rs | 4 | ||||
-rw-r--r-- | components/devtools/actors/console.rs | 6 | ||||
-rw-r--r-- | components/devtools/actors/inspector.rs | 8 | ||||
-rw-r--r-- | components/devtools/actors/tab.rs | 2 | ||||
-rw-r--r-- | components/devtools/actors/timeline.rs | 4 | ||||
-rw-r--r-- | components/devtools/protocol.rs | 3 |
7 files changed, 18 insertions, 20 deletions
diff --git a/components/devtools/Cargo.toml b/components/devtools/Cargo.toml index 9bcf7f54a00..230c16af6c2 100644 --- a/components/devtools/Cargo.toml +++ b/components/devtools/Cargo.toml @@ -11,13 +11,14 @@ path = "lib.rs" [dependencies] devtools_traits = {path = "../devtools_traits"} -hyper = { version = "0.9.9", features = [ "serde-serialization" ] } -ipc-channel = "0.4.0" +hyper = "0.9.9" +hyper_serde = "0.1.4" +ipc-channel = "0.5" log = "0.3.5" msg = {path = "../msg"} plugins = {path = "../plugins"} -serde = "0.7.15" -serde_json = "0.7" -serde_macros = "0.7.15" +serde = "0.8" +serde_json = "0.8" +serde_macros = "0.8" time = "0.1" util = {path = "../util"} diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs index c439ad0e028..6d2e4ab1869 100644 --- a/components/devtools/actor.rs +++ b/components/devtools/actor.rs @@ -153,12 +153,12 @@ impl ActorRegistry { msg: &BTreeMap<String, Value>, stream: &mut TcpStream) -> Result<(), ()> { - let to = msg.get("to").unwrap().as_string().unwrap(); + let to = msg.get("to").unwrap().as_str().unwrap(); match self.actors.get(to) { None => debug!("message received for unknown actor \"{}\"", to), Some(actor) => { - let msg_type = msg.get("type").unwrap().as_string().unwrap(); + let msg_type = msg.get("type").unwrap().as_str().unwrap(); if try!(actor.handle_message(self, msg_type, msg, stream)) != ActorMessageStatus::Processed { debug!("unexpected message type \"{}\" found for actor \"{}\"", diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index d6cfbe10f51..67eea6f6714 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -103,7 +103,7 @@ impl Actor for ConsoleActor { Ok(match msg_type { "getCachedMessages" => { let str_types = msg.get("messageTypes").unwrap().as_array().unwrap().into_iter().map(|json_type| { - json_type.as_string().unwrap() + json_type.as_str().unwrap() }); let mut message_types = CachedConsoleMessageTypes::empty(); for str_type in str_types { @@ -154,7 +154,7 @@ impl Actor for ConsoleActor { .as_array() .unwrap_or(&vec!()) .iter() - .map(|listener| listener.as_string().unwrap().to_owned()) + .map(|listener| listener.as_str().unwrap().to_owned()) .collect(), }; stream.write_json_packet(&msg); @@ -174,7 +174,7 @@ impl Actor for ConsoleActor { } "evaluateJS" => { - let input = msg.get("text").unwrap().as_string().unwrap().to_owned(); + let input = msg.get("text").unwrap().as_str().unwrap().to_owned(); let (chan, port) = ipc::channel().unwrap(); self.script_chan.send(DevtoolScriptControlMsg::EvaluateJS( self.pipeline, input.clone(), chan)).unwrap(); diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index 0328c538e84..5e0d4455cc3 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -106,7 +106,7 @@ impl Actor for NodeActor { stream: &mut TcpStream) -> Result<ActorMessageStatus, ()> { Ok(match msg_type { "modifyAttributes" => { - let target = msg.get("to").unwrap().as_string().unwrap(); + let target = msg.get("to").unwrap().as_str().unwrap(); let mods = msg.get("modifications").unwrap().as_array().unwrap(); let modifications = mods.iter().map(|json_mod| { serde_json::from_str(&serde_json::to_string(json_mod).unwrap()).unwrap() @@ -310,7 +310,7 @@ impl Actor for WalkerActor { } "children" => { - let target = msg.get("node").unwrap().as_string().unwrap(); + let target = msg.get("node").unwrap().as_str().unwrap(); let (tx, rx) = ipc::channel().unwrap(); self.script_chan.send(GetChildren(self.pipeline, registry.actor_to_script(target.to_owned()), @@ -478,7 +478,7 @@ impl Actor for PageStyleActor { //TODO: query script for box layout properties of node (msg.node) "getLayout" => { - let target = msg.get("node").unwrap().as_string().unwrap(); + let target = msg.get("node").unwrap().as_str().unwrap(); let (tx, rx) = ipc::channel().unwrap(); self.script_chan.send(GetLayout(self.pipeline, registry.actor_to_script(target.to_owned()), @@ -493,7 +493,7 @@ impl Actor for PageStyleActor { } = try!(rx.recv().unwrap().ok_or(())); let auto_margins = msg.get("autoMargins") - .and_then(&Value::as_boolean).unwrap_or(false); + .and_then(&Value::as_bool).unwrap_or(false); // http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js let msg = GetLayoutReply { diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index fd93553e6b7..53b3766b124 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -94,7 +94,7 @@ impl Actor for TabActor { "reconfigure" => { if let Some(options) = msg.get("options").and_then(|o| o.as_object()) { if let Some(val) = options.get("performReload") { - if val.as_boolean().unwrap_or(false) { + if val.as_bool().unwrap_or(false) { let console_actor = registry.find::<ConsoleActor>(&self.console); let _ = console_actor.script_chan.send( DevtoolScriptControlMsg::Reload(console_actor.pipeline)); diff --git a/components/devtools/actors/timeline.rs b/components/devtools/actors/timeline.rs index 91231d08a52..5a2297407ca 100644 --- a/components/devtools/actors/timeline.rs +++ b/components/devtools/actors/timeline.rs @@ -191,14 +191,14 @@ impl Actor for TimelineActor { // init memory actor if let Some(with_memory) = msg.get("withMemory") { - if let Some(true) = with_memory.as_boolean() { + if let Some(true) = with_memory.as_bool() { *self.memory_actor.borrow_mut() = Some(MemoryActor::create(registry)); } } // init framerate actor if let Some(with_ticks) = msg.get("withTicks") { - if let Some(true) = with_ticks.as_boolean() { + if let Some(true) = with_ticks.as_bool() { let framerate_actor = Some(FramerateActor::create( registry, self.pipeline.clone(), diff --git a/components/devtools/protocol.rs b/components/devtools/protocol.rs index b385f396c1b..eb46ed38489 100644 --- a/components/devtools/protocol.rs +++ b/components/devtools/protocol.rs @@ -86,9 +86,6 @@ impl JsonPacketStream for TcpStream { serde_json::Error::Syntax(_, l, c) => { return Err(format!("syntax at {}:{}", l, c)) }, - serde_json::Error::FromUtf8(e) => { - return Err(e.description().to_owned()) - }, }, }; }, |