aboutsummaryrefslogtreecommitdiffstats
path: root/components/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'components/devtools')
-rw-r--r--components/devtools/actors/breakpoint.rs55
-rw-r--r--components/devtools/actors/browsing_context.rs9
-rw-r--r--components/devtools/actors/watcher.rs7
-rw-r--r--components/devtools/lib.rs1
4 files changed, 71 insertions, 1 deletions
diff --git a/components/devtools/actors/breakpoint.rs b/components/devtools/actors/breakpoint.rs
new file mode 100644
index 00000000000..04f2de140b4
--- /dev/null
+++ b/components/devtools/actors/breakpoint.rs
@@ -0,0 +1,55 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+
+use serde::Serialize;
+
+use crate::EmptyReplyMsg;
+use crate::actor::{Actor, ActorMessageStatus};
+use crate::protocol::JsonPacketStream;
+
+#[derive(Serialize)]
+pub struct BreakpointListActorMsg {
+ actor: String,
+}
+
+pub struct BreakpointListActor {
+ name: String,
+}
+
+impl Actor for BreakpointListActor {
+ fn name(&self) -> String {
+ self.name.clone()
+ }
+
+ fn handle_message(
+ &self,
+ _registry: &crate::actor::ActorRegistry,
+ msg_type: &str,
+ _msg: &serde_json::Map<String, serde_json::Value>,
+ stream: &mut std::net::TcpStream,
+ _stream_id: crate::StreamId,
+ ) -> Result<crate::actor::ActorMessageStatus, ()> {
+ Ok(match msg_type {
+ "setBreakpoint" => {
+ let msg = EmptyReplyMsg { from: self.name() };
+ let _ = stream.write_json_packet(&msg);
+
+ ActorMessageStatus::Processed
+ },
+ "setActiveEventBreakpoints" => {
+ let msg = EmptyReplyMsg { from: self.name() };
+ let _ = stream.write_json_packet(&msg);
+
+ ActorMessageStatus::Processed
+ },
+ _ => ActorMessageStatus::Ignored,
+ })
+ }
+}
+
+impl BreakpointListActor {
+ pub fn new(name: String) -> Self {
+ Self { name }
+ }
+}
diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs
index 81a00e82d47..fc5116131a0 100644
--- a/components/devtools/actors/browsing_context.rs
+++ b/components/devtools/actors/browsing_context.rs
@@ -82,6 +82,13 @@ struct BrowsingContextTraits {
}
#[derive(Serialize)]
+#[serde(rename_all = "lowercase")]
+enum TargetType {
+ Frame,
+ // Other target types not implemented yet.
+}
+
+#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BrowsingContextActorMsg {
actor: String,
@@ -104,6 +111,7 @@ pub struct BrowsingContextActorMsg {
reflow_actor: String,
style_sheets_actor: String,
thread_actor: String,
+ target_type: TargetType,
// Part of the official protocol, but not yet implemented.
// animations_actor: String,
// changes_actor: String,
@@ -302,6 +310,7 @@ impl BrowsingContextActor {
reflow_actor: self.reflow.clone(),
style_sheets_actor: self.style_sheets.clone(),
thread_actor: self.thread.clone(),
+ target_type: TargetType::Frame,
}
}
diff --git a/components/devtools/actors/watcher.rs b/components/devtools/actors/watcher.rs
index 061ffc92336..7720daf070d 100644
--- a/components/devtools/actors/watcher.rs
+++ b/components/devtools/actors/watcher.rs
@@ -19,6 +19,7 @@ use serde::Serialize;
use serde_json::{Map, Value};
use self::network_parent::{NetworkParentActor, NetworkParentActorMsg};
+use super::breakpoint::BreakpointListActor;
use super::thread::ThreadActor;
use super::worker::WorkerMsg;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
@@ -362,10 +363,14 @@ impl Actor for WatcherActor {
ActorMessageStatus::Processed
},
"getBreakpointListActor" => {
+ let breakpoint_list_name = registry.new_name("breakpoint-list");
+ let breakpoint_list = BreakpointListActor::new(breakpoint_list_name.clone());
+ registry.register_later(Box::new(breakpoint_list));
+
let _ = stream.write_json_packet(&GetBreakpointListActorReply {
from: self.name(),
breakpoint_list: GetBreakpointListActorReplyInner {
- actor: registry.new_name("breakpoint-list"),
+ actor: breakpoint_list_name,
},
});
ActorMessageStatus::Processed
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index d097cb25e9d..74a45eaf866 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -53,6 +53,7 @@ use crate::protocol::JsonPacketStream;
mod actor;
/// <https://searchfox.org/mozilla-central/source/devtools/server/actors>
mod actors {
+ pub mod breakpoint;
pub mod browsing_context;
pub mod console;
pub mod device;