Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement History State #20638

Merged
merged 1 commit into from Apr 16, 2018
Merged

Implement History State #20638

merged 1 commit into from Apr 16, 2018

Conversation

@cbrewster
Copy link
Member

cbrewster commented Apr 14, 2018

This just handles history states in the session history. URL handling and hashchange events still nee to be implemented.


  • ./mach build -d does not report any errors
  • ./mach build-geckolib does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #19156 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Apr 14, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/popstateevent.rs, components/script/dom/history.rs, components/constellation/pipeline.rs, components/script/script_thread.rs, components/constellation/constellation.rs and 2 more
  • @paulrouget: components/constellation/pipeline.rs, components/constellation/constellation.rs, components/constellation/session_history.rs
  • @fitzgen: components/script_traits/lib.rs, components/script/dom/popstateevent.rs, components/script_traits/script_msg.rs, components/script/dom/history.rs, components/script/script_thread.rs and 1 more
  • @KiChjang: components/script_traits/lib.rs, components/net/http_loader.rs, components/script/dom/popstateevent.rs, components/net_traits/lib.rs, components/script_traits/script_msg.rs and 4 more
@highfive
Copy link

highfive commented Apr 14, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@cbrewster
Copy link
Member Author

cbrewster commented Apr 14, 2018

@highfive highfive assigned asajeffrey and unassigned nox Apr 14, 2018
@cbrewster
Copy link
Member Author

cbrewster commented Apr 14, 2018

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

@bors-servo
Copy link
Contributor

bors-servo commented Apr 14, 2018

Trying commit de0450f with merge 38930cb...

bors-servo added a commit that referenced this pull request Apr 14, 2018
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
Copy link
Contributor

bors-servo commented Apr 14, 2018

Copy link
Member

asajeffrey left a comment

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.

Copy link
@asajeffrey

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.

Copy link
@cbrewster

cbrewster Apr 16, 2018

Author Member

Right, my naive plan is to have another HashMasp 😞 which is a <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.

Copy link
@asajeffrey
for (pipeline_id, history_state_id) in pipeline_changes.drain() {
self.update_pipeline(pipeline_id, history_state_id);
}

This comment has been minimized.

Copy link
@asajeffrey

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.

Copy link
@cbrewster

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.

Copy link
@asajeffrey

asajeffrey Apr 15, 2018

Member

Yay, more tests passing!


[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.

Copy link
@asajeffrey

asajeffrey Apr 15, 2018

Member

Yay, even more tests passing!

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.

Copy link
@asajeffrey

asajeffrey Apr 15, 2018

Member

Yay, even even more tests passing!

@asajeffrey
Copy link
Member

asajeffrey commented Apr 15, 2018

You can r=me, perhaps add some comments as mentioned above? Do we have issues for the follow-on tasks?

@cbrewster cbrewster force-pushed the cbrewster:history_state branch from de0450f to 17bd80a Apr 16, 2018
@cbrewster
Copy link
Member Author

cbrewster commented Apr 16, 2018

@bors-servo r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2018

📌 Commit 17bd80a has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2018

Testing commit 17bd80a with merge 11733d3...

bors-servo added a commit that referenced this pull request Apr 16, 2018
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
Copy link
Contributor

bors-servo commented Apr 16, 2018

💔 Test failed - mac-rel-wpt4

@asajeffrey
Copy link
Member

asajeffrey commented Apr 16, 2018

@bors-servo retry

  • infra issues?
@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2018

@bors-servo bors-servo merged commit 17bd80a into servo:master Apr 16, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@cbrewster cbrewster mentioned this pull request Apr 16, 2018
18 of 24 tasks complete
@cbrewster cbrewster deleted the cbrewster:history_state branch Apr 17, 2018
@Ms2ger Ms2ger mentioned this pull request Jun 24, 2018
9 of 13 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.