diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-08-11 01:12:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 01:12:12 -0400 |
commit | 3097eb7de933023aa3ff81cc26ff26ad749bcc10 (patch) | |
tree | d470d44a0702858ee5adbbef05a78536f4b08a8a /components/constellation | |
parent | 1470fd3f9fc4a066c9fda8086eab06140bc3623d (diff) | |
parent | fd9be5097d7a65af511ad4d19fa54971c58e210a (diff) | |
download | servo-3097eb7de933023aa3ff81cc26ff26ad749bcc10.tar.gz servo-3097eb7de933023aa3ff81cc26ff26ad749bcc10.zip |
Auto merge of #27562 - jdm:devtools-session-history, r=paulrouget
Notify devtools of session history traversals
This makes the remote devtools and devtools panel in FxR clear the console when going backwards and forwards through session history.
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27525
- [x] These changes do not require tests because no devtools tests.
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); |