aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-04-28 16:56:11 -0400
committerGitHub <noreply@github.com>2020-04-28 16:56:11 -0400
commit1aab10f20aa1409ce59577d0d383b8001d440296 (patch)
tree6da8cff5e19c576b9013730458561787da86c1ef /components/script/script_thread.rs
parentbb7a5b6dba5a9511468b9913922e510a3c49a94c (diff)
parent02ce6188aa967ef1722155f9b170183a01a14064 (diff)
downloadservo-1aab10f20aa1409ce59577d0d383b8001d440296.tar.gz
servo-1aab10f20aa1409ce59577d0d383b8001d440296.zip
Auto merge of #26325 - jdm:devtools-nav, r=gterzian
Improve devtools experience when navigating The primary motivation for this work was to fix #15425, and these changes make it possible to use the devtools to meaningfully inspect multiple pages when navigating between them. Navigating through session history is not yet supported. These changes also include improvements to the dedicated worker support, which broke at some point. We now can observe console messages in workers.
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 606ac81493e..16fd866f1b9 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)))
@@ -3341,7 +3348,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();
@@ -3372,7 +3379,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 {
@@ -3380,11 +3387,14 @@ impl ScriptThread {
url: url,
};
chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
- ids,
+ (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));
}
}