This change makes it so the URL to push to the history API is generated at the earliest point possible - when the spine item to load is first determined.
This fixes an edge case with the external_agent_support features of shared-js.
How to test this:
At this point we will test a part of the integration between Hypothesis and Readium in the cloud reader.
To support linking back to annotations in the context of the reader app & source content Hypothesis can use a 'canonical' link element with an href. The value for this href in our case will be the reader's URL with two params, the epub location and the 'goto' bookmark location.
The URL to be used must contain the 'goto' param, or else it doesn't make sense to use it. If the URL was to be used without specifying the bookmark location then annotations associated with this canonical link would be for the whole book, which is bad. But if no canonical link exists then Hypothesis would fall back to associating with the content document's location, which is not ideal since that would mean the link to the annotation would just be the regular XHTML document without Readium.
Hypothesis has no canonical link for this initial content frame.
This PR fixes this by generating a goto param at the earliest point possible, when the spine items to load and the iframes are instantiated.
But the iframe content isn't ready since it's still loading, therefore a bookmark CFI can't be created yet.
A goto param with the idref and a null CFI would work at this state, the integration code with Hypothesis will have a canonical link element based on this goto param, and once the CFI is able to be generated on the full pagination, the canonical link is updated.
This change makes it so the URL to push to the history API is generated at the earliest point possible - when the spine item to load is first determined. This fixes an edge case with the external_agent_support features of shared-js.
How to test this:
This pull request is Finalized