mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
"javascript:" urls: clean up after aborting a page load
Problem: After aborting on a 204 or 205 status code, you could no longer follow links on the page. Cause: `constellation.rs` ignores new LoadUrl requests since the aborted one is in its `pending_changes` list. Solution: Send a message to constellation that lets it clean up its `pending_changes` list.
This commit is contained in:
parent
af41769d70
commit
ff786a050a
3 changed files with 22 additions and 4 deletions
|
@ -1055,6 +1055,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
debug!("constellation got URL load message from script");
|
||||
self.handle_load_url_msg(source_top_ctx_id, source_pipeline_id, load_data, replace);
|
||||
}
|
||||
FromScriptMsg::AbortLoadUrl => {
|
||||
debug!("constellation got URL load message from script");
|
||||
self.handle_abort_load_url_msg(source_pipeline_id);
|
||||
}
|
||||
// A page loaded has completed all parsing, script, and reflow messages have been sent.
|
||||
FromScriptMsg::LoadComplete => {
|
||||
debug!("constellation got load complete message");
|
||||
|
@ -1874,6 +1878,18 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_abort_load_url_msg(&mut self, new_pipeline_id: PipelineId) {
|
||||
let pending_index = self.pending_changes.iter().rposition(|change| {
|
||||
change.new_pipeline_id == new_pipeline_id
|
||||
});
|
||||
|
||||
// If it is found, remove it from the pending changes.
|
||||
if let Some(pending_index) = pending_index {
|
||||
self.pending_changes.remove(pending_index);
|
||||
self.close_pipeline(new_pipeline_id, DiscardBrowsingContext::No, ExitPipelineMode::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_load_start_msg(&mut self, top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
pipeline_id: PipelineId) {
|
||||
if self.pipelines.get(&pipeline_id).and_then(|p| p.parent_info).is_none() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue