diff --git a/source b/source index 0a2796d0599..16c1070455d 100644 --- a/source +++ b/source @@ -91083,6 +91083,7 @@ interface Navigation : EventTarget { readonly attribute NavigationHistoryEntry? currentEntry; undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options); readonly attribute NavigationTransition? transition; + readonly attribute NavigationActivation? activation; readonly attribute boolean canGoBack; readonly attribute boolean canGoForward; @@ -93041,6 +93042,96 @@ interface NavigationTransition { + + +
[Exposed=Window]
+interface NavigationActivation {
+  readonly attribute NavigationHistoryEntry? from;
+  readonly attribute NavigationHistoryEntry entry;
+  readonly attribute NavigationType navigationType;
+};
+ +
+
navigation.activation
+
+

A NavigationActivation containing information about the most recent + cross-document navigation, the navigation that "activated" this Document.

+ +

While navigation.currentEntry and the + Document's URL can be updated regularly + due to same-document navigations, navigation.activation stays constant, and its properties + are only updated if the Document is reactivated from history.

+
+ +
navigation.activation.entry
+

A NavigationHistoryEntry, equivalent to the value of the navigation.currentEntry property at the moment the + Document was activated.

+ +
navigation.activation.from
+
+

A NavigationHistoryEntry, representing the Document that was active + right before the current Document. This will have a value null in case the + previous Document was not same origin with this one or if it was the + initial about:blank + Document.

+ +

There are some cases in which either the from or entry NavigationHistoryEntry objects + would not be viable targets for the traverseTo() + method, as they might not be retained in history. For example, the Document can be + activated using location.replace() or its initial + entry could be replaced by history.replaceState(). However, those entries' url property and getState() method are still accessible.

+
+ +
navigation.activation.navigationType
+

One of "push", "replace", "reload", or "traverse", indicating what type of navigation + activated this Document.

+
+ +

Each Navigation has an associated activation, which is null or a + NavigationActivation object, initially null.

+ +

Each NavigationActivation has:

+ + + +

The activation getter steps are to return + this's activation.

+ +

The from getter steps are to return + this's old entry.

+ +

The entry getter steps are to return + this's new entry.

+ +

The navigationType getter steps are to + return this's navigation type.

+
The navigate event
@@ -98140,7 +98231,7 @@ location.href = '#foo';
  • Apply the push/replace history step targetStep to - traversable.

  • + traversable given historyHandling.

    @@ -98512,7 +98603,8 @@ location.href = '#foo';
  • Update document for history step application given navigable's active document, historyEntry, true, - scriptHistoryIndex, and scriptHistoryLength.

    + scriptHistoryIndex, scriptHistoryLength, and + historyHandling.

    This algorithm will be called twice as a result of a single fragment navigation: once synchronously, where best-guess values scriptHistoryIndex and @@ -98545,7 +98637,8 @@ location.href = '#foo';

    1. Finalize a same-document navigation given traversable, - navigable, historyEntry, and entryToReplace.

    2. + navigable, historyEntry, entryToReplace, and + historyHandling.

    3. Invoke WebDriver BiDi fragment navigated with navigable's active browsing context and a new WebDriver BiDi navigation @@ -98559,8 +98652,9 @@ location.href = '#foo';

      To finalize a same-document navigation given a traversable navigable traversable, a navigable targetNavigable, a session - history entry targetEntry, and session history entry-or-null - entryToReplace:

      + history entry targetEntry, a session history entry-or-null + entryToReplace, and a history handling behavior + historyHandling:

      This is used by both fragment navigations and by the URL and history update steps, which are the only synchronous updates to @@ -98614,7 +98708,7 @@ location.href = '#foo';

    4. Apply the push/replace history step targetStep to - traversable.

      + traversable given historyHandling.

      This is done even for "replace" navigations, as it resolves race @@ -99285,7 +99379,8 @@ location.href = '#foo';

      1. Finalize a same-document navigation given traversable, - navigable, newEntry, and entryToReplace.

      2. + navigable, newEntry, entryToReplace, and + historyHandling.

    @@ -100510,15 +100605,18 @@ location.href = '#foo'; data-x="tn-current-session-history-step">current session history step.

  • Return the result of applying the history - step step to traversable given false, null, null, and null.

  • + step step to traversable given false, null, null, null, and + null.

    To apply the push/replace history step given a non-negative integer step - to a traversable navigable traversable:

    + and a history handling behavior historyHandling to a + traversable navigable traversable:

    1. Return the result of applying the history - step step to traversable given false, null, null, and null.

    2. + step step to traversable given false, null, null, null, and + historyHandling.

    Apply the push/replace history step never passes source @@ -100534,7 +100632,8 @@ location.href = '#foo'; data-x="tn-current-session-history-step">current session history step.

  • Return the result of applying the history - step step to traversable given true, null, null, and null.

  • + step step to traversable given true, null, null, null, + and "reload".

    Apply the reload history step never passes source snapshot @@ -100550,8 +100649,9 @@ location.href = '#foo';

    1. Return the result of applying the history step step to traversable given true, - sourceSnapshotParams, initiatorToCheck, and - userInvolvement.

    2. + sourceSnapshotParams, initiatorToCheck, + userInvolvement, and "traverse".


    @@ -100562,8 +100662,9 @@ location.href = '#foo'; non-negative integer step to a traversable navigable traversable, with boolean checkForCancelation, source snapshot params-or-null sourceSnapshotParams, navigable-or-null - initiatorToCheck, and user navigation involvement-or-null - userInvolvementForNavigateEvents, perform the following steps. They return "initiatorToCheck, user navigation involvement-or-null + userInvolvementForNavigateEvents, and NavigationType-or-null + navigationType, perform the following steps. They return "initiator-disallowed", "canceled-by-beforeunload", "canceled-by-navigate", or "applied".

    @@ -100693,6 +100794,34 @@ location.href = '#foo';
    data-x="nav-active-history-entry">active session history entry.

    +
  • +

    Switch on navigationType:

    + +
    +
    "reload"
    +

    Assert: targetEntry's document state's reload pending is true.

    + +
    "traverse"
    +

    Assert: targetEntry's + document state's ever populated is true.

    + +
    "replace"
    +

    Assert: targetEntry's step + is displayedEntry's step and + targetEntry's document state's ever populated is false.

    + +
    "push"
    +

    Assert: targetEntry's step is + displayedEntry's step + 1 and + targetEntry's document state's ever populated is false.

    +
    +
  • +
  • Let oldOrigin be targetEntry's document state's origin.

  • @@ -100971,8 +101100,8 @@ location.href = '#foo'; data-x="she-document">document, targetEntry, changingNavigableContinuation's update-only, - scriptHistoryLength, scriptHistoryIndex, and - entriesForNavigationAPI.

    + scriptHistoryLength, scriptHistoryIndex, navigationType, + entriesForNavigationAPI, and displayedEntry.

  • If targetEntry's document is equal to displayedDocument, then perform updateDocument.

  • @@ -101308,8 +101437,10 @@ location.href = '#foo';

    To update document for history step application given a Document document, a session history entry entry, a boolean doNotReactivate, integers scriptHistoryLength and - scriptHistoryIndex, and an optional list of session history entries entriesForNavigationAPI:

    + scriptHistoryIndex, NavigationType-or-null navigationType, an + optional list of session history entries + entriesForNavigationAPI, and an optional session history entry + previousEntryForActivation:

    1. Let documentIsNew be true if document's latest entry @@ -101324,6 +101455,9 @@ location.href = '#foo';

    2. Set document's history object's length to scriptHistoryLength.

    3. +
    4. Let navigation be history's relevant global object's + navigation API.

    5. +
    6. If documentsEntryChanged is true, then:

      @@ -101336,9 +101470,6 @@ location.href = '#foo';
    7. Restore the history object state given document and entry.

    8. -
    9. Let navigation be history's relevant global object's - navigation API.

    10. -
    11. If documentIsNew is false, then:

      @@ -101389,6 +101520,69 @@ location.href = '#foo';
    +
  • +

    If all the following are true:

    + + + +

    then:

    + +
      +
    1. If navigation's activation is null, then set navigation's + activation to a new + NavigationActivation object in navigation's + relevant realm.

    2. + +
    3. Let previousEntryIndex be the result of + getting the navigation API entry index of previousEntryForActivation + within navigation.

    4. + +
    5. If previousEntryIndex is non-negative, then set activation's + old entry to navigation's entry list[previousEntryIndex].

    6. + +
    7. +

      Otherwise, if all the following are true:

      + +
        +
      • navigationType is "replace";

      • + +
      • previousEntryForActivation's + document state's origin is same origin with + document's origin; and

      • + +
      • previousEntryForActivation's document's + initial about:blank is + false,

      • +
      + +

      then set activation's old entry + to a new NavigationHistoryEntry in navigation's relevant realm, whose session history entry is + previousEntryForActivation.

      +
    8. + +
    9. Set activation's new entry to + navigation's current entry.

    10. + +
    11. Set activation's navigation type to + navigationType.

    12. +
    +
  • +
  • If documentIsNew is true, then: