diff options
Diffstat (limited to 'components/devtools/lib.rs')
-rw-r--r-- | components/devtools/lib.rs | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 4d1e0222177..5fb9485e9d3 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -510,35 +510,54 @@ impl DevtoolsInstance { fn handle_script_source_info(&mut self, pipeline_id: PipelineId, source_info: SourceInfo) { let mut actors = self.actors.lock().unwrap(); - let browsing_context_id = match self.pipelines.get(&pipeline_id) { - Some(id) => id, - None => return, - }; + if let Some(worker_id) = source_info.worker_id { + let Some(worker_actor_name) = self.actor_workers.get(&worker_id) else { + return; + }; - let actor_name = match self.browsing_contexts.get(browsing_context_id) { - Some(name) => name, - None => return, - }; + let thread_actor_name = actors.find::<WorkerActor>(worker_actor_name).thread.clone(); - let thread_actor_name = actors - .find::<BrowsingContextActor>(actor_name) - .thread - .clone(); - - let thread_actor = actors.find_mut::<ThreadActor>(&thread_actor_name); - thread_actor - .source_manager - .add_source(source_info.url.clone()); - - let source = SourceData { - actor: thread_actor_name.clone(), - url: source_info.url.to_string(), - is_black_boxed: false, - }; + let thread_actor = actors.find_mut::<ThreadActor>(&thread_actor_name); + thread_actor + .source_manager + .add_source(source_info.url.clone()); + + let source = SourceData { + actor: thread_actor_name.clone(), + url: source_info.url.to_string(), + is_black_boxed: false, + }; - // Notify browsing context about the new source - let browsing_context = actors.find::<BrowsingContextActor>(actor_name); - browsing_context.resource_available(source, "source".into()); + let worker_actor = actors.find::<WorkerActor>(worker_actor_name); + worker_actor.resource_available(source, "source".into()); + } else { + let Some(browsing_context_id) = self.pipelines.get(&pipeline_id) else { + return; + }; + let Some(actor_name) = self.browsing_contexts.get(browsing_context_id) else { + return; + }; + + let thread_actor_name = actors + .find::<BrowsingContextActor>(actor_name) + .thread + .clone(); + + let thread_actor = actors.find_mut::<ThreadActor>(&thread_actor_name); + thread_actor + .source_manager + .add_source(source_info.url.clone()); + + let source = SourceData { + actor: thread_actor_name.clone(), + url: source_info.url.to_string(), + is_black_boxed: false, + }; + + // Notify browsing context about the new source + let browsing_context = actors.find::<BrowsingContextActor>(actor_name); + browsing_context.resource_available(source, "source".into()); + } } } |