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.
This commit is contained in:
bors-servo 2020-08-11 01:12:12 -04:00 committed by GitHub
commit 3097eb7de9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 2 deletions

View file

@ -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);
}