Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement History State #20638
Implement History State #20638
Conversation
highfive
commented
Apr 14, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 14, 2018
|
r? @asajeffrey |
|
There are still some edge cases that will probably need to be addressed, but I think they should be done as followups. @bors-servo try |
Implement History State <!-- Please describe your changes on the following line: --> This just handles history states in the session history. URL handling and hashchange events still nee to be implemented. --- <!-- 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 #19156 (github issue number if applicable). <!-- Either: --> - [X] 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/20638) <!-- Reviewable:end -->
|
|
|
OK, this looks really good! Are we going to finally have history state after all these years? |
| SessionHistoryDiff::PipelineDiff { ref pipeline_reloader, new_history_state_id, .. } => { | ||
| if let NeedsToReload::No(pipeline_id) = *pipeline_reloader { | ||
| pipeline_changes.insert(pipeline_id, Some(new_history_state_id)); | ||
| } |
This comment has been minimized.
This comment has been minimized.
asajeffrey
Apr 15, 2018
Member
Perhaps add a comment about what to do in the else case? Until we support history state with URLs, I don't think there's anything sensible we can do :(
This comment has been minimized.
This comment has been minimized.
cbrewster
Apr 16, 2018
Author
Member
Right, my naive plan is to have another HashMasp <PipelineId, ServoUrl>. It would store the URL that should be used when reloading that Pipeline if different from the normal LoadData.
| SessionHistoryDiff::PipelineDiff { ref pipeline_reloader, old_history_state_id, .. } => { | ||
| if let NeedsToReload::No(pipeline_id) = *pipeline_reloader { | ||
| pipeline_changes.insert(pipeline_id, old_history_state_id); | ||
| } |
This comment has been minimized.
This comment has been minimized.
| for (pipeline_id, history_state_id) in pipeline_changes.drain() { | ||
| self.update_pipeline(pipeline_id, history_state_id); | ||
| } | ||
|
|
This comment has been minimized.
This comment has been minimized.
asajeffrey
Apr 15, 2018
Member
Should we do this before updating the browsing contexts? Otherwise we might get a glitch where the browsing context's current pipeline has been updated but not its state.
This comment has been minimized.
This comment has been minimized.
cbrewster
Apr 16, 2018
Author
Member
I'm not sure how to avoid this, but I would rather the pipeline's activities are all properly set before updating the session history state so that the popstate event will run when the document is active.
| bug: https://github.com/servo/servo/issues/19905 | ||
| [Queue a task to fire popstate event] | ||
| expected: TIMEOUT | ||
|
|
This comment has been minimized.
This comment has been minimized.
|
|
||
| [history.state should be a separate clone of the object, not a reference to the object passed to the event handler] | ||
| expected: FAIL | ||
|
|
This comment has been minimized.
This comment has been minimized.
| expected: FAIL | ||
|
|
||
| [history.state should be a separate clone of the object, not a reference to the object passed to the event handler] | ||
| expected: FAIL |
This comment has been minimized.
This comment has been minimized.
|
You can r=me, perhaps add some comments as mentioned above? Do we have issues for the follow-on tasks? |
|
@bors-servo r=asajeffrey |
|
|
Implement History State <!-- Please describe your changes on the following line: --> This just handles history states in the session history. URL handling and hashchange events still nee to be implemented. --- <!-- 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 #19156 (github issue number if applicable). <!-- Either: --> - [X] 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/20638) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
|
|
|
|
cbrewster commentedApr 14, 2018
•
edited by SimonSapin
This just handles history states in the session history. URL handling and hashchange events still nee to be implemented.
./mach build -ddoes not report any errors./mach build-geckolibdoes not report any errors./mach test-tidydoes not report any errorsThis change is