Properly return an empty list in devtools' listAddons

This commit is contained in:
Anthony Ramine 2016-03-23 20:04:58 +01:00
parent 327f1c1eb8
commit b409926111

View file

@ -21,12 +21,14 @@ struct ActorTraits {
} }
#[derive(RustcEncodable)] #[derive(RustcEncodable)]
struct ErrorReply { struct ListAddonsReply {
from: String, from: String,
error: String, addons: Vec<AddonMsg>,
message: String,
} }
#[derive(RustcEncodable)]
enum AddonMsg {}
#[derive(RustcEncodable)] #[derive(RustcEncodable)]
struct ListTabsReply { struct ListTabsReply {
from: String, from: String,
@ -57,10 +59,9 @@ impl Actor for RootActor {
stream: &mut TcpStream) -> Result<ActorMessageStatus, ()> { stream: &mut TcpStream) -> Result<ActorMessageStatus, ()> {
Ok(match msg_type { Ok(match msg_type {
"listAddons" => { "listAddons" => {
let actor = ErrorReply { let actor = ListAddonsReply {
from: "root".to_owned(), from: "root".to_owned(),
error: "noAddons".to_owned(), addons: vec![],
message: "This root actor has no browser addons.".to_owned(),
}; };
stream.write_json_packet(&actor); stream.write_json_packet(&actor);
ActorMessageStatus::Processed ActorMessageStatus::Processed