diff --git a/source b/source index a92d86863c1..70a567a89b3 100644 --- a/source +++ b/source @@ -100222,10 +100222,38 @@ const p2 = navigation.navigate(url2).finished;
  • Let navigation be navigable's active window's navigation API.

  • -
  • If navigation's ongoing navigate - event is null, then return.

  • +
  • +

    While navigation's ongoing navigate event is not null:

    + +
      +
    1. Abort the ongoing navigation given navigation.

    2. +
    + +
    +

    If there is an ongoing cross-document navigation, this means it will be signaled to the + navigation API as aborted, e.g., by firing navigateerror events. This is somewhat accurate, since the + next navigation the Document experiences will be this same-document navigation, so + a developer which was expecting the next navigation completion to be that of the cross-document + navigation gets a useful signal that this did not happen. However, it is also somewhat + inaccurate, as the browser will continue to process the ongoing cross-document navigation + (applying it after this same-document one synchronously finishes).

    + +

    Ultimately, the navigation API gets a bit messy with overlapping cross- and same-document + navigations, as the ongoing navigation tracking + machinery and APIs are built to expose only a single ongoing navigation. Web developers will be + best-served if they do not create such overlapping situations, e.g., by awaiting promises returned from navigation.navigate() before starting new + navigations.

    +
    -
  • Abort the ongoing navigation given navigation.

  • +

    This is a loop, since abort the ongoing navigation can run + JavaScript (e.g., via the navigateerror event), which + might start a new navigation. Since such a newly-started navigation will be superseded by the + completion of this navigation, it gets signaled to the navigation API as aborted.

    + @@ -101264,44 +101292,10 @@ interface NavigationDestination { null):

      -
    1. -

      If isSameDocument is true:

      - -
        -
      1. -

        While navigation's ongoing navigate event is not null:

        - -
          -
        1. Abort the ongoing navigation given navigation.

        2. -
        - -
        -

        If there is an ongoing cross-document navigation, this means it will be signaled to the - navigation API as aborted, e.g., by firing navigateerror events. This is somewhat accurate, since - the next navigation the Document experiences will be this same-document - navigation, so a developer which was expecting the next navigation completion to be that of - the cross-document navigation gets a useful signal that this did not happen. However, it is - also somewhat inaccurate, as the browser will continue to process the ongoing cross-document - navigation (applying it after this same-document one synchronously finishes).

        - -

        Ultimately, the navigation API gets a bit messy with overlapping cross- and same-document - navigations, as the ongoing navigation tracking - machinery and APIs are built to expose only a single ongoing navigation. Web developers will - be best-served if they do not create such overlapping situations, e.g., by awaiting promises returned from navigation.navigate() before starting new - navigations.

        -
        - -

        This is a loop, since abort the ongoing navigation can run - JavaScript (e.g., via the navigateerror event), - which might start a new navigation. Since such a newly-started navigation will be superseded - by the completion of this navigation, it gets signaled to the navigation API as aborted.

        -
      2. -
      -
    2. +
    3. Inform the navigation API about aborting navigation in + navigation's relevant global object's associated Document's node + navigable.

    4. Let event be the result of creating an event given NavigateEvent, in navigation's