diff --git a/components/devtools/actors/thread.rs b/components/devtools/actors/thread.rs index 102590d0ab6..883e2e3e7c1 100644 --- a/components/devtools/actors/thread.rs +++ b/components/devtools/actors/thread.rs @@ -2,8 +2,9 @@ * 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 serde::{Deserialize, Serialize}; use serde_json::{Map, Value}; +use servo_url::ServoUrl; use super::source::{SourceManager, SourcesReply}; use crate::actor::{Actor, ActorError, ActorRegistry}; @@ -62,6 +63,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()