From fe5bbc414ea2fc76fe602aaa7f193a576272e458 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Sun, 13 Nov 2022 23:30:26 +0900 Subject: [PATCH 01/30] Add the navigation API This imports much of the specification from https://wicg.github.io/navigation-api/. It includes some minor fixes and renamings, as well as a lot of rearranging to flow better, but the feature set is the same. --- source | 3039 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 2786 insertions(+), 253 deletions(-) diff --git a/source b/source index f0ab3ad70bb..31ba317ce32 100644 --- a/source +++ b/source @@ -44,6 +44,10 @@ link.hash = location.hash; } + @@ -2749,8 +2753,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • exposed
  • a promise resolved with
  • a promise rejected with
  • +
  • wait for all
  • upon rejection
  • upon fulfillment
  • +
  • mark as handled
  • [LegacyFactoryFunction]
  • [LegacyLenientThis]
  • [LegacyNullToEmptyString]
  • @@ -3128,6 +3134,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The create an event algorithm
  • The fire an event algorithm
  • The canceled flag
  • +
  • The dispatch flag
  • The dispatch algorithm
  • EventInit dictionary type
  • type attribute
  • @@ -3181,6 +3188,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute is value
  • MutationObserver interface and mutation observers in general
  • +
  • AbortSignal
  • +
  • aborted
  • +
  • signal abort
  • The following features are defined in UI Events:

    @@ -15424,10 +15434,13 @@ data-x="rel-preload">preload; as=font<

    Interactive user agents may provide users with a means to follow the hyperlinks created using the link element, somewhere - within their user interface. The exact interface is not defined by this specification, but it - could include the following information (obtained from the element's attributes, again as defined - below), in some form or another (possibly simplified), for each hyperlink created - with each link element in the document:

    + within their user interface. Such invocations of the follow + the hyperlink algorithm must set the userInvolvement argument to "browser UI". The exact interface is not defined by this + specification, but it could include the following information (obtained from the element's + attributes, again as defined below), in some form or another (possibly simplified), for each + hyperlink created with each link element in the document:

    @@ -90876,7 +90878,7 @@ interface NavigationHistoryEntry : EventTarget For the duration of event firing So that if the navigation is canceled while the event is firing, we can cancel the event - The event's signal + The event's abort controller Until all promises returned from handlers passed to intercept() have settled So that if the navigation is canceled, we can signal abort @@ -91302,8 +91304,9 @@ const p2 = navigation.navigate(url2).finished;
  • If event's dispatch flag is set, then set event's canceled flag to true.

  • -
  • Signal abort on event's signal given error.

  • +
  • Signal abort on event's abort controller given + error.

  • Set navigation's ongoing navigate event to null.

  • @@ -91688,13 +91691,15 @@ callback NavigationInterceptHandler = Promise<undefined>
    +

    Each NavigateEvent has an interception state, which is either "none", "intercepted", "committed", + "scrolled", or "finished", initially "none".

    +

    Each NavigateEvent has a classic history API state, a - serialized state or null. It is only used in some cases where the event's navigationType is "push" or "replace", and is set appropriately when the event is - fired.

    + data-x="concept-NavigateEvent-navigation-handler-list">navigation handler list, a + list of NavigationInterceptHandler callbacks, initially empty.

    Each NavigateEvent has a focus reset behavior, a NavigationFocusReset-or-null, initially null.

    @@ -91703,14 +91708,16 @@ callback NavigationInterceptHandler = Promise<undefined> behavior, a NavigationScrollBehavior-or-null, initially null.

    Each NavigateEvent has an interception state, which is either "none", "intercepted", "committed", - "scrolled", or "finished", initially "none".

    + data-x="concept-NavigateEvent-abort-controller">abort controller, an + AbortController-or-null, initially null.

    Each NavigateEvent has a navigation handler list, a - list of NavigationInterceptHandler callbacks, initially empty.

    + data-x="concept-NavigateEvent-classic-history-API-state">classic history API state, a + serialized state or null. It is only used in some cases where the event's navigationType is "push" or "replace", and is set appropriately when the event is + fired.

    The navigationType, NavigationDestination { tracker.

    -
  • Initialize event's signal to a - new AbortSignal created in navigation's relevant realm.

  • +
  • Set event's abort + controller to a new AbortController created in + navigation's relevant realm.

  • + +
  • Initialize event's signal to + event's abort + controller's signal.

  • Let currentURL be document's URL.

  • @@ -92310,9 +92321,10 @@ interface NavigationDestination { data-x="dom-NavigationType-traverse">traverse", then consume history-action user activation.

    -
  • If event's signal is not - aborted, then abort the ongoing - navigation given navigation.

  • +
  • If event's abort + controller's signal is not aborted, then abort the ongoing navigation + given navigation.

  • Return false.

  • @@ -92469,7 +92481,8 @@ interface NavigationDestination {
  • If event's relevant global object is not fully active, then abort these steps.

  • -
  • If event's signal is

    If event's abort + controller's signal is aborted, then abort these steps.

  • Assert: event equals navigation's ongoing @@ -92503,7 +92516,8 @@ interface NavigationDestination {

  • If event's relevant global object is not fully active, then abort these steps.

  • -
  • If event's signal is

    If event's abort + controller's signal is aborted, then abort these steps.

  • Assert: event equals navigation's ongoing