servo: Merge #20579 - Replace initial about:blank loads (from cbrewster:about_blank_replace); r=asajeffrey

<!-- 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: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14720 (github issue number if applicable).

<!-- Either: -->
- [X] 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. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: ae117be752a658265fe2f4d0cadd7134b1e23eff

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 35939e48ca07a62059cb496684f9355852a1244d
This commit is contained in:
Connor Brewster 2018-04-11 11:12:52 -04:00
Родитель 0d0e71fde6
Коммит f5b1f3bfd6
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -2438,12 +2438,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
.collect::<Vec<_>>()
};
self.update_activity(old_pipeline_id);
self.update_activity(change.new_pipeline_id);
for pipeline_id in pipelines_to_close {
self.close_pipeline(pipeline_id, DiscardBrowsingContext::No, ExitPipelineMode::Normal);
}
self.update_activity(old_pipeline_id);
self.update_activity(change.new_pipeline_id);
self.notify_history_changed(change.top_level_browsing_context_id);
}
}

Просмотреть файл

@ -71,6 +71,7 @@ pub struct HTMLIFrameElement {
browsing_context_id: Cell<Option<BrowsingContextId>>,
pipeline_id: Cell<Option<PipelineId>>,
pending_pipeline_id: Cell<Option<PipelineId>>,
about_blank_pipeline_id: Cell<Option<PipelineId>>,
sandbox: MutNullableDom<DOMTokenList>,
sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DomRefCell<Option<LoadBlocker>>,
@ -164,6 +165,8 @@ impl HTMLIFrameElement {
NavigationType::InitialAboutBlank => {
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();
self.about_blank_pipeline_id.set(Some(new_pipeline_id));
global_scope
.script_to_constellation_chan()
.send(ScriptMsg::ScriptNewIFrame(load_info, pipeline_sender))
@ -231,7 +234,11 @@ impl HTMLIFrameElement {
let document = document_from_node(self);
let load_data = LoadData::new(url, creator_pipeline_id, document.get_referrer_policy(), Some(document.url()));
self.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, false);
let pipeline_id = self.pipeline_id();
// If the initial `about:blank` page is the current page, load with replacement enabled.
let replace = pipeline_id.is_some() && pipeline_id == self.about_blank_pipeline_id.get();
self.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, replace);
}
fn create_nested_browsing_context(&self) {
@ -253,6 +260,7 @@ impl HTMLIFrameElement {
fn destroy_nested_browsing_context(&self) {
self.pipeline_id.set(None);
self.pending_pipeline_id.set(None);
self.about_blank_pipeline_id.set(None);
self.top_level_browsing_context_id.set(None);
self.browsing_context_id.set(None);
}
@ -285,6 +293,7 @@ impl HTMLIFrameElement {
top_level_browsing_context_id: Cell::new(None),
pipeline_id: Cell::new(None),
pending_pipeline_id: Cell::new(None),
about_blank_pipeline_id: Cell::new(None),
sandbox: Default::default(),
sandbox_allowance: Cell::new(None),
load_blocker: DomRefCell::new(None),