Remove insaccessible history states

This commit is contained in:
Connor Brewster 2018-04-17 19:21:51 -05:00
parent 087bd20b6d
commit c08ad45681
6 changed files with 70 additions and 12 deletions

View file

@ -1170,6 +1170,7 @@ impl ScriptThread {
PostMessage(id, ..) => Some(id),
UpdatePipelineId(_, _, id, _) => Some(id),
UpdateHistoryStateId(id, ..) => Some(id),
RemoveHistoryStates(id, ..) => Some(id),
FocusIFrame(id, ..) => Some(id),
WebDriverScriptCommand(id, ..) => Some(id),
TickAllAnimations(id) => Some(id),
@ -1298,6 +1299,8 @@ impl ScriptThread {
reason),
ConstellationControlMsg::UpdateHistoryStateId(pipeline_id, history_state_id) =>
self.handle_update_history_state_id_msg(pipeline_id, history_state_id),
ConstellationControlMsg::RemoveHistoryStates(pipeline_id, history_states) =>
self.handle_remove_history_states(pipeline_id, history_states),
ConstellationControlMsg::FocusIFrame(parent_pipeline_id, frame_id) =>
self.handle_focus_iframe_msg(parent_pipeline_id, frame_id),
ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, msg) =>
@ -1683,6 +1686,13 @@ impl ScriptThread {
}
}
fn handle_remove_history_states(&self, pipeline_id: PipelineId, history_states: Vec<HistoryStateId>) {
match { self.documents.borrow().find_window(pipeline_id) } {
None => return warn!("update history state after pipeline {} closed.", pipeline_id),
Some(window) => window.History().r().remove_states(history_states),
}
}
/// Window was resized, but this script was not active, so don't reflow yet
fn handle_resize_inactive_msg(&self, id: PipelineId, new_size: WindowSizeData) {
let window = self.documents.borrow().find_window(id)