Auto merge of #22121 - gterzian:remove_constellation_block_in_navigation, r=paulrouget

Remove sync constellation -> embedder communication

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #22042 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22121)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-12-26 01:53:20 -05:00 committed by GitHub
commit 66223ee105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 265 additions and 61 deletions

View file

@ -1314,6 +1314,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 {
@ -1396,6 +1400,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),
@ -1533,6 +1538,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) => {
@ -2078,6 +2086,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 {
@ -2164,6 +2185,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();
@ -2708,6 +2743,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| {