aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2020-04-25 12:21:18 -0400
committerJosh Matthews <josh@joshmatthews.net>2020-04-26 18:11:23 -0400
commit7c48644cad88fc86c4324b554f1b4edf2a3b4db0 (patch)
tree73b1920911ea0971459538e07292817392103784 /components/script/script_thread.rs
parent0540c4a284952145773e3c86d0f57f69a83283f1 (diff)
downloadservo-7c48644cad88fc86c4324b554f1b4edf2a3b4db0.tar.gz
servo-7c48644cad88fc86c4324b554f1b4edf2a3b4db0.zip
Support navigating browsing contexts in the devtools.
Break the association between pipelines and browsing context actors. Now there is one browsing context actor per actual browsing context, and individual actors keep track of known pipelines as necessary. There is also one console/performance/timeline/inspector/etc. actor per browsing context. This also centralizes more information in the browsing context actor. Rather than duplicating state for the active pipeline in actors that need to use it, each actor now remembers the name of its associated browsing context actor and obtains that state whenever it's necessary.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 7a672851ba6..7431bcf1032 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -93,7 +93,7 @@ use canvas_traits::webgl::WebGLPipeline;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::CSSError;
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
-use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
+use devtools_traits::{NavigationState, ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{EmbedderMsg, EventLoopWaker};
use euclid::default::{Point2D, Rect};
use euclid::Vector2D;
@@ -947,6 +947,7 @@ impl ScriptThread {
/// Step 13 of https://html.spec.whatwg.org/multipage/#navigate
pub fn navigate(
+ browsing_context: BrowsingContextId,
pipeline_id: PipelineId,
mut load_data: LoadData,
replace: HistoryEntryReplacement,
@@ -985,6 +986,12 @@ impl ScriptThread {
.queue(task, global.upcast())
.expect("Enqueing navigate js task on the DOM manipulation task source failed");
} else {
+ if let Some(ref sender) = script_thread.devtools_chan {
+ let _ = sender.send(ScriptToDevtoolsControlMsg::Navigate(
+ browsing_context, NavigationState::Start(load_data.url.clone())
+ ));
+ }
+
script_thread
.script_sender
.send((pipeline_id, ScriptMsg::LoadUrl(load_data, replace)))
@@ -3338,7 +3345,7 @@ impl ScriptThread {
self.notify_devtools(
document.Title(),
final_url.clone(),
- (incomplete.pipeline_id, None),
+ (incomplete.browsing_context_id, incomplete.pipeline_id, None),
);
let parse_input = DOMString::new();
@@ -3369,7 +3376,7 @@ impl ScriptThread {
&self,
title: DOMString,
url: ServoUrl,
- ids: (PipelineId, Option<WorkerId>),
+ (bc, p, w): (BrowsingContextId, PipelineId, Option<WorkerId>),
) {
if let Some(ref chan) = self.devtools_chan {
let page_info = DevtoolsPageInfo {
@@ -3377,11 +3384,14 @@ impl ScriptThread {
url: url,
};
chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
- ids,
+ (Some(bc), p, w),
self.devtools_sender.clone(),
- page_info,
+ page_info.clone(),
))
.unwrap();
+
+ let state = NavigationState::Stop(p, page_info);
+ let _ = chan.send(ScriptToDevtoolsControlMsg::Navigate(bc, state));
}
}