mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +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
|
@ -19,7 +19,6 @@ use std::net::{Shutdown, TcpListener, TcpStream};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::thread;
|
||||
|
||||
use actors::source::SourceData;
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||
use devtools_traits::{
|
||||
|
@ -44,6 +43,7 @@ use crate::actors::performance::PerformanceActor;
|
|||
use crate::actors::preference::PreferenceActor;
|
||||
use crate::actors::process::ProcessActor;
|
||||
use crate::actors::root::RootActor;
|
||||
use crate::actors::source::{SourceActor, SourceData};
|
||||
use crate::actors::thread::ThreadActor;
|
||||
use crate::actors::worker::{WorkerActor, WorkerType};
|
||||
use crate::id::IdMap;
|
||||
|
@ -518,22 +518,31 @@ impl DevtoolsInstance {
|
|||
fn handle_script_source_info(&mut self, pipeline_id: PipelineId, source_info: SourceInfo) {
|
||||
let mut actors = self.actors.lock().unwrap();
|
||||
|
||||
let source_actor_name = SourceActor::new_source(
|
||||
&mut actors,
|
||||
source_info.content.clone(),
|
||||
source_info.content_type.unwrap(),
|
||||
);
|
||||
|
||||
if let Some(worker_id) = source_info.worker_id {
|
||||
let Some(worker_actor_name) = self.actor_workers.get(&worker_id) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let thread_actor_name = actors.find::<WorkerActor>(worker_actor_name).thread.clone();
|
||||
|
||||
let thread_actor = actors.find_mut::<ThreadActor>(&thread_actor_name);
|
||||
thread_actor
|
||||
.source_manager
|
||||
.add_source(source_info.url.clone());
|
||||
|
||||
thread_actor.source_manager.add_source(
|
||||
source_info.url.clone(),
|
||||
source_info.content.clone(),
|
||||
source_actor_name.clone(),
|
||||
);
|
||||
|
||||
let source = SourceData {
|
||||
actor: thread_actor_name.clone(),
|
||||
actor: source_actor_name,
|
||||
url: source_info.url.to_string(),
|
||||
is_black_boxed: false,
|
||||
source_content: source_info.content,
|
||||
};
|
||||
|
||||
let worker_actor = actors.find::<WorkerActor>(worker_actor_name);
|
||||
|
@ -549,20 +558,24 @@ impl DevtoolsInstance {
|
|||
return;
|
||||
};
|
||||
|
||||
let thread_actor_name = actors
|
||||
.find::<BrowsingContextActor>(actor_name)
|
||||
.thread
|
||||
.clone();
|
||||
let thread_actor_name = {
|
||||
let browsing_context = actors.find::<BrowsingContextActor>(actor_name);
|
||||
browsing_context.thread.clone()
|
||||
};
|
||||
|
||||
let thread_actor = actors.find_mut::<ThreadActor>(&thread_actor_name);
|
||||
thread_actor
|
||||
.source_manager
|
||||
.add_source(source_info.url.clone());
|
||||
|
||||
thread_actor.source_manager.add_source(
|
||||
source_info.url.clone(),
|
||||
source_info.content.clone(),
|
||||
source_actor_name.clone(),
|
||||
);
|
||||
|
||||
let source = SourceData {
|
||||
actor: thread_actor_name.clone(),
|
||||
actor: source_actor_name,
|
||||
url: source_info.url.to_string(),
|
||||
is_black_boxed: false,
|
||||
source_content: source_info.content,
|
||||
};
|
||||
|
||||
// Notify browsing context about the new source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue