mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #20661 - cbrewster:history_state_discard, r=asajeffrey
Remove insaccessible history states <!-- 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 #__ (github issue number if applicable). <!-- Either: --> - [ ] 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20661) <!-- Reviewable:end -->
This commit is contained in:
commit
1d8fd8f863
6 changed files with 70 additions and 12 deletions
|
@ -103,6 +103,13 @@ impl History {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn remove_states(&self, states: Vec<HistoryStateId>) {
|
||||
let _ = self.window
|
||||
.upcast::<GlobalScope>()
|
||||
.resource_threads()
|
||||
.send(CoreResourceMsg::RemoveHistoryStates(states));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-history-pushstate
|
||||
// https://html.spec.whatwg.org/multipage/#dom-history-replacestate
|
||||
fn push_or_replace_state(&self,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue