devtools: handle script task panics gracefully in ConsoleActor.

This commit is contained in:
Eduard Burtescu 2014-12-05 02:57:32 +02:00
parent 92a8c7a80c
commit b328c57caa
6 changed files with 44 additions and 31 deletions

View file

@ -66,8 +66,8 @@ impl Actor for HighlighterActor {
_registry: &ActorRegistry,
msg_type: &String,
_msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
stream: &mut TcpStream) -> Result<bool, ()> {
Ok(match msg_type.as_slice() {
"showBoxModel" => {
let msg = ShowBoxModelReply {
from: self.name(),
@ -85,7 +85,7 @@ impl Actor for HighlighterActor {
}
_ => false,
}
})
}
}
@ -103,8 +103,8 @@ impl Actor for NodeActor {
registry: &ActorRegistry,
msg_type: &String,
msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
stream: &mut TcpStream) -> Result<bool, ()> {
Ok(match msg_type.as_slice() {
"modifyAttributes" => {
let target = msg.get(&"to".to_string()).unwrap().as_string().unwrap();
let mods = msg.get(&"modifications".to_string()).unwrap().as_list().unwrap();
@ -123,7 +123,7 @@ impl Actor for NodeActor {
}
_ => false,
}
})
}
}
@ -276,8 +276,8 @@ impl Actor for WalkerActor {
registry: &ActorRegistry,
msg_type: &String,
msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
stream: &mut TcpStream) -> Result<bool, ()> {
Ok(match msg_type.as_slice() {
"querySelector" => {
let msg = QuerySelectorReply {
from: self.name(),
@ -329,7 +329,7 @@ impl Actor for WalkerActor {
}
_ => false,
}
})
}
}
@ -421,8 +421,8 @@ impl Actor for PageStyleActor {
registry: &ActorRegistry,
msg_type: &String,
msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
stream: &mut TcpStream) -> Result<bool, ()> {
Ok(match msg_type.as_slice() {
"getApplied" => {
//TODO: query script for relevant applied styles to node (msg.node)
let msg = GetAppliedReply {
@ -479,7 +479,7 @@ impl Actor for PageStyleActor {
}
_ => false,
}
})
}
}
@ -492,8 +492,8 @@ impl Actor for InspectorActor {
registry: &ActorRegistry,
msg_type: &String,
_msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
stream: &mut TcpStream) -> Result<bool, ()> {
Ok(match msg_type.as_slice() {
"getWalker" => {
if self.walker.borrow().is_none() {
let walker = WalkerActor {
@ -569,6 +569,6 @@ impl Actor for InspectorActor {
}
_ => false,
}
})
}
}