mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
DevTools: Implement support for showing source_content
in Debugger > Source
panel (#36774)
This patch adds support for showing source_content in `Debugger > Source` panel. This works by handling the clients `source` messages in the source actor. These source actors are already advertised as resource via the watcher, populating the source list. We also update the `sources` handler in thread actor for future work in thread debugging. Note: while this PR also adds support for showing worker script source_content, worker has been broken (See https://github.com/servo/servo/issues/37012). I was able to confirm the `content_type` and `source_content` for worker script in logs.  Fixes: part of https://github.com/servo/servo/issues/36027 --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
parent
5159529888
commit
7a801f0ef5
8 changed files with 204 additions and 42 deletions
|
@ -7,7 +7,7 @@ use std::net::TcpStream;
|
|||
use serde::Serialize;
|
||||
use serde_json::{Map, Value};
|
||||
|
||||
use super::source::{Source, SourcesReply};
|
||||
use super::source::{SourceData, SourceManager, SourcesReply};
|
||||
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
|
||||
use crate::protocol::JsonPacketStream;
|
||||
use crate::{EmptyReplyMsg, StreamId};
|
||||
|
@ -52,14 +52,14 @@ struct ThreadInterruptedReply {
|
|||
|
||||
pub struct ThreadActor {
|
||||
pub name: String,
|
||||
pub source_manager: Source,
|
||||
pub source_manager: SourceManager,
|
||||
}
|
||||
|
||||
impl ThreadActor {
|
||||
pub fn new(name: String) -> ThreadActor {
|
||||
ThreadActor {
|
||||
name: name.clone(),
|
||||
source_manager: Source::new(name),
|
||||
source_manager: SourceManager::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,14 +124,21 @@ impl Actor for ThreadActor {
|
|||
// Client has attached to the thread and wants to load script sources.
|
||||
// <https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#loading-script-sources>
|
||||
"sources" => {
|
||||
let sources: Vec<SourceData> = self
|
||||
.source_manager
|
||||
.source_urls
|
||||
.borrow()
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
let msg = SourcesReply {
|
||||
from: self.name(),
|
||||
sources: vec![], // TODO: Add sources for the debugger here
|
||||
sources,
|
||||
};
|
||||
let _ = stream.write_json_packet(&msg);
|
||||
ActorMessageStatus::Processed
|
||||
},
|
||||
|
||||
_ => ActorMessageStatus::Ignored,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue