mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
beforeunload and unload infrastructure
This commit is contained in:
parent
a1d1b18710
commit
427eaed535
28 changed files with 267 additions and 60 deletions
|
@ -1550,7 +1550,7 @@ impl Window {
|
|||
// https://html.spec.whatwg.org/multipage/#navigating-across-documents
|
||||
if !force_reload && url.as_url()[..Position::AfterQuery] ==
|
||||
doc.url().as_url()[..Position::AfterQuery] {
|
||||
// Step 5
|
||||
// Step 6
|
||||
if let Some(fragment) = url.fragment() {
|
||||
doc.check_and_scroll_fragment(fragment);
|
||||
doc.set_url(url.clone());
|
||||
|
@ -1559,9 +1559,24 @@ impl Window {
|
|||
}
|
||||
|
||||
let pipeline_id = self.upcast::<GlobalScope>().pipeline_id();
|
||||
self.main_thread_script_chan().send(
|
||||
MainThreadScriptMsg::Navigate(pipeline_id,
|
||||
LoadData::new(url, Some(pipeline_id), referrer_policy, Some(doc.url())), replace)).unwrap();
|
||||
|
||||
// Step 4
|
||||
let window_proxy = self.window_proxy();
|
||||
if let Some(active) = window_proxy.currently_active() {
|
||||
if pipeline_id == active {
|
||||
if doc.is_prompting_or_unloading() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Step 7
|
||||
if doc.prompt_to_unload(false) {
|
||||
self.main_thread_script_chan().send(
|
||||
MainThreadScriptMsg::Navigate(pipeline_id,
|
||||
LoadData::new(url, Some(pipeline_id), referrer_policy, Some(doc.url())), replace)).unwrap();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
pub fn handle_fire_timer(&self, timer_id: TimerEventId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue