Repository navigation
Description
This issue will keep track of everything needed to fully implement the History API
The History interface:
-
ScrollRestorationenum and attribute -
lengthattribute (Implement history.length #12685) -
go([ delta ])method (History interface Go, Back, and Forward #12552) -
back()method (Implement History's back/forward APIs #5670 History interface Go, Back, and Forward #12552) -
forward()method (Implement History's back/forward APIs #5670 History interface Go, Back, and Forward #12552) -
stateattribute (Implement History State #20638) -
pushState(data, title [, url ])method (Implement History State #20638) -
replaceState(data, title [, url ])method (Implement History State #20638) - traverse the history by a delta (History interface Go, Back, and Forward #12552)
- Make these
[Throw]if the document is not fully active. (Make History attributes and methods throw #16697)
Task Source and Events
- Fully implement
HistoryTraversalTaskSource(Fully implement HistoryTravesalTaskSource #10994) -
PopStateEvent(Implement navigation events #11005 Implement navigation events #11006) -
HashChangeEvent(Implement navigation events #11005 Implement navigation events #11006) -
PageTransitionEvent(Implement navigation events #11005 Implement navigation events #11006)
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)
- Replace
PagewithBrowsingContext(Replace Page with BrowsingContext #11031 Combine Page into BrowsingContext #11044)
History State
- Create a
StateIdtype 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 theHistoryobject. (Implement History State #20638)
Constellation
- Setup a
joint session historythat has all of the session history entries interleaved by the time they were created (https://github.com/ConnorGBrewster/ServoNavigation) (Implement joint session history #11866) - Add delta to
NavigationDirection(Add support for navigating by a delta #11616) - Allow multiple session history entries to share the same pipeline id.
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
- Add more tests for the History API that test many edge cases not checked by the current suite. (https://github.com/cbrewster/ServoNavigation)
Activity
cbrewster commentedon May 11, 2016
The
popStateandreplaceStateboth 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
jdm commentedon May 12, 2016
I don't see a reason to deviate from that.
cbrewster commentedon May 16, 2016
@jdm it looks like we will need to interleave navigation events from all browsing contexts for the
joint session history. This means thatFrameitself will not be enough. I am trying to think of a way to store navigation events as they occur, do you have any ideas?jdm commentedon May 16, 2016
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.
Auto merge of #11793 - ConnorGBrewster:enable_history_tests, r=jdm
asajeffrey commentedon Feb 24, 2017
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.