Skip to content

History API metabug #10992

Open
Open

Description

@cbrewster

This issue will keep track of everything needed to fully implement the History API

The History interface:

Spec: https://html.spec.whatwg.org/multipage/browsers.html#the-history-interface

Task Source and Events

Specs:
https://html.spec.whatwg.org/multipage/webappapis.html#history-traversal-task-source
https://html.spec.whatwg.org/multipage/browsers.html#the-popstateevent-interface
https://html.spec.whatwg.org/multipage/browsers.html#hashchangeevent
https://html.spec.whatwg.org/multipage/browsers.html#pagetransitionevent

Browsing Context (Edit: Now WindowProxy)

History State

  • Create a StateId type to refer to the associated JS state for a session history entry. Serialized history states should be stored in a resource thread and freed when no longer accessible. Once a state becomes activated, it must be deserialized and stored by the History object. (Implement History State #20638)

Constellation

URLs and Hash Change

  • History state diffs should track URL changes
  • Scrolling to fragment should trigger a hash change event and add a new diff in the session history
  • Hash change events should be fired when the hash changes during a history traversal.

Scroll Restoration

  • Save scroll offset in session history and restore the scroll location on navigation depending on the value of ScrollRestoration

Testing

Activity

  1. added
    A-content/dom
    A-constellation
    B-meta
    on May 3, 2016
  2. cbrewster commented on May 11, 2016

    @cbrewster
    ContributorAuthor

    The popState and replaceState both take title as an argument, and this is stored in the session history. According to the spec https://html.spec.whatwg.org/multipage/browsers.html#dom-history-pushstate, it looks like we can decide whether or not the title shown in the UI will change to match the one from the active session entry. Neither Safari, Firefox, or Chrome update the title to reflect the title stored in the active session history entry. I assume we would follow this behavior, but I wanted to double check.

    cc @jdm

  3. jdm commented on May 12, 2016

    @jdm
    Member

    I don't see a reason to deviate from that.

  4. cbrewster commented on May 16, 2016

    @cbrewster
    ContributorAuthor

    @jdm it looks like we will need to interleave navigation events from all browsing contexts for the joint session history. This means that Frame itself will not be enough. I am trying to think of a way to store navigation events as they occur, do you have any ideas?

  5. jdm commented on May 16, 2016

    @jdm
    Member

    The constellation is the natural place to coordinate the concepts of the joint session history and the session history event loop. I'm not sure what storing navigation events entails, exactly.

  6. added a commit that references this issue on Jun 19, 2016
  7. asajeffrey commented on Feb 24, 2017

    @asajeffrey
    Contributor

    IRC conversation about session histories with multiple instances of the same pipeline id: http://logs.glob.uno/?c=mozilla%23servo&s=24+Feb+2017&e=24+Feb+2017#c619161

    TL;DR: If you have document A which pushStates to B then again to C, then their shared Document is discarded, then the history is traversed to B, what happens? Our read of the spec is that A, B and C should all be reloaded to the same fresh document. This means that any session history entries with the same pipeline id must be contiguous.

  8. added
    A-navigation
    on Nov 6, 2026
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-constellationA-content/domA-navigationB-meta

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions