aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs64
1 files changed, 53 insertions, 11 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 2da35702834..6114e353d97 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -17,8 +17,6 @@
//! a page runs its course and the script thread returns to processing events in the main event
//! loop.
-use bluetooth_traits::BluetoothRequest;
-use canvas_traits::webgl::WebGLPipeline;
use crate::devtools;
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
@@ -84,6 +82,8 @@ use crate::task_source::user_interaction::UserInteractionTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
use crate::task_source::TaskSourceName;
use crate::webdriver_handlers;
+use bluetooth_traits::BluetoothRequest;
+use canvas_traits::webgl::WebGLPipeline;
use crossbeam_channel::{unbounded, Receiver, Sender};
use devtools_traits::CSSError;
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
@@ -936,7 +936,7 @@ impl ScriptThread {
return warn!(
"Paint worklet registered after pipeline {} closed.",
pipeline_id
- )
+ );
},
};
let _ = window
@@ -1193,14 +1193,16 @@ impl ScriptThread {
} else if let Some(parent) =
new_layout_info.parent_info.and_then(|pipeline_id| {
self.documents.borrow().find_document(pipeline_id)
- }) {
+ })
+ {
parent.origin().clone()
} else if let Some(creator) = new_layout_info
.load_data
.creator_pipeline_id
.and_then(|pipeline_id| {
self.documents.borrow().find_document(pipeline_id)
- }) {
+ })
+ {
creator.origin().clone()
} else {
MutableOrigin::new(ImmutableOrigin::new_opaque())
@@ -1315,6 +1317,10 @@ impl ScriptThread {
// into this loop too, but for now it's only images.
debug!("Issuing batched reflows.");
for (_, document) in self.documents.borrow().iter() {
+ // Step 13
+ if !document.is_fully_active() {
+ continue;
+ }
let window = document.window();
let pending_reflows = window.get_pending_reflow_count();
if pending_reflows > 0 {
@@ -1397,6 +1403,7 @@ impl ScriptThread {
match *msg {
MixedMessage::FromConstellation(ref inner_msg) => {
match *inner_msg {
+ StopDelayingLoadEventsMode(id) => Some(id),
NavigationResponse(id, _) => Some(id),
AttachLayout(ref new_layout_info) => Some(new_layout_info.new_pipeline_id),
Resize(id, ..) => Some(id),
@@ -1534,6 +1541,9 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
+ ConstellationControlMsg::StopDelayingLoadEventsMode(pipeline_id) => {
+ self.handle_stop_delaying_load_events_mode(pipeline_id)
+ },
ConstellationControlMsg::NavigationResponse(id, fetch_data) => {
match fetch_data {
FetchResponseMsg::ProcessResponse(metadata) => {
@@ -1693,7 +1703,7 @@ impl ScriptThread {
return warn!(
"Received fire timer msg for a closed pipeline {}.",
pipeline_id
- )
+ );
},
};
@@ -1885,7 +1895,7 @@ impl ScriptThread {
return warn!(
"Set scroll state message sent to nonexistent pipeline: {:?}",
id
- )
+ );
},
};
@@ -1911,7 +1921,6 @@ impl ScriptThread {
window_size,
pipeline_port,
content_process_shutdown_chan,
- layout_threads,
} = new_layout_info;
let layout_pair = unbounded();
@@ -1928,7 +1937,6 @@ impl ScriptThread {
script_chan: self.control_chan.clone(),
image_cache: self.image_cache.clone(),
content_process_shutdown_chan: content_process_shutdown_chan,
- layout_threads: layout_threads,
paint_time_metrics: PaintTimeMetrics::new(
new_pipeline_id,
self.time_profiler_chan.clone(),
@@ -2081,6 +2089,19 @@ impl ScriptThread {
}
}
+ fn handle_stop_delaying_load_events_mode(&self, pipeline_id: PipelineId) {
+ let window = self.documents.borrow().find_window(pipeline_id);
+ if let Some(window) = window {
+ match window.undiscarded_window_proxy() {
+ Some(window_proxy) => window_proxy.stop_delaying_load_events_mode(),
+ None => warn!(
+ "Attempted to take {} of 'delaying-load-events-mode' after having been discarded.",
+ pipeline_id
+ ),
+ };
+ }
+ }
+
fn handle_unload_document(&self, pipeline_id: PipelineId) {
let document = self.documents.borrow().find_document(pipeline_id);
if let Some(document) = document {
@@ -2115,7 +2136,7 @@ impl ScriptThread {
return warn!(
"update history state after pipeline {} closed.",
pipeline_id
- )
+ );
},
Some(window) => window.History().r().activate_state(history_state_id, url),
}
@@ -2131,7 +2152,7 @@ impl ScriptThread {
return warn!(
"update history state after pipeline {} closed.",
pipeline_id
- )
+ );
},
Some(window) => window.History().r().remove_states(history_states),
}
@@ -2167,6 +2188,20 @@ impl ScriptThread {
status: Some((204...205, _)),
..
}) => {
+ // If we have an existing window that is being navigated:
+ if let Some(window) = self.documents.borrow().find_window(id.clone()) {
+ let window_proxy = window.window_proxy();
+ // https://html.spec.whatwg.org/multipage/
+ // #navigating-across-documents:delaying-load-events-mode-2
+ if window_proxy.parent().is_some() {
+ // The user agent must take this nested browsing context
+ // out of the delaying load events mode
+ // when this navigation algorithm later matures,
+ // or when it terminates (whether due to having run all the steps,
+ // or being canceled, or being aborted), whichever happens first.
+ window_proxy.stop_delaying_load_events_mode();
+ }
+ }
self.script_sender
.send((id.clone(), ScriptMsg::AbortLoadUrl))
.unwrap();
@@ -2711,6 +2746,13 @@ impl ScriptThread {
incomplete.parent_info,
incomplete.opener,
);
+ if window_proxy.parent().is_some() {
+ // https://html.spec.whatwg.org/multipage/#navigating-across-documents:delaying-load-events-mode-2
+ // The user agent must take this nested browsing context
+ // out of the delaying load events mode
+ // when this navigation algorithm later matures.
+ window_proxy.stop_delaying_load_events_mode();
+ }
window.init_window_proxy(&window_proxy);
let last_modified = metadata.headers.as_ref().and_then(|headers| {