mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
devtools: handle script task panics gracefully in ConsoleActor.
This commit is contained in:
parent
92a8c7a80c
commit
b328c57caa
6 changed files with 44 additions and 31 deletions
|
@ -118,8 +118,8 @@ impl Actor for ConsoleActor {
|
|||
_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() {
|
||||
"getCachedMessages" => {
|
||||
let types = msg.get(&"messageTypes".to_string()).unwrap().as_list().unwrap();
|
||||
let /*mut*/ messages = vec!();
|
||||
|
@ -223,7 +223,7 @@ impl Actor for ConsoleActor {
|
|||
self.script_chan.send(EvaluateJS(self.pipeline, input.clone(), chan));
|
||||
|
||||
//TODO: extract conversion into protocol module or some other useful place
|
||||
let result = match port.recv() {
|
||||
let result = match try!(port.recv_opt()) {
|
||||
VoidValue => {
|
||||
let mut m = TreeMap::new();
|
||||
m.insert("type".to_string(), "undefined".to_string().to_json());
|
||||
|
@ -285,6 +285,6 @@ impl Actor for ConsoleActor {
|
|||
}
|
||||
|
||||
_ => false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ impl Actor for RootActor {
|
|||
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() {
|
||||
"listAddons" => {
|
||||
let actor = ErrorReply {
|
||||
from: "root".to_string(),
|
||||
|
@ -80,7 +80,7 @@ impl Actor for RootActor {
|
|||
}
|
||||
|
||||
_ => false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ impl Actor for TabActor {
|
|||
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() {
|
||||
"reconfigure" => {
|
||||
stream.write_json_packet(&ReconfigureReply { from: self.name() });
|
||||
true
|
||||
|
@ -125,7 +125,7 @@ impl Actor for TabActor {
|
|||
}
|
||||
|
||||
_ => false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue