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

hashchange DOM event should be dispatched when the document location's hash is changed #14970

Closed
glennw opened this issue Jan 11, 2017 · 11 comments
Closed

Comments

@glennw
Copy link
Member

@glennw glennw commented Jan 11, 2017

  1. Open https://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/ in Servo.
  2. Select "Run all"

The tests will start running. At some point during the benchmark, execution stops and nothing further happens. The rendering is still running (can be confirmed with -Z wr-stats).

Sometimes you get several JS errors written on the console - but this doesn't always happen.

For example:

Om,Adding50Items,expected,50,got,0
Om,CompletingAllItems,expected,50,got,0
ERROR:script::dom::bindings::error: Error at https://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/todomvc/ractive/bower_components/ractive/Ractive.js:3:19921 Could not parse template: ...
							&lt;!-- The <- failed at character 1108 ->{{&gt;item}} partial...
ERROR:script::dom::bindings::error: Error at https://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/todomvc/ractive/js/persistence.js:45:1 todoList is not defined
ERROR:script::dom::bindings::error: Error at https://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/todomvc/ractive/js/routes.js:25:1 todoList is not defined

@glennw
Copy link
Member Author

@glennw glennw commented Jan 11, 2017

@metajack
Copy link
Contributor

@metajack metajack commented Jan 11, 2017

@jdm
Copy link
Member

@jdm jdm commented Jan 11, 2017

I've observed this a few times after variable numbers of tests have completed. I suspect there's a timing issue that makes the harness get confused, rather than an internal engine problem like a deadlock.

@jdm
Copy link
Member

@jdm jdm commented Jan 11, 2017

The Mithril suite seems to trigger this most often when I run the tests in isolation.

@jdm
Copy link
Member

@jdm jdm commented Jan 11, 2017

Ractive triggered the JS errors for me.

@jdm
Copy link
Member

@jdm jdm commented Jan 11, 2017

Those both seem to be consistent for me, and it would explain the intermittent behaviour you observed - the order of the testsuites seems to be randomized every time I load the benchmark.

@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

I filed #14975 for the Ractive problem.

@jdm jdm changed the title TodoMVC benchmark stops running partially through the test. hashchange DOM event should be dispatched when the document location's hash is changed Jan 12, 2017
@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

The problem with the tests not continuing is due to the Mithril test suite, and that's caused by us missing the hashchange DOM event that it relies on for routing if window.history.pushState isn't available.

@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

To reproduce easily, run an HTTP server inside todomvc-perf-comparison/todomvc-benchmark, and run ./mach run http://localhost:8000/todomvc/mithril/index.html.

@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

@cbrewster The spec text for hashchange falls under steps 6 and 15 of https://html.spec.whatwg.org/multipage/browsers.html#traverse-the-history . Do we have an implementation of the "traverse the history" algorithm yet?

@cbrewster
Copy link
Member

@cbrewster cbrewster commented Jan 12, 2017

@jdm the "traverse the history" algorithm is found in the constellation:
https://dxr.mozilla.org/servo/rev/5d3847dddc9bb7907abfa5d38a7927d6c656fbc1/components/constellation/constellation.rs#1668-1702
and
https://dxr.mozilla.org/servo/rev/5d3847dddc9bb7907abfa5d38a7927d6c656fbc1/components/constellation/constellation.rs#1972-2082
It is a bit messy when aligning it to the spec as we have to split some logic between the constellation and script threads.
A new history entry will need to be added to a Frame each time the hash is changed and upon traversal we can tell the corresponding script thread to trigger the event.
Unfortunately, the current history logic assumes that each entry has a unique PipelineId from all other entries. With pushState/hash changes, we will have cases where multiple entries will have the same PipelineId. Some of this is handled in #13781, but I haven't had the time to finish that up yet.

@cbrewster cbrewster mentioned this issue Jun 13, 2018
4 of 5 tasks complete
bors-servo added a commit that referenced this issue Jul 20, 2018
Track hash changes in session history

<!-- Please describe your changes on the following line: -->
Adds tracking of hash changes in the session history.

---
<!-- 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 test-tidy` does not report any errors
- [X] These changes fix #14970 fix #13437 (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/21048)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 20, 2018
Track hash changes in session history

<!-- Please describe your changes on the following line: -->
Adds tracking of hash changes in the session history.

---
<!-- 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 test-tidy` does not report any errors
- [X] These changes fix #14970 fix #13437 (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/21048)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 21, 2018
Track hash changes in session history

<!-- Please describe your changes on the following line: -->
Adds tracking of hash changes in the session history.

---
<!-- 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 test-tidy` does not report any errors
- [X] These changes fix #14970 fix #13437 (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/21048)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 21, 2018
Track hash changes in session history

<!-- Please describe your changes on the following line: -->
Adds tracking of hash changes in the session history.

---
<!-- 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 test-tidy` does not report any errors
- [X] These changes fix #14970 fix #13437 (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/21048)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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