Skip to content

Discarded documents can be reloaded with outdated URLs #39903

@jdm

Description

@jdm

DOM APIs like History.replaceState cause active session history entries to be updated with a new URL. The constellation tracks this in

let webview_id = match self.pipelines.get_mut(&pipeline_id) {
Some(pipeline) => {
pipeline.history_state_id = Some(history_state_id);
pipeline.url = url.clone();
pipeline.webview_id
},
, but if the pipeline is ever discarded (such as by navigating away and the document is not salvageable) then the constellation stores the original LoadData for the pipeline in the NeedsToReload::Yes enum value:
let load_data = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => pipeline.load_data.clone(),
None => return warn!("{}: Discarding closed pipeline", pipeline_id),
};
webview.session_history.replace_reloader(
NeedsToReload::No(pipeline_id),
NeedsToReload::Yes(pipeline_id, load_data),
);

We already handle this properly when evicting session history entries when the session history reaches the maximum size:

let load_data = match self.pipelines.get(&evicted_id) {
Some(pipeline) => {
let mut load_data = pipeline.load_data.clone();
load_data.url = pipeline.url.clone();
load_data
},
None => continue,
};
dead_pipelines.push((evicted_id, NeedsToReload::Yes(evicted_id, load_data)));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions