diff options
Diffstat (limited to 'components/constellation')
-rw-r--r-- | components/constellation/constellation.rs | 25 | ||||
-rw-r--r-- | components/constellation/pipeline.rs | 4 |
2 files changed, 28 insertions, 1 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index f6e8d5c7469..e01dc7e76ef 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -112,7 +112,10 @@ use compositing::compositor_thread::Msg as ToCompositorMsg; use compositing::compositor_thread::WebrenderMsg; use compositing::{ConstellationMsg as FromCompositorMsg, SendableFrameTree}; use crossbeam_channel::{after, never, unbounded, Receiver, Sender}; -use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; +use devtools_traits::{ + ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState, + ScriptToDevtoolsControlMsg, +}; use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy, EventLoopWaker}; use embedder_traits::{MediaSessionEvent, MediaSessionPlaybackState}; use euclid::{default::Size2D as UntypedSize2D, Size2D}; @@ -1937,6 +1940,11 @@ where BrowsingContextId::from(source_top_ctx_id), FromScriptMsg::GetWebGPUChan(sender), ), + FromScriptMsg::TitleChanged(pipeline, title) => { + if let Some(pipeline) = self.pipelines.get_mut(&pipeline) { + pipeline.title = title; + } + }, } } @@ -3938,6 +3946,21 @@ where old_pipeline.notify_visibility(false); } if let Some(new_pipeline) = self.pipelines.get(&new_pipeline_id) { + if let Some(ref chan) = self.devtools_chan { + let state = NavigationState::Start(new_pipeline.url.clone()); + let _ = chan.send(DevtoolsControlMsg::FromScript( + ScriptToDevtoolsControlMsg::Navigate(browsing_context_id, state), + )); + let page_info = DevtoolsPageInfo { + title: new_pipeline.title.clone(), + url: new_pipeline.url.clone(), + }; + let state = NavigationState::Stop(new_pipeline.id, page_info); + let _ = chan.send(DevtoolsControlMsg::FromScript( + ScriptToDevtoolsControlMsg::Navigate(browsing_context_id, state), + )); + } + new_pipeline.notify_visibility(true); } diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 40d38c13159..108bc403e42 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -97,6 +97,9 @@ pub struct Pipeline { /// Has this pipeline received a notification that it is completely loaded? pub completely_loaded: bool, + + /// The title of this pipeline's document. + pub title: String, } /// Initial setup data needed to construct a pipeline. @@ -379,6 +382,7 @@ impl Pipeline { history_state_id: None, history_states: HashSet::new(), completely_loaded: false, + title: String::new(), }; pipeline.notify_visibility(is_visible); |