Skip to content

Commit

Permalink
Port in Jake's newest algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed May 19, 2021
1 parent 0d5f28a commit c7c8beb
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
spec: html; urlPrefix: https://whatpr.org/html/6315/
type: dfn
text: traversable navigable; for: navigable; url: history.html#nav-traversable
text: current session history entry; for: navigable; url: history.html#nav-current-history-entry
text: active session history entry; for: navigable; url: history.html#nav-active-history-entry
text: get the session history entries; for: navigable; url: history.html#getting-session-history-entries
text: session history traversal queue; for: traversable navigable; url: history.html#tn-session-history-traversal-queue
text: current session history step; for: traversable navigable; url: history.html#tn-current-session-history-step
text: get all history steps; for: traversable navigable; url: history.html#getting-all-history-steps
text: step; for: session history entry; url: history.html#she-step
text: apply the history step; url: history.html#apply-the-history-step
text: checkForUserCancelation; for: apply the history step; url: history.html#apply-the-history-step
text: initiatorToCheck; for: apply the history step; url: history.html#apply-the-history-step
text: containing navigable; for: browsing context; url: browsers.html#bc-navigable
text: session; for: browsing context group; url: browsers.html#bcg-session
spec: uuid; type: dfn; urlPrefix: https://wicg.github.io/uuid/
text: generate a random UUID; url: #dfn-generate-a-random-uuid
</pre>
Expand Down Expand Up @@ -505,7 +509,7 @@ Each {{AppHistory}} object has an associated <dfn for="AppHistory">navigate meth

1. Let |navigateInfo| be |options|["{{AppHistoryNavigationOptions/navigateInfo}}"] if it [=map/exists=], or undefined otherwise.

1. Let |navigable| be |appHistory|'s [=relevant global object=]'s [=associated Document=]'s navigable.
1. Let |navigable| be |appHistory|'s [=relevant global object=]'s [=Window/browsing context=]'s [=browsing context/containing navigable=].

1. Let |traversable| be |navigable|'s [=navigable/traversable navigable=].

Expand All @@ -525,9 +529,19 @@ Each {{AppHistory}} object has an associated <dfn for="AppHistory">navigate meth

<p class="note">This can occur if the |appHistory| object's view of session history is outdated, which can happen for brief periods while all the relevant threads and processes are being synchronized in reaction to a history change (such as the user clearing their history).

1. Assert: |targetEntry| is not |navigable|'s [=navigable/current session history entry=].
1. Assert: |targetEntry| is not |navigable|'s [=navigable/active session history entry=].

1. Let |targetStep| be |targetEntry|'s [=session history entry/step=].
1. Let |targetStep| be null.

1. If |targetEntry|'s [=session history entry/step=] is greater than |traversable|'s [=traversable navigable/current session history step=], then set |targetStep| to |targetEntry|'s [=session history entry/step=].

1. Otherwise:

1. Let |afterTarget| be the [=session history entry=] after |targetEntry| in |navigableEntries|.

1. Let |allSteps| be the result of [=traversable navigable/getting all history steps=] in |traversable| within |navigable|'s [=navigable/browsing context group=]'s [=browsing context group/session=].

1. Set |targetStep| to the greatest number in |allSteps| that is less than |afterTarget|'s [=session history entry/step=].

1. [=Apply the history step=] |targetStep| to |traversable|, with <i>[=apply the history step/checkForUserCancelation=]</i> set to true, <i>[=apply the history step/initiatorToCheck=]</i> set to |initiatorBC|, and <i>[=apply the history step/appHistoryInfo=]</i> set to |navigateInfo|.

Expand Down Expand Up @@ -858,8 +872,7 @@ interface AppHistoryEntry : EventTarget {
<dd>
<p>A [=user agent=]-generated random UUID string representing this app history entry's place in the app history list. This value will be reused by other {{AppHistoryEntry}} instances that replace this one due to replace-style navigations. This value will survive session restores.

<!-- TODO proper cross-link -->
<p>This is useful for navigating back to this location in the app history entry list, using `appHistory.goTo(key)`.
<p>This is useful for navigating back to this location in the app history entry list, using {{AppHistory/goTo(key)|appHistory.goTo(key)}}.
</dd>

<dt><code>entry . {{AppHistoryEntry/id}}</code>
Expand Down

0 comments on commit c7c8beb

Please sign in to comment.