diff --git a/spec.bs b/spec.bs index ad1d9df..95c2ba5 100644 --- a/spec.bs +++ b/spec.bs @@ -182,6 +182,8 @@ Each {{AppHistory}} object has an associated current index Each {{AppHistory}} object has an associated ongoing navigate event, an {{AppHistoryNavigateEvent}} or null, initially null. +Each {{AppHistory}} object has an associated post-navigate event navigation signal, an {{AbortSignal}} or null, initially null. + Each {{AppHistory}} object has an associated navigate method call promise, which is either a {{Promise}} or null, initially null. Each {{AppHistory}} object has an associated navigate method call serialized state, which is either a [=serialized state=] or null, initially null. @@ -217,7 +219,7 @@ Each {{AppHistory}} object has an associated navigate meth 1. If [=this=]'s [=AppHistory/current index=] is −1, then return null. -

This occurs if accessing the API while on the initial `about:blank` {{Document}}, where the [=AppHistory/update the entries=] algorithm will not yet have been run to completion. +

This occurs if accessing the API while on the initial `about:blank` {{Document}}, where the [=AppHistory/update for navigation=] algorithm will not yet have been run to completion. 1. Return [=this=]'s [=AppHistory/entry list=][[=this=]'s [=AppHistory/current index=]]. @@ -255,7 +257,9 @@ Each {{AppHistory}} object has an associated navigate meth

- To update the entries for an {{AppHistory}} instance |appHistory|: + To update for navigation an {{AppHistory}} instance |appHistory|: + + 1. Set |appHistory|'s [=AppHistory/post-navigate event navigation signal=] to null. 1. Let |browsingContext| be |appHistory|'s [=relevant global object=]'s [=Window/browsing context=]. @@ -653,6 +657,7 @@ The sameDocument getter steps a 1. Initialize |event|'s {{Event/type}} to "{{AppHistory/navigate}}". 1. Initialize |event|'s {{AppHistoryNavigateEvent/navigationType}} to |navigationType|. 1. Initialize |event|'s {{AppHistoryNavigateEvent/info}} to |info|. + 1. Initialize |event|'s {{AppHistoryNavigateEvent/signal}} to a [=new=] {{AbortSignal}} created in |appHistory|'s [=relevant Realm=]. 1. Let |destination| be a [=new=] {{AppHistoryDestination}} created in |appHistory|'s [=relevant Realm=]. 1. Set |destination|'s [=AppHistoryDestination/URL=] to |destinationURL|. 1. Set |destination|'s [=AppHistoryDestination/state=] to |destinationState|. @@ -681,6 +686,7 @@ The sameDocument getter steps a

This can occur if an event listener disconnected the <{iframe}> corresponding to [=this=]'s [=relevant global object=].

1. If |dispatchResult| is true: + 1. Set |appHistory|'s [=AppHistory/post-navigate event navigation signal=] to |event|'s {{AppHistoryNavigateEvent/signal}}. 1. If |event|'s [=AppHistoryNavigateEvent/navigation action promises list=] is not empty and |navigationType| is not "{{AppHistoryNavigationType/traverse}}": 1. Let |isPush| be true if |navigationType| is "{{AppHistoryNavigationType/push}}"; otherwise, false. 1. Run the URL and history update steps given |event|'s [=relevant global object=]'s [=associated document=] and |event|'s {{AppHistoryNavigateEvent/destination}}'s [=AppHistoryDestination/URL=], with [=URL and history update steps/serializedData=] set to |event|'s [=AppHistoryNavigateEvent/classic history API serialized data=] and [=URL and history update steps/isPush=] set to |isPush|. @@ -723,10 +729,12 @@ The sameDocument getter steps a 1. If |appHistory|'s [=AppHistory/ongoing navigate event=] is non-null, then: 1. Set |appHistory|'s [=AppHistory/ongoing navigate event=]'s [=Event/canceled flag=] to true. +

This will eventually lead to the inner `navigate` event firing algorithm calling [=synchronously finalize with an aborted navigation error=] once the event firing process completes. However, we want to [=AbortSignal/signal abort=] on the relevant {{AppHistoryNavigateEvent/signal|event.signal}} right away, thus the below step. 1. Set |appHistory|'s [=AppHistory/ongoing navigate event=] to null. 1. [=AbortSignal/Signal abort=] on |appHistory|'s [=AppHistory/ongoing navigate event=]'s {{AppHistoryNavigateEvent/signal}}. - -

Because this cancels the event, this will eventually lead to the inner `navigate` event firing algorithm calling [=synchronously finalize with an aborted navigation error=] once the event firing process completes. However, we want to [=AbortSignal/signal abort=] on the relevant {{AppHistoryNavigateEvent/signal|event.signal}} right away. + 1. Otherwise, if |appHistory|'s [=AppHistory/post-navigate event navigation signal=] is non-null, then: + 1. [=AbortSignal/Signal abort=] on |appHistory|'s [=AppHistory/post-navigate event navigation signal=]. + 1. Set |appHistory|'s [=AppHistory/post-navigate event navigation signal=] to null.

@@ -1085,16 +1093,16 @@ Potentially update the traverse the history algorithm to cons
Update the traverse the history algorithm by adding the following step before the final step which fires various events: - 1. [=AppHistory/Update the entries=] of newDocument's [=relevant global object=]'s [=Window/app history=]. + 1. [=AppHistory/Update for navigation=] newDocument's [=relevant global object=]'s [=Window/app history=].
Update the URL and history update steps by appending the following final step: - 1. [=AppHistory/Update the entries=] of document's [=relevant global object=]'s [=Window/app history=]. + 1. [=AppHistory/Update for navigation=] of document's [=relevant global object=]'s [=Window/app history=].
-

We do not [=AppHistory/update the entries=] when initially creating a new browsing context, as we intentionally don't want to include the initial `about:blank` {{Document}} in any app history entry list. +

We do not [=AppHistory/update for navigation=] when initially creating a new browsing context, as we intentionally don't want to include the initial `about:blank` {{Document}} in any app history entry list.

Other patches