Actor::handle_message should return an enum instad of a boolean #7110 r=jdm

This commit is contained in:
Fabrice Desré 2015-08-13 18:14:34 -07:00
parent f5e97ef1b5
commit c7b48240b0
12 changed files with 83 additions and 76 deletions

View file

@ -7,7 +7,7 @@
/// Connection point for all new remote devtools interactions, providing lists of know actors
/// that perform more specific actions (tabs, addons, browser chrome, etc.)
use actor::{Actor, ActorRegistry};
use actor::{Actor, ActorRegistry, ActorMessageStatus};
use actors::tab::{TabActor, TabActorMsg};
use protocol::JsonPacketStream;
@ -55,7 +55,7 @@ impl Actor for RootActor {
registry: &ActorRegistry,
msg_type: &str,
_msg: &json::Object,
stream: &mut TcpStream) -> Result<bool, ()> {
stream: &mut TcpStream) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type {
"listAddons" => {
let actor = ErrorReply {
@ -64,7 +64,7 @@ impl Actor for RootActor {
message: "This root actor has no browser addons.".to_string(),
};
stream.write_json_packet(&actor);
true
ActorMessageStatus::Processed
}
//https://wiki.mozilla.org/Remote_Debugging_Protocol#Listing_Browser_Tabs
@ -77,10 +77,10 @@ impl Actor for RootActor {
}).collect()
};
stream.write_json_packet(&actor);
true
ActorMessageStatus::Processed
}
_ => false
_ => ActorMessageStatus::Ignored
})
}
}