Update devtools server for Firefox 71.

This commit is contained in:
Josh Matthews 2019-12-10 19:46:17 -05:00
parent b3b72cb9e3
commit 84074d3c86
9 changed files with 339 additions and 21 deletions

View file

@ -37,6 +37,7 @@ struct GetRootReply {
selected: u32,
performanceActor: String,
deviceActor: String,
preferenceActor: String,
}
#[derive(Serialize)]
@ -46,6 +47,12 @@ struct ListTabsReply {
tabs: Vec<BrowsingContextActorMsg>,
}
#[derive(Serialize)]
struct GetTabReply {
from: String,
tab: BrowsingContextActorMsg,
}
#[derive(Serialize)]
pub struct RootActorMsg {
from: String,
@ -59,16 +66,54 @@ pub struct ProtocolDescriptionReply {
types: Types,
}
#[derive(Serialize)]
struct ListWorkersReply {
from: String,
workers: Vec<WorkerMsg>,
}
#[derive(Serialize)]
struct WorkerMsg {
id: u32,
}
#[derive(Serialize)]
struct ListServiceWorkerRegistrationsReply {
from: String,
registrations: Vec<u32>, // TODO: follow actual JSON structure.
}
#[derive(Serialize)]
pub struct Types {
performance: ActorDescription,
device: ActorDescription,
}
#[derive(Serialize)]
struct ListProcessesResponse {
from: String,
processes: Vec<ProcessForm>,
}
#[derive(Serialize)]
struct ProcessForm {
actor: String,
id: u32,
isParent: bool,
}
#[derive(Serialize)]
struct GetProcessResponse {
from: String,
form: ProcessForm,
}
pub struct RootActor {
pub tabs: Vec<String>,
pub performance: String,
pub device: String,
pub preference: String,
pub process: String,
}
impl Actor for RootActor {
@ -93,12 +138,39 @@ impl Actor for RootActor {
ActorMessageStatus::Processed
},
"listProcesses" => {
let reply = ListProcessesResponse {
from: self.name(),
processes: vec![ProcessForm {
actor: self.process.clone(),
id: 0,
isParent: true,
}],
};
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"getProcess" => {
let reply = GetProcessResponse {
from: self.name(),
form: ProcessForm {
actor: self.process.clone(),
id: 0,
isParent: true,
},
};
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"getRoot" => {
let actor = GetRootReply {
from: "root".to_owned(),
selected: 0,
performanceActor: self.performance.clone(),
deviceActor: self.device.clone(),
preferenceActor: self.preference.clone(),
};
stream.write_json_packet(&actor);
ActorMessageStatus::Processed
@ -119,6 +191,34 @@ impl Actor for RootActor {
ActorMessageStatus::Processed
},
"listServiceWorkerRegistrations" => {
let reply = ListServiceWorkerRegistrationsReply {
from: self.name(),
registrations: vec![],
};
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"listWorkers" => {
let reply = ListWorkersReply {
from: self.name(),
workers: vec![],
};
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"getTab" => {
let tab = registry.find::<BrowsingContextActor>(&self.tabs[0]);
let reply = GetTabReply {
from: self.name(),
tab: tab.encodable(),
};
stream.write_json_packet(&reply);
ActorMessageStatus::Processed
},
"protocolDescription" => {
let msg = ProtocolDescriptionReply {
from: self.name(),