Skip to content

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

Closed

Description

@glennw
  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

Activity

  1. glennw commented on Jan 11, 2017

    @glennw
    MemberAuthor
  2. metajack commented on Jan 11, 2017

    @metajack
    Collaborator
  3. jdm commented on Jan 11, 2017

    @jdm
    Member

    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.

  4. jdm commented on Jan 11, 2017

    @jdm
    Member

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

  5. jdm commented on Jan 11, 2017

    @jdm
    Member

    Ractive triggered the JS errors for me.

  6. jdm commented on Jan 11, 2017

    @jdm
    Member

    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.

  7. jdm commented on Jan 12, 2017

    @jdm
    Member

    I filed #14975 for the Ractive problem.

  8. added
    A-content/dom
    on Jan 12, 2017
  9. 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[/+] on Jan 12, 2017
  10. jdm commented on Jan 12, 2017

    @jdm
    Member

    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.

  11. jdm commented on Jan 12, 2017

    @jdm
    Member

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

  12. jdm commented on Jan 12, 2017

    @jdm
    Member

    @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?

  13. cbrewster commented on Jan 12, 2017

    @cbrewster
    Contributor

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

  14. added 4 commits that reference this issue on Jul 20, 2018
    ce0014b
    f00e955
    91c8f26
    a97d8b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domA-webcompat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions