From 5578b9abd25fcfb26a8301ce18bf0a9797ab733b Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Tue, 24 Jun 2025 16:36:23 +1000 Subject: [PATCH] Location type Co-authored-by: atbrakhi Signed-off-by: Delan Azabani --- components/devtools/actors/thread.rs | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/components/devtools/actors/thread.rs b/components/devtools/actors/thread.rs index e0a1e2d5e3b..bb4a07ed7e4 100644 --- a/components/devtools/actors/thread.rs +++ b/components/devtools/actors/thread.rs @@ -4,8 +4,9 @@ use std::net::TcpStream; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use serde_json::{Map, Value}; +use servo_url::ServoUrl; use super::source::{SourceManager, SourcesReply}; use crate::actor::{Actor, ActorMessageStatus, ActorRegistry}; @@ -64,6 +65,34 @@ impl ThreadActor { } } +/// Location inside a source. +/// +/// This can be in the code for the source itself, or the code of an `eval()` or `new Function()` +/// called from that source. +/// +/// +#[derive(Deserialize, Serialize)] +#[serde(untagged)] +pub enum Location { + Url { + url: ServoUrl, + line: usize, + column: usize, + }, + Eval { + eval: Box, + id: String, + line: usize, + column: usize, + }, + Function { + function: Box, + id: String, + line: usize, + column: usize, + }, +} + impl Actor for ThreadActor { fn name(&self) -> String { self.name.clone()