@@ -89570,20 +91770,39 @@ location.href = '#foo';
navigation process. It is one of the following:
Various parts of the platform track whether a user is involved in a navigation. A user
+ navigation involvement is one of the following:
offline
| Event
From 0e2536f4957f0883fdbc3a5b210da672a63eddae Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Tue, 14 Feb 2023 14:45:04 +0900
Subject: [PATCH 02/30] Allow same-URL push navigations and clean up some
redundancy
---
source | 214 ++++++++++++++++++++++++++++++++-------------------------
1 file changed, 120 insertions(+), 94 deletions(-)
diff --git a/source b/source
index 31ba317ce32..36d87265fd3 100644
--- a/source
+++ b/source
@@ -16422,7 +16422,7 @@ people expect to have work and what is necessary.
flag set, then navigate
document's node navigable to urlRecord using
document, with historyHandling set to "replace ".
+ data-x="NavigationHistoryBehavior-replace">replace".
For the purposes of the previous paragraph, a refresh is said to have come due as soon as
the later of the following two conditions occurs:
@@ -24474,9 +24474,9 @@ document.body.appendChild(wbr);
data-x="navigation-user-involvement">userInvolvement set to userInvolvement.
Unlike many other types of navigations, following hyperlinks does not have
- special "replace " behavior for when documents are not
- completely loaded. This is true for both user-initiated instances of following
- hyperlinks, as well as script-triggered ones via, e.g., replace " behavior for when
+ documents are not completely loaded. This is true for both user-initiated
+ instances of following hyperlinks, as well as script-triggered ones via, e.g., aElement.click() .
@@ -31966,11 +31966,12 @@ interface HTMLIFrameElement : HTMLElement {
null):
- Let historyHandling be "push ".
+ Let historyHandling be "auto ".
If element's nested navigable's active
document is not completely loaded, then set historyHandling to
- "replace ".
+ "replace ".
Navigate element's nested
navigable to url using element's node document, with
@@ -32634,7 +32635,7 @@ interface HTMLEmbedElement : HTMLElement {
data-x="concept-response-url">URL using element's node
document, with response set to
response, and historyHandling set to "replace ".
+ data-x="NavigationHistoryBehavior-replace">replace".
element's src attribute
does not get updated if the nested navigable gets further navigated to
@@ -33135,7 +33136,7 @@ interface HTMLObjectElement : HTMLElement {
navigate the element's nested navigable to
response's URL using the element's
node document, with historyHandling set to
- "replace ".
+ "replace ".
The data attribute of the
object element doesn't get updated if the nested navigable gets
@@ -57858,10 +57859,12 @@ fur
If targetNavigable is null, then return.
- Let historyHandling be "push ".
+ Let historyHandling be "auto ".
If form document has not yet completely loaded, then set
- historyHandling to "replace ".
+ historyHandling to "replace ".
-
If the value of method is Location { // but see also push"):
+ data-x="NavigationHistoryBehavior-auto">auto"):
Let navigable be location's relevant global object's
@@ -85739,7 +85742,8 @@ interface Location { // but see also incumbent global
object does not have transient activation, then set
- historyHandling to "replace ".
+ historyHandling to "replace ".
Navigate navigable to url using
sourceDocument, with exceptionsEnabled set to true and Location { // but see also replace".
+ resulting URL record given "replace ".
The replace() method intentionally has
@@ -86587,13 +86592,13 @@ interface History {
The pushState(data,
unused, url) method steps are to run the shared history
push/replace state steps given this, data, url, and
- "push ".
+ "push ".
The replaceState(data, unused,
url) method steps are to run the shared history push/replace state
steps given this, data, url, and "replace ".
+ data-x="NavigationHistoryBehavior-replace">replace".
The shared history push/replace state steps, given a History
history, a value data, a scalar value string-or-null
@@ -86906,7 +86911,7 @@ dictionary NavigationOptions {
dictionary NavigationNavigateOptions : NavigationOptions {
any state;
- NavigationHistoryBehavior history = "auto";
+ NavigationHistoryBehavior history = "auto";
};
dictionary NavigationReloadOptions : NavigationOptions {
@@ -86919,9 +86924,9 @@ dictionary NavigationResult {
};
enum NavigationHistoryBehavior {
- "auto",
- "push",
- "replace"
+ "auto",
+ "push",
+ "replace"
};
@@ -87024,10 +87029,10 @@ enum NavigationHistoryBehavior {
- "
push "
- - Corresponds to calls to navigate with historyHandling set to "
push ", or to history.pushState() .
+ - Corresponds to calls to navigate where the history handling behavior ends up as "
push ", or to history.pushState() .
- "
replace "
- - Corresponds to calls to navigate with historyHandling set to "
replace ", or to history.replaceState() .
+ - Corresponds to calls to navigate where the history handling behavior ends up as "
replace ", or to history.replaceState() .
- "
reload "
- Corresponds to calls to reload.
@@ -87369,7 +87374,7 @@ interface NavigationHistoryEntry : EventTarget
navigation.currentEntry
Returns the NavigationHistoryEntry corresponding to the current session history entry.
- navigation.updateCurrentEntry({ state }
+ navigation.updateCurrentEntry({ state })
-
Updates the navigation API state of the current session history entry, without performing a navigation like navigation.reload() would do.
@@ -87449,7 +87454,7 @@ interface NavigationHistoryEntry : EventTarget
Navigates the current page to the given url. options can contain the following values:
- history can be set to "replace " to replace the current session history entry, instead of pushing a new one.
+ history can be set to "replace " to replace the current session history entry, instead of pushing a new one.
info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
@@ -87540,27 +87545,7 @@ interface NavigationHistoryEntry : EventTarget
Let document be this's relevant global object's associated Document .
- -
-
If options["history "] is "push ", and any of the following are true:
-
-
- document's is initial about:blank is true;
-
- document is not completely loaded;
-
- urlRecord equals document's URL; or
-
- urlRecord's scheme is "javascript "
-
-
- then return an early error result for a "NotSupportedError " DOMException .
-
-
- These are the conditions under which a "push " navigation will be converted into a "replace " navigation by the navigate algorithm or by the below step. If the developer explicitly requested a push, we fail to let them know it won't happen.
-
- In the future, we could consider loosening some of these conditions.
-
-
+ If options["history "] is "push ", and the navigation must be a replace given urlRecord and document, then return an early error result for a "NotSupportedError " DOMException .
Let state be options["state "], if it exists; otherwise, undefined.
@@ -87576,12 +87561,10 @@ interface NavigationHistoryEntry : EventTarget
Let info be options["info "], if it exists; otherwise, undefined.
- Let historyHandling be "replace " if options["history "] is "replace " or if document is not completely loaded; otherwise, "push ".
-
Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for this given info and serializedState.
-
-
Navigate document's node navigable to urlRecord using document, with historyHandling set to historyHandling and navigationAPIState set to serializedState.
+ Navigate document's node navigable to urlRecord using document, with historyHandling set to options["history "] and navigationAPIState set to serializedState.
Unlike location.assign() and friends, which are exposed across origin-domain boundaries, navigation.navigate() can only be accessed by code with direct synchronous access to the window.navigation property. Thus, we avoid the complications about attributing the source document of the navigation, and we don't need to deal with the allowed by sandboxing to navigate check and its acccompanying exceptionsEnabled flag. We just treat all navigations as if they come from the Document corresponding to this Navigation object itself (i.e., document).
@@ -88274,7 +88257,7 @@ callback NavigationInterceptHandler = Promise<undefined>
If a download was requested, returns the filename that was supplied as the download attribute's value. (This could be the empty string.)
- Note that a download being requested does not always mean that a download will happen: for example, a download might be blocked by browser security policies, or end up being treated as a "push " navigation for unspecified reasons.
+ Note that a download being requested does not always mean that a download will happen: for example, a download might be blocked by browser security policies, or end up being treated as a "push " navigation for unspecified reasons.
Similarly, a navigation might end up being a download even if it was not requested to be one, due to the destination server responding with a `Content-Disposition: attachment ` header.
@@ -90123,8 +90106,8 @@ interface BeforeUnloadEvent : Event {
If the newly created navigable chosen is immediately navigated, then the navigation will be done with "replace " history handling behavior.
+ data-x="navigate">navigated, then the navigation will be done as a "replace " navigation.
- If the user agent has been configured such that in this instance it will choose currentNavigable
@@ -90228,7 +90211,8 @@ interface BeforeUnloadEvent : Event {
same browsing context, such that the mapping is then 1-to-2. This occurs when a
browsing context is navigated from the initial about:blank Document to
- another, which will be done with replacement.
+ another, which will be done with replacement.
Creating browsing contexts
@@ -91765,20 +91749,55 @@ location.href = '#foo';
After Document creation, the relevant traversable navigable's session history gets updated. A history handling
- behavior is used to track the desired type of session history update throughout the
- navigation process. It is one of the following:
+ data-x="tn-session-history-entries">session history gets updated. The
+ NavigationHistoryBehavior enumeration is used to indicate the desired type of
+ session history update to the navigate algorithm. It is one of the following:
- - "
push "
+ - "
push "
- A regular navigation which adds a new session history entry, and will
clear the forward session history.
- - "
replace "
+ - "
replace "
- A navigation that will replace the active session
history entry.
+
+ - "
auto "
+ - The default value, which will be converted very early in the navigate algorithm
+ into "
push " or "replace ". Usually it becomes "push ", but under certain circumstances it becomes "replace " instead.
+ A history handling behavior is a NavigationHistoryBehavior that is
+ either "push " or "replace ", i.e. that has been resolved away from
+ any initial "auto " value.
+
+ The navigation must be a replace, given a URL url and a
+ Document document, if either of the following conditions hold:
+
+
+
+
+ Other cases that often, but not always, force a "replace " navigation are:
+
+
+
+
Various parts of the platform track whether a user is involved in a navigation. A user
@@ -91815,9 +91834,10 @@ location.href = '#foo';
null), an optional response-or-null response (default null), an optional boolean exceptionsEnabled (default false), an optional
- history handling behavior NavigationHistoryBehavior historyHandling (default "push "), an optional serialized state-or-null auto"), an optional serialized
+ state-or-null navigationAPIState (default null), an
optional entry list or null formDataEntryList (default null), an
@@ -91890,23 +91910,25 @@ location.href = '#foo';
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=1946 to 1955 -->
-
-
If any of the following are true:
+ If historyHandling is "auto ", then:
-
- url equals
+
+ If url equals
navigable's active document's URL;
-
- url's scheme is "javascript "; or
-
- navigable's active document's is
- initial about:blank is true
-
+ data-x="concept-document-url">URL, then set historyHandling to "replace ".
- then set historyHandling to "replace ".
+ Otherwise, set historyHandling to "push ".
+
+ If the navigation must be a replace given url and
+ navigable's active document, then set
+ historyHandling to "replace ".
+
If all of the following are true:
@@ -92290,8 +92312,8 @@ location.href = '#foo';
Let entryToReplace be navigable's active session history entry if
- historyHandling is "replace ", otherwise
- null.
+ historyHandling is " replace ",
+ otherwise null.
Let traversable be navigable's traversable navigable.
@@ -92356,7 +92378,7 @@ location.href = '#foo';
Assert: historyHandling is "replace ".
+ data-x="NavigationHistoryBehavior-replace">replace".
Set the ongoing navigation for targetNavigable to null.
@@ -92662,8 +92684,8 @@ location.href = '#foo';
Let entryToReplace be navigable's active session history entry if
- historyHandling is "replace ", otherwise
- null.
+ historyHandling is "replace ",
+ otherwise null.
Let history be navigable's active
document's history object.
@@ -92675,7 +92697,8 @@ location.href = '#foo';
data-x="concept-history-length">length.
-
-
If historyHandling is "push ", then:
+ If historyHandling is "push ", then:
Set history's state to
@@ -92797,8 +92820,9 @@ location.href = '#foo';
-
Apply the history step targetStep to traversable.
- This is done even for "replace " navigations,
- as it resolves race conditions across multiple synchronous navigations.
+ This is done even for "replace " navigations, as it resolves race
+ conditions across multiple synchronous navigations.
@@ -93226,7 +93250,7 @@ location.href = '#foo';
state-or-null serializedData (default
null), and an optional history handling behavior historyHandling (default "replace "), are:
+ data-x="NavigationHistoryBehavior-replace">replace"), are:
Let navigable be document's node navigable.
@@ -93260,7 +93284,8 @@ location.href = '#foo';
-
If document's is initial about:blank is true, then set
- historyHandling to "replace ".
+ historyHandling to "replace ".
This means that pushState() on an
initial about:blank
@@ -93269,10 +93294,11 @@ location.href = '#foo';
Let entryToReplace be activeEntry if historyHandling is
- "replace ", otherwise null.
+ "replace ", otherwise null.
-
-
If historyHandling is "push ", then:
+ If historyHandling is "push ", then:
Increment document's history object's
@@ -96186,7 +96212,7 @@ new PaymentRequest(…); // Allowed to use
data-x="navigation-response">response set to navigationParams's response and historyHandling set to "replace ".
+ data-x="NavigationHistoryBehavior-replace">replace".
Return document.
@@ -115110,17 +115136,17 @@ dictionary StorageEventInit : EventInit {
data-x="concept-encoding-confidence">confidence to certain, and return.
Otherwise, restart the navigate algorithm, with historyHandling set to "replace " and
- other inputs kept the same, but this time skip the encoding sniffing algorithm and
- instead just set the encoding to the new encoding and the confidence to certain. Whenever possible,
- this should be done without actually contacting the network layer (the bytes should be re-parsed
- from memory), even if, e.g., the document is marked as not being cacheable. If this is not
- possible and contacting the network layer would involve repeating a request that uses a method
- other than `GET `, then instead set the confidence to certain and ignore the new
- encoding. The resource will be misinterpreted. User agents may notify the user of the situation,
- to aid in application development.
+ data-x="navigation-hh">historyHandling set to "replace " and other inputs kept the same, but
+ this time skip the encoding sniffing algorithm and instead just set the encoding to
+ the new encoding and the confidence to
+ certain. Whenever possible, this should be done without actually contacting the network
+ layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not
+ being cacheable. If this is not possible and contacting the network layer would involve
+ repeating a request that uses a method other than `GET `, then instead set
+ the confidence to certain and ignore
+ the new encoding. The resource will be misinterpreted. User agents may notify the user of the
+ situation, to aid in application development.
This algorithm is only invoked when a new encoding is found declared on a
From bf1d094a8c7a4fb2c99cf6c05e6247a42dfb4af6 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Fri, 17 Feb 2023 16:43:37 +0900
Subject: [PATCH 03/30] Adaptation of Chromium state machine fix
See https://chromium-review.googlesource.com/c/chromium/src/+/4262131
---
source | 67 +++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 26 deletions(-)
diff --git a/source b/source
index baddf9ee485..9fffd91ecd4 100644
--- a/source
+++ b/source
@@ -89616,7 +89616,7 @@ callback NavigationInterceptHandler = Promise<undefined>
For "push " or "replace " navigations, either resets the scroll position to the top of the document or scrolls to the fragment specified by destination.url if there is one.
- If called more than once, or called after automatic post-transition scroll processing has happened due to the scroll option bieng left as "after-transition ", this method will throw an "InvalidStateError " DOMException .
+ If called more than once, or called after automatic post-transition scroll processing has happened due to the scroll option being left as "after-transition ", or called before the navigation has committed, this method will throw an "InvalidStateError " DOMException .
@@ -89628,7 +89628,7 @@ callback NavigationInterceptHandler = Promise<undefined>
Each NavigateEvent has a scroll behavior, a NavigationScrollBehavior -or-null, initially null.
- Each NavigateEvent has a did process scroll behavior, a boolean, initially false.
+ Each NavigateEvent has a state, which is either "initial ", "committed ", "scrolled ", or "finished ", initially "initial ".
Each NavigateEvent has a was intercepted, a boolean, initially false.
@@ -89654,16 +89654,12 @@ callback NavigationInterceptHandler = Promise<undefined>
The intercept(options) method steps are:
- If this's relevant global object's associated Document is not fully active, then throw an "InvalidStateError " DOMException .
-
- If this's isTrusted attribute was initialized to false, then throw a "SecurityError " DOMException .
+ Perform shared checks given this.
If this's canIntercept attribute was initialized to false, then throw a "SecurityError " DOMException .
If this's dispatch flag is unset, then throw an "InvalidStateError " DOMException .
- If this's canceled flag is set, then throw an "InvalidStateError " DOMException .
-
If options["handler "] exists, then append it to this's navigation handler list.
Set this's was intercepted to true.
@@ -89692,13 +89688,23 @@ callback NavigationInterceptHandler = Promise<undefined>
The scroll() method steps are:
- If this's did process scroll behavior is true, then throw an "InvalidStateError " DOMException .
+ Perform shared checks given this.
+
+ If this's state is not "committed ", then throw an "InvalidStateError " DOMException .
If this's was intercepted is false, then throw an "InvalidStateError " DOMException .
- If this's relevant global object's associated Document is not fully active, then throw an "InvalidStateError " DOMException .
+ Process scroll behavior given this.
+
+
+ To perform shared checks for a NavigateEvent event:
- Definitely process scroll behavior given this.
+
+ If event's relevant global object's associated Document is not fully active, then throw an "InvalidStateError " DOMException .
+
+ If event's isTrusted attribute was initialized to false, then throw a "SecurityError " DOMException .
+
+ If event's canceled flag is set, then throw an "InvalidStateError " DOMException .
@@ -90014,6 +90020,8 @@ interface NavigationDestination {
If event's was intercepted is true:
+ Set event's state to "committed ".
+
Let fromNHE be the current entry of navigation.
Assert: fromNHE is not null.
@@ -90029,7 +90037,7 @@ interface NavigationDestination {
-
If navigationType is "traverse ", then set navigation's suppress normal scroll restoration during ongoing navigation to true.
- If event's scroll behavior was set to "after-transition ", then we will potentially process scroll behavior below. Otherwise, there will be no scroll restoration. That is, no navigation which is intercepted by intercept() goes through the normal scroll restoration process; scroll restoration for such navigations is either done manually, by the web developer, or is done after the transition.
+ If event's scroll behavior was set to "after-transition ", then scroll restoration will happen as part of finishing the relevant NavigateEvent . Otherwise, there will be no scroll restoration. That is, no navigation which is intercepted by intercept() goes through the normal scroll restoration process; scroll restoration for such navigations is either done manually, by the web developer, or is done after the transition.
-
@@ -90078,7 +90086,7 @@ interface NavigationDestination {
Potentially reset the focus given event.
- Potentially process scroll behavior given event.
+ Finish event.
and the following failure steps given reason rejectionReason:
@@ -90097,7 +90105,7 @@ interface NavigationDestination {
Potentially reset the focus given event.
- Although we still potentially reset the focus for such failed transitions, we do not potentially process scroll behavior for them.
+ Although we still potentially reset the focus for such failed transitions, we do not finish them.
@@ -90161,26 +90169,34 @@ interface NavigationDestination {
Move the sequential focus navigation starting point to focusTarget.
- To potentially process scroll behavior given a NavigateEvent event:
+ To finish a NavigateEvent event:
- If event's was intercepted is false, then return.
+ Assert: event's state is "committed " or "scrolled ".
-
-
If event's scroll behavior is "manual ", then return.
+ If all of the following hold:
- If it was left as null, then we treat that as "after-transition ", and continue onward.
-
+
+ event's was intercepted is true;
+
+ event's scroll behavior is "manual "; and
- If event's did process scroll behaviordid process scroll behavior is true, then return.
+ event's state is "committed "
+
+
+ then process scroll behavior given event.
+
- Definitely process scroll behavior given event.
+ Set event's state to "finished ".
- To definitely process scroll behavior given a NavigateEvent event:
+ To process scroll behavior given a NavigateEvent event:
- Set event's did process scroll behavior to true.
+ Assert: event's state is "committed ".
+
+ Set event's state to "scrolled ".
If event's navigationType was initialized to "traverse " or "reload ", then restore scroll position data given event's relevant global object's navigable's active session history entry.
@@ -96948,10 +96964,9 @@ location.href = '#foo';
If suppress normal scroll restoration during ongoing navigation is
true, then restoring scroll position data
- might still happen at a later point, as part of potentially processing scroll behavior for the relevant
- Navigation object, or via a navigateEvent.scroll() method call.
+ might still happen at a later point, as part of finishing the relevant NavigateEvent , or via
+ a navigateEvent.scroll() method call.
-
From aad584dee2fc76cf62c85d88b8a7ce5663c48755 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 20 Feb 2023 13:21:44 +0900
Subject: [PATCH 04/30] Sync with Chromium changes
---
source | 94 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 48 insertions(+), 46 deletions(-)
diff --git a/source b/source
index 9fffd91ecd4..679269156be 100644
--- a/source
+++ b/source
@@ -89628,9 +89628,7 @@ callback NavigationInterceptHandler = Promise<undefined>
Each NavigateEvent has a scroll behavior, a NavigationScrollBehavior -or-null, initially null.
- Each NavigateEvent has a state, which is either "initial ", "committed ", "scrolled ", or "finished ", initially "initial ".
-
- Each NavigateEvent has a was intercepted, a boolean, initially false.
+ Each NavigateEvent has an interception state, which is either "none ", "intercepted ", "committed ", "scrolled ", or "finished ", initially "none ".
Each NavigateEvent has a needs continue, a boolean, initially false.
@@ -89660,9 +89658,11 @@ callback NavigationInterceptHandler = Promise<undefined>
If this's dispatch flag is unset, then throw an "InvalidStateError " DOMException .
- If options["handler "] exists, then append it to this's navigation handler list.
+ Assert: this's interception state is either "none " or "intercepted ".
+
+ Set this's interception state to "intercepted ".
- Set this's was intercepted to true.
+ If options["handler "] exists, then append it to this's navigation handler list.
-
If options["focusReset "] exists, then:
@@ -89690,9 +89690,7 @@ callback NavigationInterceptHandler = Promise<undefined>
Perform shared checks given this.
- If this's state is not "committed ", then throw an "InvalidStateError " DOMException .
-
- If this's was intercepted is false, then throw an "InvalidStateError " DOMException .
+ If this's interception state is not "committed ", then throw an "InvalidStateError " DOMException .
Process scroll behavior given this.
@@ -90004,7 +90002,7 @@ interface NavigationDestination {
Let apiMethodTracker be navigation's ongoing API method tracker.
- Let endResultIsSameDocument be true if event's was intercepted is true or event's destination 's is same document is true.
+ Let endResultIsSameDocument be true if event's interception state is not "none " or event's destination 's is same document is true.
-
Prepare to run script given navigation's relevant settings object.
@@ -90017,10 +90015,10 @@ interface NavigationDestination {
-
-
If event's was intercepted is true:
+ If event's interception state is not "none ":
- Set event's state to "committed ".
+ Set event's interception state to "committed ".
Let fromNHE be the current entry of navigation.
@@ -90084,9 +90082,7 @@ interface NavigationDestination {
If apiMethodTracker is non-null, then resolve the finished promise for apiMethodTracker.
- Potentially reset the focus given event.
-
- Finish event.
+ Finish event given true.
and the following failure steps given reason rejectionReason:
@@ -90102,11 +90098,7 @@ interface NavigationDestination {
If apiMethodTracker is non-null, then reject the finished promise for apiMethodTracker with rejectionReason.
- -
-
Potentially reset the focus given event.
-
- Although we still potentially reset the focus for such failed transitions, we do not finish them.
-
+ Finish event given false.
@@ -90120,9 +90112,9 @@ interface NavigationDestination {
Per the previous note, this stops suppress any potential promise handler microtasks, causing them to run at this point or later.
- If event's was intercepted is true, then return false.
+ If event's interception state is "none ", then return true.
- Return true.
+ Return false.
To maybe continue the navigate event, given a Navigation navigation:
@@ -90137,6 +90129,38 @@ interface NavigationDestination {
By calling navigateEvent.intercept() , web developers can suppress the normal scroll and focus behavior for same-document navigations, instead invoking cross-document navigation-like behavior at a later time. The algorithms in this section are called at those appropriate later points.
+ To finish a NavigateEvent event, given a boolean didFulfill:
+
+
+ Assert: event's interception state is not "finished ".
+
+ Potentially reset the focus given event.
+
+ -
+
If event's interception state is not "none ":
+
+
+ Assert: event's interception state is not "intercepted ".
+
+ -
+
If all of the following hold:
+
+
+
+ then process scroll behavior given event.
+
+
+
+
+ Set event's interception state to "finished ".
+
+
To potentially reset the focus given a NavigateEvent event:
@@ -90148,7 +90172,7 @@ interface NavigationDestination {
If focusChanged is true, then return.
- If event's was intercepted is false, then return.
+ If event's interception state is "none ", then return.
-
If event's focus reset behavior is "manual ", then return.
@@ -90169,34 +90193,12 @@ interface NavigationDestination {
Move the sequential focus navigation starting point to focusTarget.
- To finish a NavigateEvent event:
-
-
- Assert: event's state is "committed " or "scrolled ".
-
- -
-
If all of the following hold:
-
-
- event's was intercepted is true;
-
- event's scroll behavior is "manual "; and
-
- event's state is "committed "
-
-
- then process scroll behavior given event.
-
-
- Set event's state to "finished ".
-
-
To process scroll behavior given a NavigateEvent event:
- Assert: event's state is "committed ".
+ Assert: event's interception state is "committed ".
- Set event's state to "scrolled ".
+ Set event's interception state to "scrolled ".
If event's navigationType was initialized to "traverse " or "reload ", then restore scroll position data given event's relevant global object's navigable's active session history entry.
From 36833af0c78551b36654e40099236d5e78870579 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 20 Feb 2023 13:47:55 +0900
Subject: [PATCH 05/30] Another attempt
---
source | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/source b/source
index 679269156be..fb89f9b9f51 100644
--- a/source
+++ b/source
@@ -90132,31 +90132,13 @@ interface NavigationDestination {
To finish a NavigateEvent event, given a boolean didFulfill:
- Assert: event's interception state is not "finished ".
+ Assert: event's interception state is not "intercepted " or "finished ".
- Potentially reset the focus given event.
-
- -
-
If event's interception state is not "none ":
-
-
- Assert: event's interception state is not "intercepted ".
-
- -
-
If all of the following hold:
-
-
- event's interception state is "committed ";
+ If event's interception state is "none ", then return.
- didFulfill is true; and
+ Potentially reset the focus given event.
- event's scroll behavior is not "manual "
-
-
- then process scroll behavior given event.
-
-
-
+ If didFulfill is true, then potentially process scroll behavior given event.
Set event's interception state to "finished ".
@@ -90164,6 +90146,8 @@ interface NavigationDestination {
To potentially reset the focus given a NavigateEvent event:
+ Assert: event's interception state is "committed " or "scrolled ".
+
Let navigation be event's relevant global object's navigation API.
Let focusChanged be navigation's focus changed during ongoing navigation.
@@ -90172,8 +90156,6 @@ interface NavigationDestination {
If focusChanged is true, then return.
- If event's interception state is "none ", then return.
-
-
If event's focus reset behavior is "manual ", then return.
@@ -90193,6 +90175,18 @@ interface NavigationDestination {
Move the sequential focus navigation starting point to focusTarget.
+ To potentially process scroll behavior given a NavigateEvent event:
+
+
+ Assert: event's interception state is "committed " or "scrolled ".
+
+ If event's interception state is "scrolled ", then return.
+
+ If event's scroll behavior is "manual ", then return.
+
+ Process scroll behavior given event.
+
+
To process scroll behavior given a NavigateEvent event:
From c59c05092cc06539bbc2cfbb05909985641c88da Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 20 Feb 2023 13:58:23 +0900
Subject: [PATCH 06/30] Add that note back
---
source | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/source b/source
index fb89f9b9f51..ba38b8ee0d8 100644
--- a/source
+++ b/source
@@ -90182,7 +90182,11 @@ interface NavigationDestination {
If event's interception state is "scrolled ", then return.
- If event's scroll behavior is "manual ", then return.
+ -
+
If event's scroll behavior is "manual ", then return.
+
+ If it was left as null, then we treat that as "after-transition ", and continue onward.
+
Process scroll behavior given event.
From 0882857bc5d6f34ae4b85c63d219dddc2a74046d Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 22 Feb 2023 12:01:03 +0900
Subject: [PATCH 07/30] History-action user activation, mostly used (still need
to consume)
---
source | 132 ++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 92 insertions(+), 40 deletions(-)
diff --git a/source b/source
index 721dd28462d..e86d4321da4 100644
--- a/source
+++ b/source
@@ -76416,14 +76416,18 @@ END:VCARD
Data model
- For the purpose of tracking user activation, each Window W has a
- last activation timestamp. This is a number indicating the last time W got
- an activation notification. It corresponds to a
- DOMHighResTimeStamp value except for two cases: positive infinity
- indicates that W has never been activated, while negative infinity indicates that a user activation-gated API has consumed the last user activation of W. The initial value is
- positive infinity.
+ For the purpose of tracking user activation, each Window W has a two
+ relevant values:
+
+
+ A last activation timestamp, which is either a
+ DOMHighResTimeStamp , positive infinity (indicating that W has never been
+ activated), or negative infinity (indicating that the activation has been consumed). Initially positive infinity.
+
+ A last history-action activation timestamp, which is either a
+ DOMHighResTimeStamp or positive infinity, initially positive infinity.
+
A user agent also defines a transient activation duration, which is a constant
number indicating how long a user activation is available for certain
seconds, so that the user can possibly perceive the link between an interaction with the page and
the page calling the activation-gated API.
- These two values imply two boolean user activation states for W:
+ We then have the following boolean user activation states for W:
- Sticky activation
@@ -76464,18 +76468,34 @@ END:VCARD
become false even before the expiry time through an activation consumption.
+
+ - History-action activation
+ -
+
When the last history-action activation timestamp of W is not equal
+ to the last activation timestamp of W, then W is said to
+ have history-action activation.
+
+ This is a special variant of user activation, used to allow access to certain session
+ history APIs which, if used too frequently, would make it harder for the user to traverse back
+ using browser UI. It starts with a false value, and becomes
+ true whenever the user interacts with W, but is reset to false through history-action activation consumption.
+ This ensures such APIs cannot be used multiple times in a row without an intervening user
+ activation. But unlike transient activation, there is no time limit within which
+ such APIs must be used.
+
- The last activation timestamp is retained even after the
- Document changes its fully active status (e.g. after navigating away
- from a Document , or navigating to a cached Document ). This means
- sticky activation state spans multiple navigations as long as the same
- Document gets reused. For the transient activation state, the original
- expiry time remains unchanged (i.e. the state still
- expires within the transient activation duration limit from the original
- activation triggering input event). It is important to consider this when deciding
- whether to base certain things off sticky activation or transient
- activation.
+ The last activation timestamp and last history-action
+ activation timestamp are retained even after the Document changes its
+ fully active status (e.g. after navigating away from a Document , or
+ navigating to a cached Document ). This means sticky activation state
+ spans multiple navigations as long as the same Document gets reused. For the
+ transient activation state, the original expiry time
+ remains unchanged (i.e. the state still expires within the transient activation
+ duration limit from the original activation triggering input event). It is
+ important to consider this when deciding whether to base certain things off sticky
+ activation or transient activation.
Processing model
@@ -76542,6 +76562,29 @@ END:VCARD
window's last activation timestamp to negative infinity.
+ History-action activation-consuming
+ APIs can consume history-action user activation by performing the following
+ steps, given a Window W:
+
+
+ If W's navigable is null, then
+ return.
+
+ Let top be W's navigable's
+ top-level traversable.
+
+ Let navigables be the inclusive descendant navigables of
+ top's active document.
+
+ Let windows be the list of Window objects constructed by taking
+ the active window of each item in
+ navigables.
+
+ For each window in windows, set
+ window's last history-action activation timestamp to window's
+ window's last activation timestamp.
+
+
Note the asymmetry in the sets of browsing
contexts in the page that are affected by an activation notification vs an
activation consumption: an activation consumption
@@ -76555,26 +76598,27 @@ END:VCARD
- APIs that are dependent on user activation are classified into three different levels. The
- levels are as follows, sorted by their "strength of dependence" on user activation (from weakest
- to strongest):
+ APIs that are dependent on user activation are classified into different levels:
- - Sticky activation-gated APIs
These APIs require the sticky
- activation state to be true, so they are blocked until the very first user
+ - Sticky activation-gated APIs
+ These APIs require the sticky activation state to be true, so they are
+ blocked until the very first user activation.
+
+ - Transient activation-gated APIs
-
+
These APIs require the transient activation state to be true, but they don't
+ consume it, so multiple calls are allowed per user
+ activation until the transient state expires.
+
+ - Transient activation-consuming APIs
+ These APIs require the transient activation state to be true, and they
+ consume user activation in each call to prevent multiple calls per user
activation.
- - Transient activation-gated APIs
-
These APIs require the transient
- activation state to be true, but they don't consume it, so multiple calls are allowed per user activation until the
- transient state expires.
-
- - Transient activation-consuming APIs
These APIs require the
- transient activation state to be true, and they consume user
- activation in each call to prevent multiple calls per user activation.
+ - History-action activation-consuming APIs
+ These APIs require the history-action activation state to be true, and they
+ consume history-action user activation in each call to prevent multiple calls per
+ user activation.
@@ -90079,18 +90123,26 @@ interface NavigationDestination {
If document can have its URL rewritten to destination's URL, and either destination's is same document is true or navigationType is not "traverse ", then initialize event's canIntercept to true. Otherwise, initialize it to false.
- Let traverseCanBeCanceled be true if userInvolvement is not "browser UI ", or if navigation's relevant global object has transient activation; otherwise, false.
+ Let traverseCanBeCanceled be true if all of the following are true:
+
+
+ navigable is a top-level traversable;
- The user activation check here is expected to get slightly more lenient in the future; see WICG/navigation-api#32.
+ destination's is same document is true; and
+
+ either userInvolvement is not "browser UI ", or navigation's relevant global object has transient activation.
+
+
+ Otherwise, let it be false.
- If any of the following are true:
+ If either:
-
+
navigationType is not "traverse "; or
- navigable is a top-level traversable and traverseCanBeCanceled is true
+ traverseCanBeCanceled is true
the initialize event's cancelable to true. Otherwise, initialize it to false.
From 5fd15c825659d2a067b21e60abc762e90671928d Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 22 Feb 2023 16:14:18 +0900
Subject: [PATCH 08/30] Savepoint. Still not firing for traverses quite right.
---
source | 304 +++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 197 insertions(+), 107 deletions(-)
diff --git a/source b/source
index e86d4321da4..f0fc9b6be6d 100644
--- a/source
+++ b/source
@@ -89251,7 +89251,7 @@ interface NavigationHistoryEntry : EventTarget
This can occur if a previously queued traversal already took us to this session history entry. In that case the previous traversal will have dealt with apiMethodTracker already.
- Let result be the result of applying the history step given by targetSHE's step to traversable, with checkForUserCancelation set to true, sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to navigable. TODO actually change apply the history step to have a useful return value.
+ Let result be the result of applying the history step given by targetSHE's step to traversable, with checkForCancelation set to true, sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to navigable. TODO actually change apply the history step to have a useful return value.
If result is "canceled ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to finalize with an aborted navigation error given navigation and apiMethodTracker.
@@ -89852,8 +89852,6 @@ 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 needs continue, a boolean, initially false.
-
Each NavigateEvent has a navigation handler list, a list of NavigationInterceptHandler callbacks, initially empty.
The NavigationDestination {
If document can have its URL rewritten to destination's URL, and either destination's is same document is true or navigationType is not "traverse ", then initialize event's canIntercept to true. Otherwise, initialize it to false.
-
+
Let traverseCanBeCanceled be true if all of the following are true:
@@ -90212,26 +90210,6 @@ interface NavigationDestination {
-
- If destination's is same document is true and navigationType is "traverse ":
-
-
- Set event's needs continue to true.
-
- Return true.
-
-
-
- Return the result of reacting to the navigate event result given navigation and event.
-
-
- To react to the navigate event result, given a Navigation navigation and a NavigateEvent event:
-
-
- Let navigationType be event's navigationType .
-
- Let apiMethodTracker be navigation's ongoing API method tracker.
-
Let endResultIsSameDocument be true if event's interception state is not "none " or event's destination 's is same document is true.
-
@@ -90271,7 +90249,11 @@ interface NavigationDestination {
-
If navigationType is "push " or "replace ", then run the URL and history update steps given document and event's destination 's URL, with serialiedData set to event's classic history API state and historyHandling set to navigationType.
- If navigationType is "reload ", then we are converting a reload into a "same-document reload", for which the URL and history update steps are not appropriate. Navigation API-related stuff still happens, such as updating the active session history entry's navigation API state if this was caused by a call to navigation.reload() , and all the ongoing navigation tracking.
+
+ If navigationType is "reload ", then we are converting a reload into a "same-document reload", for which the URL and history update steps are not appropriate. Navigation API-related stuff still happens, such as updating the active session history entry's navigation API state if this was caused by a call to navigation.reload() , and all the ongoing navigation tracking.
+
+ If navigationType is "traverse ", then this event firing is happening as part of the traversal process, and that process will take care of performing the appropriate session history entry updates.
+
@@ -90347,13 +90329,6 @@ interface NavigationDestination {
Return false.
- To maybe continue the navigate event, given a Navigation navigation:
-
-
- If navigation's ongoing navigate event is null, or navigation's ongoing navigate event's needs continue is false, then return.
-
- React to the navigate event result given navigation and navigation's ongoing navigate event.
-
@@ -90637,9 +90612,9 @@ interface BeforeUnloadEvent : Event {
There are no BeforeUnloadEvent -specific initialization methods.
The BeforeUnloadEvent interface is a legacy interface which allows checking
- if unloading is user-canceled to be controlled not only by canceling the event, but by
- setting the returnValue attribute to a
- value besides the empty string. Authors should use the to be controlled not only by canceling the event, but by setting
+ the returnValue attribute to a value
+ besides the empty string. Authors should use the preventDefault() method, or other means of canceling
events, instead of using returnValue .
@@ -90647,7 +90622,7 @@ interface BeforeUnloadEvent : Event {
The returnValue attribute controls the
- process of checking if unloading is user-canceled. When the event is created, the
+ process of checking if unloading is canceled. When the event is created, the
attribute must be set to the empty string. On getting, it must return the last value it was set
to. On setting, the attribute must be set to the new value.
@@ -91392,8 +91367,8 @@ interface BeforeUnloadEvent : Event {
Let toUnload be traversable's active
document's inclusive descendant navigables.
- If the result of checking if unloading is user-canceled for
- toUnload is true, then return.
+ If the result of checking if unloading is canceled for toUnload
+ is true, then return.
Unload the active
documents of each of toUnload. In what
@@ -93136,7 +93111,7 @@ location.href = '#foo';
To apply pending history changes to a traversable navigable
- traversable with optional boolean checkForUserCancelation (default
+ traversable with optional boolean checkForCancelation (default
false):
@@ -93144,8 +93119,8 @@ location.href = '#foo';
data-x="tn-current-session-history-step">current session history step .
Apply the history step targetStep to traversable with
- checkForUserCancelation set to
- checkForUserCancelation.
+ checkForCancelation set to
+ checkForCancelation.
@@ -93647,7 +93622,7 @@ location.href = '#foo';
Let unloadPromptCanceled be the result of checking if unloading is
- user-canceled for navigable's active
+ canceled for navigable's active
document's inclusive descendant navigables.
-
@@ -94566,20 +94541,119 @@ location.href = '#foo';
Return true.
- To check if unloading is user-canceled for list of navigables navigables:
+ To check if unloading is canceled for a list of navigables navigablesThatNeedBeforeUnload, given an optional
+ traversable navigable traversable, an optional integer
+ targetStep, and an optional user navigation involvement
+ userInvolvement:
- Let documents be the active document of
- each item in navigables.
+ Let documentsToFireBeforeunload be the active
+ document of each item in
+ navigablesThatNeedBeforeUnload.
Let unloadPromptShown be false.
- Let unloadPromptCanceled be false.
+ Let unloadCanceled be false.
+
+ -
+
If traversable was given, then:
+
+
+ Assert: targetStep and userInvolvement were
+ given.
+
+ Let targetEntry be the result of getting the target history
+ entry given traversable and targetStep.
+
+ -
+
If targetEntry is not traversable's current session history entry, and
+ targetEntry's document state's origin is the same as
+ traversable's current session history
+ entry document state's origin, then:
+
+
+ In this case, we're going to fire the navigate event
+ for traversable here. Because under some circumstances it might be
+ canceled, we need to do this separately from other traversal navigate events, which happen later.
+
+ Additionally, because we want beforeunload
+ events to fire before navigate events, this means we
+ need to fire beforeunload for
+ traversable here (if applicable), instead of doing it as part of the below loop
+ over documentsToFireBeforeunload.
+
+
+
+ Let eventsFired be false.
+
+ Let needsBeforeunload be true if navigablesThatNeedBeforeUnload
+ contains traversable; otherwise
+ false.
+
+ If needsBeforeunload is true, then remove traversable's active
+ document from documentsToFireBeforeunload.
+
+ -
+
Queue a global task on the navigation and traversal task
+ source given traversable's active window
+ to perform the following steps:
+
+
+ -
+
If needsBeforeunload is true, then:
+
+
+ Let (unloadPromptShownForThisDocument,
+ unloadPromptCanceledByThisDocument) be the result of running the steps
+ to fire beforeunload given
+ traversable's active document and
+ false.
+
+ If unloadPromptShownForThisDocument is true, then set
+ unloadPromptShown to true.
+
+ If unloadPromptCanceledByThisDocument is true, then set
+ unloadCanceled to true.
+
+
+
+ If unloadCanceled is true, then abort these steps.
+
+ Let navigation be traversable's active window's navigation
+ API.
+
+ Let navigateEventResult be the result of firing a traverse navigate
+ event at a Navigation navigation given
+ targetEntry and userInvolvement.
+
+ If navigateEventResult is false, then set unloadCanceled to
+ true.
+
+ Set eventsFired to true.
+
+
+
+ Wait until eventsFired is true.
+
+ If unloadCanceled is true, then return true.
+
+
+
+
Let totalTasks be the size of
- documents.
+ documentsThatNeedBeforeunload.
Let completedTasks be 0.
@@ -94589,77 +94663,96 @@ location.href = '#foo';
document's relevant global object to run the steps:
- Increase the document's unload counter by 1.
+ Let (unloadPromptShownForThisDocument,
+ unloadPromptCanceledByThisDocument) be the result of running the steps to
+ fire beforeunload given document
+ and unloadPromptShown.
- Increase the event loop's termination nesting level by
- 1.
+ If unloadPromptShownForThisDocument is true, then set
+ unloadPromptShown to true.
- Let event be the result of creating an event using
- BeforeUnloadEvent .
+ If unloadPromptCanceledByThisDocument is true, then set
+ unloadCanceled to true.
- Initialize event's type attribute to
- beforeunload and its cancelable attribute true.
+ Increment completedTasks.
+
+
- Dispatch event at
- document's relevant global object.
+ Wait for completedTasks to be totalTasks.
- Decrease the event loop's termination nesting level by
- 1.
+ Return unloadCanceled.
+
-
- If all of the following are true:
+ The steps to fire beforeunload given a
+ Document document and a boolean unloadPromptShown are:
-
+ Decrease document's relevant agent's event loop's termination nesting level by
+ 1.
- then:
+
+ If all of the following are true:
-
- Set unloadPromptShown to true.
+
+ unloadPromptShown is false;
- Invoke WebDriver BiDi user prompt opened with document's
- relevant global object, "beforeunload ", and "".
+ document's active sandboxing flag set does not have its
+ sandboxed modals flag set;
- -
-
Ask the user to confirm that they wish to unload the document, and pause
- while waiting for the user's response.
+ document's relevant global object has sticky
+ activation;
- The message shown to the user is not customizable, but instead determined
- by the user agent. In particular, the actual value of the returnValue attribute is ignored.
-
+ eventFiringResult is false, or the returnValue attribute of event is
+ not the empty string; and
+
+ showing an unload prompt is unlikely to be annoying, deceptive, or pointless
+
- If the user did not confirm the page navigation, set unloadPromptCanceled
- to true.
+ then:
- Invoke WebDriver BiDi user prompt closed with document's
- relevant global object and true if unloadPromptCanceled is false or
- false otherwise.
-
+
+ Set unloadPromptShown to true.
+
+ Invoke WebDriver BiDi user prompt opened with document's
+ relevant global object, "beforeunload ", and "".
+
+ -
+
Ask the user to confirm that they wish to unload the document, and pause
+ while waiting for the user's response.
+
+ The message shown to the user is not customizable, but instead determined by
+ the user agent. In particular, the actual value of the returnValue attribute is ignored.
- Decrease the document's unload counter by 1.
+ If the user did not confirm the page navigation, set unloadPromptCanceled to
+ true.
- Increment completedTasks.
+ Invoke WebDriver BiDi user prompt closed with document's
+ relevant global object and true if unloadPromptCanceled is false or
+ false otherwise.
- Wait for completedTasks to be totalTasks.
+ Decrease document's unload counter by 1.
- Return unloadPromptCanceled.
+ Return (unloadPromptShown, unloadPromptCanceled).
@@ -94797,8 +94890,8 @@ location.href = '#foo';
contains">exist, then abort these steps.
Apply the history step allSteps[targetStepIndex] to
- traversable, with checkForUserCancelation
- set to true, sourceSnapshotParams set to
+ traversable, with checkForCancelation set
+ to true, sourceSnapshotParams set to
sourceSnapshotParams, initiatorToCheck
set to initiatorToCheck, and userInvolvement set to
@@ -96063,7 +96156,7 @@ location.href = '#foo';
To apply the history step
non-negative integer step to a traversable navigable
traversable, with optional boolean checkForUserCancelation (default false),
+ data-x="apply-history-step-check">checkForCancelation (default false),
optional source snapshot params-or-null sourceSnapshotParams (default null),
optional navigable
targetStep.
- If checkForUserCancelation is true, and the result of checking if unloading
- is user-canceled given navigablesCrossingDocuments given
- traversable and targetStep is true, then return.
+ If checkForCancelation is true, and the result of checking if unloading is
+ canceled given navigablesCrossingDocuments, traversable,
+ targetStep, and userInvolvement is true, then return.
- Some algorithms check if
- unloading is user-canceled as a prerequisite to modifying the history tree. Those
- algorithms will set checkForUserCancelation to false when calling this algorithm to
+ Some algorithms check if
+ unloading is canceled as a prerequisite to modifying the history tree. Those
+ algorithms will set checkForCancelation to false when calling this algorithm to
avoid performing the check twice.
-
- It might not be correct to block on beforeunload results here. This may have
- observable consequences.
Let changingNavigables be the result of get all navigables whose current
From 86718c39c4a11e0df1c1c6cd069532483f58bbfd Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Fri, 24 Feb 2023 10:13:17 +0900
Subject: [PATCH 09/30] Move finish call
Aligns with latest work in https://chromium-review.googlesource.com/c/chromium/src/+/4262131/10
---
source | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source b/source
index f0fc9b6be6d..8fec77fa250 100644
--- a/source
+++ b/source
@@ -90286,6 +90286,8 @@ interface NavigationDestination {
If event equals navigation's ongoing navigate event, then set navigation's ongoing navigate event to null.
+ Finish event given true.
+
Fire an event named navigatesuccess at navigation.
If navigation's transition is not null, then resolve navigation's transition's finished promise with undefined.
@@ -90293,8 +90295,6 @@ interface NavigationDestination {
Set navigation's transition to null.
If apiMethodTracker is non-null, then resolve the finished promise for apiMethodTracker.
-
- Finish event given true.
and the following failure steps given reason rejectionReason:
@@ -90302,6 +90302,8 @@ interface NavigationDestination {
If event's signal is aborted, then abort these steps.
+ Finish event given false.
+
Fire an event named navigateerror at navigation using ErrorEvent , with error initialized to rejectionReason, and message , filename , lineno , and colno initialized to appropriate values that can be extracted from rejectionReason in the same underspecified way that the report the exception algorithm does.
If navigation's transition is not null, then reject navigation's transition's finished promise with rejectionReason.
@@ -90309,8 +90311,6 @@ interface NavigationDestination {
Set navigation's transition to null.
If apiMethodTracker is non-null, then reject the finished promise for apiMethodTracker with rejectionReason.
-
- Finish event given false.
From 9107af97267e12c90c3373da75636273a27a1dd9 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 14:39:30 +0900
Subject: [PATCH 10/30] Some fixes to committed/finished promise
---
source | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/source b/source
index 4f59d2633c9..f1dfb5421db 100644
--- a/source
+++ b/source
@@ -89847,7 +89847,11 @@ const p2 = navigation.navigate(url2).finished;
To resolve the finished promise for a navigation API method tracker apiMethodTracker:
- If apiMethodTracker's finished promise is null, then return.
+ -
+
Resolve apiMethodTracker's committed promise with its committed-to entry.
+
+ Usually, notify about the committed-to entry has previously been called on apiMethodTracker, and so this will do nothing. However, in some cases resolve the finished promise is called directly, in which case this step is necessary.
+
Resolve apiMethodTracker's finished promise with its committed-to entry.
@@ -89857,9 +89861,11 @@ const p2 = navigation.navigate(url2).finished;
To reject the finished promise for a navigation API method tracker apiMethodTracker with a JavaScript value exception:
- If apiMethodTracker's finished promise is null, then return.
+ -
+
Reject apiMethodTracker's committed promise with exception.
- If apiMethodTracker's committed promise is not null, then reject apiMethodTracker's committed promise with exception.
+ This will do nothing if apiMethodTracker's committed promise was previously resolved via notify about the committed-to entry.
+
Reject apiMethodTracker's finished promise with exception.
From e21fdd1a640559719ddcb841df27a25f2f509521 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 15:53:08 +0900
Subject: [PATCH 11/30] Revamp so we properly fire same-document traversals
---
source | 206 ++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 125 insertions(+), 81 deletions(-)
diff --git a/source b/source
index f1dfb5421db..b219058ca6e 100644
--- a/source
+++ b/source
@@ -89329,7 +89329,7 @@ interface NavigationHistoryEntry : EventTarget
{ committed, finished } = navigation.traverseTo(key)
{ committed, finished } = navigation.traverseTo(key, { info })
-
-
Traverses to the closest session history entry that matches the NavigationHistoryEntry with the given key. info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
+ Traverses to the closest session history entry that matches the NavigationHistoryEntry with the given key. info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
If a traversal to that session history entry is already in progress, then this will return the promises for that original traversal, and info will be ignored.
@@ -89531,7 +89531,7 @@ interface NavigationHistoryEntry : EventTarget
This can occur if a previously queued traversal already took us to this session history entry. In that case the previous traversal will have dealt with apiMethodTracker already.
- Let result be the result of applying the history step given by targetSHE's step to traversable, with checkForCancelation set to true, sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to navigable. TODO actually change apply the history step to have a useful return value.
+ Let result be the result of applying the traverse history step given by targetSHE's step to traversable, given sourceSnapshotParams, navigable, and "none ". TODO actually change apply the history step to have a useful return value.
If result is "canceled ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to finalize with an aborted navigation error given navigation and apiMethodTracker.
@@ -90538,7 +90538,7 @@ interface NavigationDestination {
If navigationType is "reload ", then we are converting a reload into a "same-document reload", for which the URL and history update steps are not appropriate. Navigation API-related stuff still happens, such as updating the active session history entry's navigation API state if this was caused by a call to navigation.reload() , and all the ongoing navigation tracking.
- If navigationType is "traverse ", then this event firing is happening as part of the traversal process, and that process will take care of performing the appropriate session history entry updates.
+ If navigationType is "traverse ", then this event firing is happening as part of the traversal process, and that process will take care of performing the appropriate session history entry updates.
@@ -91377,7 +91377,8 @@ interface BeforeUnloadEvent : Event {
parentDocState's nested
histories.
- Apply pending history changes to traversable.
+ Update for navigable creation/destruction given
+ traversable.
@@ -91608,7 +91609,8 @@ interface BeforeUnloadEvent : Event {
history traversal steps to traversable:
- Apply pending history changes to traversable.
+ Update for navigable creation/destruction given
+ traversable.
@@ -93396,19 +93398,6 @@ location.href = '#foo';
Return steps, sorted.
- To apply pending history changes to a traversable navigable
- traversable with optional boolean checkForCancelation (default
- false):
-
-
- Let targetStep be traversable's current session history step.
-
- Apply the history step targetStep to traversable with
- checkForCancelation set to
- checkForCancelation.
-
-
Navigation
@@ -93822,7 +93811,7 @@ location.href = '#foo';
Any attempts to navigate a navigable that is currently traversing are ignored.
+ data-x="apply the traverse history step">traversing are ignored.
@@ -94193,7 +94182,7 @@ location.href = '#foo';
- Apply the history step targetStep to
+ Apply the push/replace history step targetStep to
traversable.
@@ -94651,7 +94640,8 @@ location.href = '#foo';
- Apply the history step targetStep to traversable.
+ Apply the push/replace history step targetStep to
+ traversable.
This is done even for "replace " navigations, as it resolves race
@@ -94831,8 +94821,8 @@ location.href = '#foo';
canceled">check if unloading is canceled for a list of navigables navigablesThatNeedBeforeUnload, given an optional
traversable navigable traversable, an optional integer
- targetStep, and an optional user navigation involvement
- userInvolvement:
+ targetStep, and an optional user navigation involvement-or-null
+ userInvolvementForNavigateEvent:
Let documentsToFireBeforeunload be the active
@@ -94847,8 +94837,8 @@ location.href = '#foo';
If traversable was given, then:
- Assert: targetStep and userInvolvement were
- given.
+ Assert: targetStep and
+ userInvolvementForNavigateEvent were given.
Let targetEntry be the result of getting the target history
entry given traversable and targetStep.
@@ -94866,7 +94856,8 @@ location.href = '#foo';
In this case, we're going to fire the navigate event
for traversable here. Because under some circumstances it might be
- canceled, we need to do this separately from other traversal other traversal navigate events , which happen later.
Additionally, because we want beforeunload
@@ -94877,6 +94868,8 @@ location.href = '#foo';
+ Assert: userInvolvementForNavigateEvent is not null.
+
Let eventsFired be false.
Let needsBeforeunload be true if navigablesThatNeedBeforeUnload
@@ -94920,7 +94913,7 @@ location.href = '#foo';
Let navigateEventResult be the result of firing a traverse navigate
event at a Navigation navigation given
- targetEntry and userInvolvement.
+ targetEntry and userInvolvementForNavigateEvent.
If navigateEventResult is false, then set unloadCanceled to
true.
@@ -95046,7 +95039,7 @@ location.href = '#foo';
Each navigable has an ongoing navigation,
which is a navigation ID, "traversal ", or null, initially
null. It is used to track navigation aborting and to prevent any navigations from taking place
- during traversal.
+ during traversal.
To set the ongoing navigation for a navigable navigable to
newValue:
@@ -95118,16 +95111,7 @@ location.href = '#foo';
history traversal steps to traversable:
- -
-
Apply pending history changes to traversable with true.
-
- It is intentional that the resulting call to apply the history
- step does not pass sourceSnapshotParams or initiatorToCheck. Reloading is always treated as if
- it were done by navigable itself, even in cases like parent.location.reload() .
-
+ Apply the reload history step to traversable.
@@ -95174,12 +95158,9 @@ location.href = '#foo';
If allSteps[targetStepIndex] does not exist, then abort these steps.
- Apply the history step allSteps[targetStepIndex] to
- traversable, with checkForCancelation set
- to true, sourceSnapshotParams set to
- sourceSnapshotParams, initiatorToCheck
- set to initiatorToCheck, and userInvolvement set to
+ Apply the traverse history step
+ allSteps[targetStepIndex] to traversable, given
+ sourceSnapshotParams, initiatorToCheck, and
userInvolvement.
@@ -96438,22 +96419,79 @@ location.href = '#foo';
A boolean
- To apply the history step
- non-negative integer step to a traversable navigable
- traversable, with optional boolean checkForCancelation (default false),
- optional source snapshot params-or-null sourceSnapshotParams (default null),
- optional navigable initiatorToCheck, and optional user
- navigation involvement userInvolvement (default "none "):
+
+
+ Although all updates to the traversable navigable end up in the same apply
+ the history step algorithm, each possible entry point comes along with some minor
+ customizations:
+
+ To update for navigable creation/destruction given a traversable
+ navigable traversable:
+
+
+ Let step be traversable's current session history step.
+
+ Return the result of applying the history
+ step step to traversable given false, false, null, null, and
+ null.
+
+
+ To apply the push/replace history step given a non-negative integer step
+ to a traversable navigable traversable:
+
+
+ Return the result of applying the history
+ step step to traversable given false, false, null, null, and
+ null.
+
+
+ Apply the push/replace history step never passes source
+ snapshot params or an initiator navigable to apply the history
+ step. This is because those checks are done earlier in the navigation algorithm.
+
+ To apply the reload history step given a non-negative integer step to a
+ traversable navigable traversable:
+
+
+ Let step be traversable's current session history step.
+
+ Return the result of applying the history
+ step step to traversable given true, false, null, null, and
+ null.
+
+
+ Apply the reload history step never passes source snapshot
+ params or an initiator navigable to apply the history step. This
+ is because reloading is always treated as if it were done by the navigable itself,
+ even in cases like parent.location.reload() .
+
+
- sourceSnapshotParams and initiatorToCheck are always either
- both given or both not given. They are usually not given, as most callers do not need the extra
- checks on the navigation initiator that they cause. (Possibly because the caller has already
- performed such checks themselves.)
+ Now for the algorithm itself.
+
+ To apply the traverse history step given a non-negative integer step to
+ a traversable navigable traversable, with source snapshot
+ params sourceSnapshotParams, navigable
+ initiatorToCheck, and user navigation involvement
+ userInvolvement:
+
+
+ Return the result of applying the history
+ step step to traversable given true, true,
+ sourceSnapshotParams, initiatorToCheck, and
+ userInvolvement.
+
+
+ To apply the history step given a
+ non-negative integer step to a traversable navigable
+ traversable, with booleans checkForCancelation and
+ fireNavigateEventOnCommit, source snapshot params-or-null
+ sourceSnapshotParams, navigable-or-null initiatorToCheck, and
+ user navigation involvement-or-null
+ userInvolvementForNavigateEvents:
Assert: This is running within traversable's
traversable and step.
-
-
If initiatorToCheck is given, then:
+ If initiatorToCheck is not null, then:
Assert: sourceSnapshotParams is not null.
@@ -96479,16 +96517,10 @@ location.href = '#foo';
that might experience a cross-document traversal given traversable and
targetStep.
- -
-
If checkForCancelation is true, and the result of checking if unloading is
- canceled given navigablesCrossingDocuments, traversable,
- targetStep, and userInvolvement is true, then return.
-
- Some algorithms check if
- unloading is canceled as a prerequisite to modifying the history tree. Those
- algorithms will set checkForCancelation to false when calling this algorithm to
- avoid performing the check twice.
-
+ If checkForCancelation is true, and the result of checking if unloading
+ is canceled given navigablesCrossingDocuments, traversable,
+ targetStep, and userInvolvementForNavigateEvents is true, then
+ return.
Let changingNavigables be the result of get all navigables whose current
session history entry will change or reload given traversable and
@@ -96842,20 +96874,32 @@ location.href = '#foo';
- If targetEntry's document is not equal
- to displayedDocument, then queue a global task on the
- navigation and traversal task source given targetEntry's document's relevant global object to perform the
- following step. Otherwise, continue onward to perform the following step within the
- currently-queued task.
-
- Update document for history step application given
- targetEntry's document,
- targetEntry, changingNavigableContinuation's Let updateDocument be an algorithm step which performs update
+ document for history step application given targetEntry's document, targetEntry,
+ changingNavigableContinuation's update-only,
scriptHistoryLength, scriptHistoryIndex, and
entriesForNavigationAPI.
+
+ If targetEntry's document is equal to
+ displayedDocument, then:
+
+
+ Fire a traverse navigate event given targetEntry and
+ userInvolvementForNavigateEvents.
+
+ Perform updateDocument.
+
+
+
+ Otherwise, queue a global task on the navigation and traversal
+ task source given targetEntry's document's relevant global object to perform
+ updateDocument.
+
Increment completedChangeJobs.
@@ -104503,7 +104547,7 @@ import "https://example.com/foo/../module2.mjs";
This task source is used to queue tasks involved in navigation and history
+ data-x="navigate">navigation and history
traversal.
From a6f49ea170397fc556b30a575bea6bd763d729c5 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 16:41:21 +0900
Subject: [PATCH 12/30] Final plumbing; also fix check on traverse navigate
events
---
source | 100 +++++++++++++++++++++++++++++++++++----------------------
1 file changed, 61 insertions(+), 39 deletions(-)
diff --git a/source b/source
index b219058ca6e..e94c6737a63 100644
--- a/source
+++ b/source
@@ -86886,8 +86886,8 @@ interface BarProp {
The toolbar BarProp object
Historically represented the user interface element found immediately above or before the
document, as appropriate for the user's media, which typically provides session history traversal controls (back and forward buttons, reload
- buttons, etc.).
+ traverse history step">session history traversal controls (back and forward buttons,
+ reload buttons, etc.).
The locationbar
@@ -89531,11 +89531,19 @@ interface NavigationHistoryEntry : EventTarget
This can occur if a previously queued traversal already took us to this session history entry. In that case the previous traversal will have dealt with apiMethodTracker already.
- Let result be the result of applying the traverse history step given by targetSHE's step to traversable, given sourceSnapshotParams, navigable, and "none ". TODO actually change apply the history step to have a useful return value.
+ Let result be the result of applying the traverse history step given by targetSHE's step to traversable, given sourceSnapshotParams, navigable, and "none ".
- If result is "canceled ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to finalize with an aborted navigation error given navigation and apiMethodTracker.
+ If result is "canceled-by-beforeunload ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to reject the finished promise for apiMethodTracker with a new "AbortError " DOMException created in navigation's relevant realm.
- If result is "initiator-disallowed ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to finalize with an aborted navigation error given navigation, apiMethodTracker, and a new "SecurityError " DOMException created in navigation's relevant realm.
+
+ If result is "initiator-disallowed ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to reject the finished promise for apiMethodTracker with a new "SecurityError " DOMException created in navigation's relevant realm.
+
+
+ When result is "canceled-by-beforeunload " or "initiator-disallowed ", the navigate event was never fired, finalizing with an aborted navigation error would not be correct; it would result in a navigateerror event without a preceding navigate event.
+
+ In the "canceled-by-navigate " case, navigate is fired, but the inner navigate event firing algorithm will take care of finalizing with an aborted navigation error.
+
+
@@ -90487,9 +90495,13 @@ interface NavigationDestination {
-
-
If navigationType is not "traverse " and event's signal is not aborted, then finalize with an aborted navigation error given navigation and apiMethodTracker.
+ If event's signal is not aborted:
- If navigationType is "traverse ", then we will instead finalize with an aborted navigation error in perform a navigation API traversal. TODO this doesn't seem right; what about history.back()?? Probably the finalize needs to move to "apply the history step"?
+
+ If navigationType is "traverse ", then consume history-action user activation.
+
+ Finalize with an aborted navigation error given navigation and apiMethodTracker.
+
Return false.
@@ -90999,8 +91011,8 @@ interface BeforeUnloadEvent : Event {
data-x="nav-active-history-entry">active session history entry to temporarily step ahead
of the current session history entry.
- A non-displayable, non-error response is received during history traversal. This updates the A non-displayable, non-error response is received when applying the history step. This updates the current session history entry but leaves the active session history entry as-is.
@@ -94822,7 +94834,9 @@ location.href = '#foo';
data-x="navigable">navigables navigablesThatNeedBeforeUnload, given an optional
traversable navigable traversable, an optional integer
targetStep, and an optional user navigation involvement-or-null
- userInvolvementForNavigateEvent:
+ userInvolvementForNavigateEvent, run these steps. They return "canceled-by-beforeunload ", "canceled-by-navigate ", or
+ "continue ".
Let documentsToFireBeforeunload be the active
@@ -94831,7 +94845,7 @@ location.href = '#foo';
Let unloadPromptShown be false.
- Let unloadCanceled be false.
+ Let finalStatus be "continue ".
-
If traversable was given, then:
@@ -94849,7 +94863,7 @@ location.href = '#foo';
targetEntry's document state's origin is the same as
traversable's current session history
- entry document state's 's document state's origin, then:
@@ -94900,11 +94914,12 @@ location.href = '#foo';
unloadPromptShown to true.
If unloadPromptCanceledByThisDocument is true, then set
- unloadCanceled to true.
+ finalStatus to " canceled-by-beforeunload ".
- If unloadCanceled is true, then abort these steps.
+ If finalStatus is "canceled-by-beforeunload ",
+ then abort these steps.
Let navigation be traversable's active window's navigation
@@ -94915,8 +94930,8 @@ location.href = '#foo';
event at a Navigation navigation given
targetEntry and userInvolvementForNavigateEvent.
- If navigateEventResult is false, then set unloadCanceled to
- true.
+ If navigateEventResult is false, then set finalStatus to
+ "canceled-by-navigate ".
Set eventsFired to true.
@@ -94924,7 +94939,8 @@ location.href = '#foo';
Wait until eventsFired is true.
- If unloadCanceled is true, then return true.
+ If finalStatus is not "continue ", then return
+ finalStatus.
@@ -94950,7 +94966,7 @@ location.href = '#foo';
unloadPromptShown to true.
If unloadPromptCanceledByThisDocument is true, then set
- unloadCanceled to true.
+ finalStatus to " canceled-by-beforeunload ".
Increment completedTasks.
@@ -94958,7 +94974,7 @@ location.href = '#foo';
Wait for completedTasks to be totalTasks.
- Return unloadCanceled.
+ Return finalStatus.
The steps to fire beforeunload given a
@@ -96434,7 +96450,7 @@ location.href = '#foo';
Return the result of applying the history
step step to traversable given false, false, null, null, and
- null.
+ null.
To apply the push/replace history step given a non-negative integer step
@@ -96443,7 +96459,7 @@ location.href = '#foo';
Return the result of applying the history
step step to traversable given false, false, null, null, and
- null.
+ null.
Apply the push/replace history step never passes source
@@ -96460,7 +96476,7 @@ location.href = '#foo';
Return the result of applying the history
step step to traversable given true, false, null, null, and
- null.
+ null.
Apply the reload history step never passes source snapshot
@@ -96476,13 +96492,15 @@ location.href = '#foo';
a traversable navigable traversable, with source snapshot
params sourceSnapshotParams, navigable
initiatorToCheck, and user navigation involvement
- userInvolvement:
+ userInvolvement, perform the following steps. They return either " initiator-disallowed ", " canceled-by-beforeunload ", " canceled-by-navigate ", or " applied ".
Return the result of applying the history
step step to traversable given true, true,
sourceSnapshotParams, initiatorToCheck, and
- userInvolvement.
+ userInvolvement.
To apply the history step given a
@@ -96509,7 +96527,8 @@ location.href = '#foo';
For each navigable of get all
navigables whose current session history entry will change or reload: if
initiatorToCheck is not allowed by sandboxing to navigate
- navigable given sourceSnapshotParams, then return.
+ navigable given sourceSnapshotParams, then return
+ " initiator-disallowed ".
@@ -96519,8 +96538,8 @@ location.href = '#foo';
If checkForCancelation is true, and the result of checking if unloading
is canceled given navigablesCrossingDocuments, traversable,
- targetStep, and userInvolvementForNavigateEvents is true, then
- return.
+ targetStep, and userInvolvementForNavigateEvents is not " continue ", then return that result.
Let changingNavigables be the result of get all navigables whose current
session history entry will change or reload given traversable and
@@ -96874,6 +96893,17 @@ location.href = '#foo';
+ If navigable is not traversable, and targetEntry is not
+ navigable's current session history
+ entry, and targetEntry's document
+ state's origin is the same as navigable's current session history entry's document state's origin, then fire a traverse navigate event given targetEntry and
+ userInvolvementForNavigateEvents.
+
Let updateDocument be an algorithm step which performs update
document for history step application given targetEntry's document, targetEntry,
@@ -96882,18 +96912,8 @@ location.href = '#foo';
scriptHistoryLength, scriptHistoryIndex, and
entriesForNavigationAPI.
- -
-
If targetEntry's document is equal to
- displayedDocument, then:
-
-
- Fire a traverse navigate event given targetEntry and
- userInvolvementForNavigateEvents.
-
- Perform updateDocument.
-
-
+ If targetEntry's document is equal to
+ displayedDocument, then perform updateDocument.
Otherwise, queue a global task on the navigation and traversal
task source given targetEntry's
Set traversable's current
session history step to targetStep.
+
+ Return "applied ".
To activate history entry session history entry entry for
From ee954bf1afd1c85f25ee144aed6ec4078fb60b9a Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 17:01:00 +0900
Subject: [PATCH 13/30] Rewrap using specfmt
---
source | 2542 ++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 1837 insertions(+), 705 deletions(-)
diff --git a/source b/source
index e94c6737a63..7dac64d811f 100644
--- a/source
+++ b/source
@@ -24261,8 +24261,8 @@ document.body.appendChild(wbr);
If element has a download
attribute, or if the user has expressed a preference to download the hyperlink, then download the hyperlink created by element with
- hyperlinkSuffix set to hyperlinkSuffix
- and userInvolvement set to
+ hyperlinkSuffix set to hyperlinkSuffix and
+ userInvolvement set to
userInvolvement.
Otherwise, follow the hyperlink created by
@@ -24879,8 +24879,8 @@ document.body.appendChild(wbr);
Unlike many other types of navigations, following hyperlinks does not have
special "replace " behavior for when
- documents are not completely loaded. This is true for both user-initiated
- instances of following hyperlinks, as well as script-triggered ones via, e.g., completely loaded . This is true for both user-initiated instances
+ of following hyperlinks, as well as script-triggered ones via, e.g., aElement.click() .
@@ -24923,9 +24923,9 @@ document.body.appendChild(wbr);
If subject cannot navigate, then return.
- If subject's node document's
- active sandboxing flag set has the sandboxed downloads browsing context
- flag set, then return.
+ If subject's node document's active
+ sandboxing flag set has the sandboxed downloads browsing context flag set,
+ then return.
Parse a URL given subject's href attribute, relative to subject's node
@@ -24953,11 +24953,10 @@ document.body.appendChild(wbr);
Let continue be the result of firing a download request navigate event at
- navigation with destinationURL set to url, userInvolvement set to
- userInvolvement, and filename set
- to filename.
+ navigation with destinationURL
+ set to url, userInvolvement
+ set to userInvolvement, and filename
+ set to filename.
If continue is false, then return.
@@ -40858,8 +40857,8 @@ interface HTMLAreaElement : HTMLElement {
- When user agents allow users to follow hyperlinks
- or download hyperlinks created using the
+ When user agents allow users to follow hyperlinks or
+ download hyperlinks created using the
area element, the href , target , download , and
Submit the form element from the
- form element itself with userInvolvement
- set to "activation ".
+ form element itself with userInvolvement set
+ to "activation ".
For the purpose of the previous paragraph, an element is a field that blocks implicit
@@ -58558,12 +58557,12 @@ fur
defining this, act in a manner analogous to that defined in this specification for similar
schemes.
- Each form element has a planned navigation, which is either null or
- a task; when the form is first created, its
+ Each form element has a planned navigation, which is either null or a
+ task; when the form is first created, its
planned navigation must be set to null. In the behaviors described below, when the
- user agent is required to plan to navigate to a URL url
- given an optional POST resource-or-null postResource (default null), it
- must run the following steps:
+ user agent is required to plan to navigate to a URL url given
+ an optional POST resource-or-null postResource (default null), it must
+ run the following steps:
Let referrerPolicy be the empty string.
@@ -76766,17 +76765,17 @@ END:VCARD
- History-action activation
-
When the last history-action activation timestamp of W is not equal
- to the last activation timestamp of W, then W is said to
- have history-action activation.
+ to the last activation timestamp of W, then W is said to have
+ history-action activation.
- This is a special variant of user activation, used to allow access to certain session
- history APIs which, if used too frequently, would make it harder for the user to traverse back
- using browser UI. It starts with a false value, and becomes
- true whenever the user interacts with W, but is reset to false through history-action activation consumption.
- This ensures such APIs cannot be used multiple times in a row without an intervening user
- activation. But unlike transient activation, there is no time limit within which
- such APIs must be used.
+ This is a special variant of user activation, used to allow access to certain session history
+ APIs which, if used too frequently, would make it harder for the user to traverse back using browser UI. It starts with a false value, and becomes true whenever
+ the user interacts with W, but is reset to false through history-action activation consumption. This ensures such
+ APIs cannot be used multiple times in a row without an intervening user activation. But unlike
+ transient activation, there is no time limit within which such APIs must be
+ used.
@@ -76899,10 +76898,11 @@ END:VCARD
These APIs require the sticky activation state to be true, so they are
blocked until the very first user activation.
- - Transient activation-gated APIs
-
-
These APIs require the transient activation state to be true, but they don't
- consume it, so multiple calls are allowed per user
- activation until the transient state expires.
+ - Transient activation-gated APIs
-
These APIs require the transient
+ activation state to be true, but they don't consume it, so multiple calls are allowed per user activation until the
+ transient state expires.
- Transient activation-consuming APIs
These APIs require the transient activation state to be true, and they
@@ -88416,8 +88416,8 @@ interface History {
navigable.
Traverse the history by a delta given document's node
- navigable's traversable navigable,
- delta, and with sourceDocument set to
+ navigable's traversable navigable, delta,
+ and with sourceDocument set to
document.
@@ -88473,12 +88473,12 @@ interface History {
Let navigation be history's relevant global object's
navigation API.
- Let continue be the result of firing a push/replace/reload navigate
- event at navigation with navigationType set to historyHandling,
- isSameDocument set to true, destinationURL set to newURL, and Let continue be the result of firing a push/replace/reload navigate event at
+ navigation with navigationType set to
+ historyHandling, isSameDocument set
+ to true, destinationURL set to
+ newURL, and classicHistoryAPIState set to
serializedData.
@@ -88707,8 +88707,8 @@ interface History {
The navigation API, provided by the global navigation
object, provides a modern and web application-focused way of managing same-origin
- same-navigable history entries and navigations. Its entry point is
- the Navigation interface:
+ same- navigable history entries and navigations. Its entry point is the
+ Navigation interface:
[Exposed=Window]
interface Navigation : EventTarget {
@@ -88763,9 +88763,15 @@ enum NavigationHistoryBehavior {
- Each Window has an associated navigation API, which is a Navigation object. Upon creation of the Window object, its navigation API must be set to a new Navigation object created in the Window object's relevant realm.
+ Each Window has an associated navigation
+ API, which is a Navigation object. Upon creation of the Window
+ object, its navigation API must be set to a
+ new Navigation object created in the Window object's relevant realm.
- The navigation getter steps are to return this's navigation API.
+ The navigation getter
+ steps are to return this's navigation
+ API.
@@ -88798,44 +88804,61 @@ enum NavigationHistoryBehavior {
- Each Navigation has an associated entry list, a list of NavigationHistoryEntry objects, initially empty.
+ Each Navigation has an associated entry
+ list, a list of NavigationHistoryEntry objects, initially
+ empty.
- Each Navigation has an associated current entry index, an integer, initially −1.
+ Each Navigation has an associated current entry index, an integer, initially
+ −1.
- The current entry of a Navigation navigation is the result of running the following steps:
+ The current entry of a Navigation
+ navigation is the result of running the following steps:
- If navigation has entries and events disabled, then return null.
+ If navigation has entries and events disabled, then return
+ null.
- Assert: navigation's current entry index is not −1.
+ Assert: navigation's current entry index is not −1.
- Return navigation's entry list[navigation's current entry index].
+ Return navigation's entry
+ list[navigation's current entry
+ index].
- A Navigation navigation has entries and events disabled if the following steps return true:
+ A Navigation navigation has entries and events disabled if
+ the following steps return true:
- Let document be navigation's relevant global object's associated Document .
+ Let document be navigation's relevant global object's
+ associated Document .
If document is not fully active, then return true.
- If document's is initial about:blank is true, then return true.
+ If document's is initial about:blank is true, then
+ return true.
- If document's origin is opaque, then return true.
+ If document's origin is opaque, then return true.
Return false.
- To get the navigation API entry index of a session history entry she within a Navigation navigation:
+ To get the navigation API entry
+ index of a session history entry she within a
+ Navigation navigation:
Let index be 0.
-
-
For each nhe of navigation's entry list:
+ For each nhe of navigation's entry list:
- If nhe's session history entry is equal to she, then return index.
+ If nhe's session history entry is equal to
+ she, then return index.
Increment index by 1.
@@ -88848,7 +88871,8 @@ enum NavigationHistoryBehavior {
- A key type used throughout the navigation API is the NavigationType enumeration:
+ A key type used throughout the navigation API is the NavigationType
+ enumeration:
enum NavigationType {
"push",
@@ -88857,14 +88881,20 @@ enum NavigationHistoryBehavior {
"traverse"
};
- This captures the main web developer-visible types of "navigations", which (as noted elsewhere) do not exactly correspond to this standard's singular navigate algorithm. The meaning of each value is the following:
+ This captures the main web developer-visible types of "navigations", which (as noted elsewhere) do not exactly correspond to this standard's
+ singular navigate algorithm. The meaning of each value is the following:
- "
push "
- - Corresponds to calls to navigate where the history handling behavior ends up as "
push ", or to history.pushState() .
+ - Corresponds to calls to navigate where the history handling
+ behavior ends up as "
push ", or to
+ history.pushState() .
- "
replace "
- - Corresponds to calls to navigate where the history handling behavior ends up as "
replace ", or to history.replaceState() .
+ - Corresponds to calls to navigate where the history handling
+ behavior ends up as "
replace ", or
+ to history.replaceState() .
- "
reload "
- Corresponds to calls to reload.
@@ -88875,43 +88905,63 @@ enum NavigationHistoryBehavior {
- The value space of the NavigationType enumeration is a superset of the value space of the specification-internal history handling behavior type. Several parts of this standard make use of this overlap, by passing in a history handling behavior to an algorithm that expects a NavigationType .
+ The value space of the NavigationType enumeration is a superset of
+ the value space of the specification-internal history handling behavior type. Several
+ parts of this standard make use of this overlap, by passing in a history handling
+ behavior to an algorithm that expects a NavigationType .
Initializing and updating the entry list
- To initialize the entries for a new Navigation given a Navigation navigation, a list of session history entries newSHEs, and a session history entry initialSHE:
+ To initialize the entries for a new Navigation given a
+ Navigation navigation, a list of session history entries newSHEs, and a session history
+ entry initialSHE:
- Assert: navigation's entry list is empty.
+ Assert: navigation's entry
+ list is empty.
- Assert: navigation's current entry index is −1.
+ Assert: navigation's current entry index is −1.
- If navigation has entries and events disabled, then return.
+ If navigation has entries and events disabled, then
+ return.
-
For each newSHE of newSHEs:
- Let newNHE be a new NavigationHistoryEntry created in the relevant realm of navigation.
+ Let newNHE be a new NavigationHistoryEntry created
+ in the relevant realm of
+ navigation.
- Set newNHE's session history entry to newSHE.
+ Set newNHE's session history entry to
+ newSHE.
- Append newNHE to navigation's entry list.
+ Append newNHE to navigation's
+ entry list.
- Set navigation's current entry index to the result of getting the navigation API entry index of initialSHE within navigation.
+ Set navigation's current entry
+ index to the result of getting the navigation API entry index of
+ initialSHE within navigation.
- To update the entries for reactivation given a Navigation navigation, a list of session history entries newSHEs, and a session history entry reactivatedSHE:
+ To update the entries for reactivation given a Navigation
+ navigation, a list of session history
+ entries newSHEs, and a session history entry
+ reactivatedSHE:
- If navigation has entries and events disabled, then return.
+ If navigation has entries and events disabled, then
+ return.
Let newNHEs be a new empty list.
- Let oldNHEs be a clone of navigation's entry list.
+ Let oldNHEs be a clone of
+ navigation's entry list.
-
For each newSHE of newSHEs:
@@ -88920,12 +88970,15 @@ enum NavigationHistoryBehavior {
Let newNHE be null.
-
-
If oldNHEs contains a NavigationHistoryEntry matchingOldNHE whose session history entry is newSHE, then:
+ If oldNHEs contains a
+ NavigationHistoryEntry matchingOldNHE whose session history entry is newSHE, then:
Set newNHE to matchingOldNHE.
- Remove matchingOldNHE from oldNHEs.
+ Remove matchingOldNHE from
+ oldNHEs.
@@ -88933,129 +88986,193 @@ enum NavigationHistoryBehavior {
Otherwise:
- Set newNHE to a new NavigationHistoryEntry created in the relevant realm of navigation.
+ Set newNHE to a new NavigationHistoryEntry
+ created in the relevant realm of
+ navigation.
- Set newNHE's session history entry to newSHE.
+ Set newNHE's session history entry to
+ newSHE.
- Append newNHE to newNHEs.
+ Append newNHE to
+ newNHEs.
- By the end of this loop, all NavigationHistoryEntry s that remain in oldNHEs represent session history entries which have been disposed while the Document was in bfcache.
+ By the end of this loop, all NavigationHistoryEntry s that remain in
+ oldNHEs represent session history entries
+ which have been disposed while the Document was in bfcache.
Set navigation's entry list to newNHEs.
- Set navigation's current entry index to the result of getting the navigation API entry index of reactivatedSHE within navigation.
+ Set navigation's current entry
+ index to the result of getting the navigation API entry index of
+ reactivatedSHE within navigation.
-
-
Queue a global task on the navigation and traversal task source given navigation's relevant global object to run the following steps:
+ Queue a global task on the navigation and traversal task source
+ given navigation's relevant global object to run the following
+ steps:
-
-
For each disposedNHE of oldNHEs:
+ For each disposedNHE of
+ oldNHEs:
- Fire an event named dispose at disposedNHE.
+ Fire an event named dispose at disposedNHE.
- We delay these steps by a task to ensure that dispose events will fire after the pageshow event. This ensures that pageshow is the first event a page receives upon reactivation.
-
- (However, the rest of this algorithm runs before the pageshow event fires. This ensures that navigation.entries() and navigation.currentEntry will have correctly-updated values during any pageshow event handlers.)
+ We delay these steps by a task to ensure that dispose
+ events will fire after the pageshow event. This ensures
+ that pageshow is the first event a page receives upon
+ reactivation.
+
+ (However, the rest of this algorithm runs before the pageshow event fires. This ensures that navigation.entries() and navigation.currentEntry will have correctly-updated
+ values during any pageshow event handlers.)
- To update the entries for a same-document navigation given a Navigation navigation, a session history entry destinationSHE, and a NavigationType navigationType:
+ To update the entries for a same-document navigation given a Navigation
+ navigation, a session history entry destinationSHE, and a
+ NavigationType navigationType:
- If navigation has entries and events disabled, then return.
+ If navigation has entries and events disabled, then
+ return.
- Let oldCurrentNHE be the current entry of navigation.
+ Let oldCurrentNHE be the current
+ entry of navigation.
Let disposedNHEs be a new empty list.
-
-
If navigationType is "traverse ", then:
+ If navigationType is "traverse ",
+ then:
- Set navigation's current entry index to the result of getting the navigation API entry index of destinationSHE within navigation.
+ Set navigation's current entry
+ index to the result of getting the navigation API entry index of
+ destinationSHE within navigation.
- Assert: navigation's current entry index is not −1.
+ Assert: navigation's current entry index is not −1.
- This algorithm is only called for same-document traversals. Cross-document traversals will instead call either initialize the entries for a new Navigation or update the entries for reactivation.
+ This algorithm is only called for same-document traversals. Cross-document
+ traversals will instead call either initialize the entries for a new
+ Navigation or update the entries for reactivation.
-
-
Otherwise, if navigationType is "push ", then:
+ Otherwise, if navigationType is "push ", then:
- Set navigation's current entry index to navigation's current entry index + 1.
+ Set navigation's current entry
+ index to navigation's current
+ entry index + 1.
- Let i be navigation's current entry index.
+ Let i be navigation's current entry index.
-
-
While i < navigation's entry list's size:
+ While i < navigation's entry list's size:
- Append navigation's entry list[i] to disposedNHEs.
+ Append navigation's entry list[i] to
+ disposedNHEs.
Set i to i + 1.
- Remove all items in disposedNHEs from navigation's entry list.
+ Remove all items in disposedNHEs from
+ navigation's entry list.
-
-
Otherwise, if navigationType is "replace ", then:
+ Otherwise, if navigationType is "replace ", then:
- Append oldCurrentNHE to disposedNHEs.
+ Append oldCurrentNHE to
+ disposedNHEs.
-
-
If navigationType is "push " or "replace ", then:
+ If navigationType is "push " or
+ "replace ", then:
- Let newNHE be a new NavigationHistoryEntry created in the relevant realm of navigation.
+ Let newNHE be a new NavigationHistoryEntry created
+ in the relevant realm of
+ navigation.
- Set newNHE's session history entry to destinationSHE.
+ Set newNHE's session history entry to
+ destinationSHE.
- Set navigation's entry list[navigation's current entry index] to newNHE.
+ Set navigation's entry
+ list[navigation's current entry
+ index] to newNHE.
-
-
If navigation's ongoing API method tracker is non-null, then notify about the committed-to entry given navigation's ongoing API method tracker and the current entry of navigation.
+ If navigation's ongoing API method tracker is non-null, then
+ notify about the committed-to entry given navigation's ongoing API
+ method tracker and the current entry of
+ navigation.
- It is important to do this before firing the dispose or currententrychange events, since event handlers could start another navigation, or otherwise change the value of navigation's ongoing API method tracker.
+ It is important to do this before firing the dispose or currententrychange events, since event handlers could
+ start another navigation, or otherwise change the value of navigation's ongoing
+ API method tracker.
-
-
Prepare to run script given navigation's relevant settings object.
+ Prepare to run script given navigation's relevant settings
+ object.
- See the discussion for other navigation API events to understand why we do this.
+ See the discussion
+ for other navigation API events to understand why we do this.
- Fire an event named currententrychange at navigation using NavigationCurrentEntryChangeEvent , with its navigationType attribute initialized to navigationType and its from initialized to oldCurrentNHE.
+ Fire an event named currententrychange at navigation using
+ NavigationCurrentEntryChangeEvent , with its navigationType attribute
+ initialized to navigationType and its from initialized to
+ oldCurrentNHE.
-
-
For each disposedNHE of disposedNHEs:
+ For each disposedNHE of
+ disposedNHEs:
- Fire an event named dispose at disposedNHE.
+ Fire an event named dispose at disposedNHE.
- Clean up after running script given navigation's relevant settings object.
+ Clean up after running script given navigation's relevant
+ settings object.
@@ -89081,100 +89198,157 @@ interface NavigationHistoryEntry : EventTarget
-
The URL of this navigation history entry.
- This can return null if the entry corresponds to a different Document than the current one (i.e., if sameDocument is false), and that Document was fetched with a referrer policy of "no-referrer " or "origin ", since that indicates the Document in question is hiding its URL even from other same-origin pages.
+ This can return null if the entry corresponds to a different Document than the
+ current one (i.e., if sameDocument
+ is false), and that Document was fetched with a referrer policy of
+ "no-referrer " or "origin ", since that indicates
+ the Document in question is hiding its URL even from other same-origin pages.
entry.key
-
-
A user agent-generated random UUID string representing this navigation history entry's place in the navigation history list. This value will be reused by other NavigationHistoryEntry instances that replace this one due to "replace " navigations, and will survive reloads and session restores.
+ A user agent-generated random UUID string representing this navigation history entry's place
+ in the navigation history list. This value will be reused by other
+ NavigationHistoryEntry instances that replace this one due to "replace " navigations, and will survive reloads and
+ session restores.
- This is useful for navigating back to this entry in the navigation hisotyr list, using navigation.traverseTo(key) .
+ This is useful for navigating back to this entry in the navigation hisotyr list, using navigation.traverseTo(key) .
entry.id
-
-
A user agent-generated random UUID string representing this specific navigation history entry. This value will not be reused by other NavigationHistoryEntry instances. This value will survive reloads and session restores.
+ A user agent-generated random UUID string representing this specific navigation history
+ entry. This value will not be reused by other NavigationHistoryEntry
+ instances. This value will survive reloads and session restores.
- This is useful for associating data with this navigation history entry using other storage APIs.
+ This is useful for associating data with this navigation history entry using other storage
+ APIs.
entry.index
- The index of this NavigationHistoryEntry within navigation.entries() , or −1 if the entry is not in the navigation history entry list.
+ The index of this NavigationHistoryEntry within navigation.entries() , or −1 if the entry is not in
+ the navigation history entry list.
entry.sameDocument
- Indicates whether or not this navigation history entry is for the same Document as the current one, or not. This will be true, for example, when the entry represents a fragment navigation or single-page app navigation.
+ Indicates whether or not this navigation history entry is for the same
+ Document as the current one, or not. This will be true, for example, when the entry
+ represents a fragment navigation or single-page app navigation.
entry.getState()
-
-
Returns the deserialization of the state stored in this entry, which was added to the entry using navigation.navigate() or navigation.updateCurrentEntry() . This state survives reloads and session restores.
+ Returns the deserialization of the state stored
+ in this entry, which was added to the entry using navigation.navigate() or navigation.updateCurrentEntry() . This state
+ survives reloads and session restores.
- Note that in general, unless the state value is a primitive, entry.getState() !== entry.getState() , since a fresh deserialization is returned each time.
+ Note that in general, unless the state value is a primitive, entry.getState() !== entry.getState() , since a fresh deserialization is
+ returned each time.
- This state is unrelated to the classic history API's history.state .
+ This state is unrelated to the classic history API's history.state .
- Each NavigationHistoryEntry has an associated session history entry, which is a session history entry.
+ Each NavigationHistoryEntry has an associated session
+ history entry, which is a session history entry.
- The url getter steps are:
+ The url getter steps are:
- Let document be this's relevant global object's associated Document .
+ Let document be this's relevant global object's associated Document .
- If document is not fully active, then return the empty string.
+ If document is not fully active, then return the empty
+ string.
- Let she be this's session history entry.
+ Let she be this's session history
+ entry.
- If she's document does not equal document, and she's document state's request referrer policy is "no-referrer " or "origin ", then return null.
+ If she's document does not equal
+ document, and she's document
+ state's request referrer
+ policy is "no-referrer " or "origin ", then
+ return null.
- Return she's URL, serialized.
+ Return she's URL, serialized.
- The key getter steps are:
+ The key getter steps are:
- If this's relevant global object's associated Document is not fully active, then return the empty string.
+ If this's relevant global object's associated Document is not fully
+ active, then return the empty string.
- Return this's session history entry's navigation API key.
+ Return this's session history entry's navigation API key.
- The id getter steps are:
+ The id getter steps are:
- If this's relevant global object's associated Document is not fully active, then return the empty string.
+ If this's relevant global object's associated Document is not fully
+ active, then return the empty string.
- Return this's session history entry's navigation API ID.
+ Return this's session history entry's navigation API ID.
- The index getter steps are:
+ The index getter steps are:
- If this's relevant global object's associated Document is not fully active, then return the empty string.
+ If this's relevant global object's associated Document is not fully
+ active, then return the empty string.
- Return the result of getting the navigation API entry index of this's session history entry within this's relevant global object's navigation API.
+ Return the result of getting the navigation API entry index of
+ this's session history entry within
+ this's relevant global object's navigation API.
- The sameDocument getter steps are:
+ The sameDocument getter steps are:
- Let document be this's relevant global object's associated Document .
+ Let document be this's relevant global object's associated Document .
If document is not fully active, then return false.
- Return true if this's session history entry's document equals document, and false otherwise.
+ Return true if this's session history entry's
+ document equals document, and false
+ otherwise.
- The getState() method steps are:
+ The getState() method steps are:
- If this's relevant global object's associated Document is not fully active, then return undefined.
+ If this's relevant global object's associated Document is not fully
+ active, then return undefined.
-
-
Return StructuredDeserialize(this's session history entry's navigation API state). Rethrow any exceptions.
+ Return StructuredDeserialize(this's session
+ history entry's navigation API state).
+ Rethrow any exceptions.
- This can in theory throw an exception, if attempting to deserialize a large ArrayBuffer when not enough memory is available.
+ This can in theory throw an exception, if attempting to deserialize a large
+ ArrayBuffer when not enough memory is available.
@@ -89201,75 +89375,130 @@ interface NavigationHistoryEntry : EventTarget
entries = navigation.entries()
- Returns an array of NavigationHistoryEntry instances represent the current navigation history entry list, i.e., all session history entries for this navigable that are same origin and contiguous to the current session history entry.
+ Returns an array of NavigationHistoryEntry instances represent the current
+ navigation history entry list, i.e., all session history
+ entries for this navigable that are same origin and contiguous
+ to the current session history entry.
navigation.currentEntry
- Returns the NavigationHistoryEntry corresponding to the current session history entry.
+ Returns the NavigationHistoryEntry corresponding to the current session history entry.
navigation.updateCurrentEntry({ state })
-
-
Updates the navigation API state of the current session history entry, without performing a navigation like navigation.reload() would do.
+ Updates the navigation API state of the current session history entry, without performing a
+ navigation like navigation.reload() would do.
- This method is best used to capture updates to the page that have already happened, and need to be reflected into the navigation API state. For cases where the state update is meant to drive a page update, instead use navigation.navigate() or navigation.reload() , which will trigger a navigate event.
+ This method is best used to capture updates to the page that have already happened, and need
+ to be reflected into the navigation API state. For cases where the state update is meant to
+ drive a page update, instead use navigation.navigate() or navigation.reload() , which will trigger a navigate event.
navigation.canGoBack
- Returns true if the current current session history entry (i.e., currentEntry ) is not the first one in the navigation history entry list (i.e., in entries() ). This means that there is a previous session history entry for this navigable, and its document state's origin is same origin with the current Document 's origin.
+ Returns true if the current current session
+ history entry (i.e., currentEntry ) is
+ not the first one in the navigation history entry list (i.e., in entries() ). This means that there is a previous
+ session history entry for this navigable, and its document state's origin is same origin with the current
+ Document 's origin.
navigation.canGoForward
- Returns true if the current current session history entry (i.e., currentEntry ) is not the last one in the navigation history entry list (i.e., in entries() ). This means that there is a next session history entry for this navigable, and its document state's origin is same origin with the current Document 's origin.
+ Returns true if the current current session
+ history entry (i.e., currentEntry ) is
+ not the last one in the navigation history entry list (i.e., in entries() ). This means that there is a next session
+ history entry for this navigable, and its document state's origin is same origin with the current
+ Document 's origin.
- The entries() method steps are:
+ The entries()
+ method steps are:
- If this has entries and events disabled, then return the empty list.
+ If this has entries and events disabled, then return the empty
+ list.
-
Return this's entry list.
- Recall that because of Web IDL's sequence type conversion rules, this will create a new JavaScript array object on each call. That is, navigation.entries() !== navigation.entries() .
+ Recall that because of Web IDL's sequence type conversion rules, this will
+ create a new JavaScript array object on each call. That is, navigation.entries() !== navigation.entries() .
- The currentEntry getter steps are to return the current entry of this.
+ The currentEntry getter steps are to return the
+ current entry of this.
- The updateCurrentEntry(options) method steps are:
+ The updateCurrentEntry(options)
+ method steps are:
- Let current be the current entry of this.
+ Let current be the current entry
+ of this.
- If current is null, then throw an "InvalidStateError " DOMException .
+ If current is null, then throw an "InvalidStateError "
+ DOMException .
- Let serializedState be StructuredSerializeForStorage(options["state "]), rethrowing any excpetions.
+ Let serializedState be
+ StructuredSerializeForStorage(options["state "]), rethrowing any
+ excpetions.
- Set current's session history entry's navigation API state to serializedState.
+ Set current's session history entry's navigation API state to
+ serializedState.
- Fire an event named currententrychange at this using NavigationCurrentEntryChangeEvent , with its navigationType attribute initialized to null and its from initialized to current.
+ Fire an event named currententrychange at this using
+ NavigationCurrentEntryChangeEvent , with its navigationType attribute
+ initialized to null and its from
+ initialized to current.
- The canGoBack getter steps are:
+ The canGoBack getter steps are:
- If this has entries and events disabled, then return false.
+ If this has entries and events disabled, then return
+ false.
- Assert: this's current entry index is not −1.
+ Assert: this's current entry index is not −1.
- If this's current entry index is 0, then return false.
+ If this's current entry
+ index is 0, then return false.
Return true.
- The canGoForward getter steps are:
+ The canGoForward getter steps are:
- If this has entries and events disabled, then return false.
+ If this has entries and events disabled, then return
+ false.
- Assert: this's current entry index is not −1.
+ Assert: this's current entry index is not −1.
- If this's current entry index is equal to this's entry list's size, then return false.
+ If this's current entry
+ index is equal to this's entry
+ list's size, then return false.
Return true.
@@ -89283,44 +89512,80 @@ interface NavigationHistoryEntry : EventTarget
{ committed, finished } = navigation.navigate(url)
{ committed, finished } = navigation.navigate(url, options)
-
-
Navigates the current page to the given url. options can contain the following values:
+ Navigates the current page to the given url.
+ options can contain the following values:
- history can be set to "replace " to replace the current session history entry, instead of pushing a new one.
-
- info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
-
- state can be set to any serializable value; it will populate the state retrieved by navigation.currentEntry.getState() once the navigation completes, for same-document navigations., (It will be ignored for navigations that end up cross-document.)
+ history can be set to
+ "replace " to replace the current
+ session history entry, instead of pushing a new one.
+
+ info can be set to any value; it
+ will populate the info property of the
+ corresponding NavigateEvent .
+
+ state can be set to any
+ serializable value; it will populate the state
+ retrieved by navigation.currentEntry.getState() once the
+ navigation completes, for same-document navigations., (It will be ignored for navigations that
+ end up cross-document.)
- By default this will perform a full navigation (i.e., a cross-document navigation, unless the given URL differs only in a fragment from the current one). The navigateEvent.intercept() method can be used to convert it into a same-document navigation.
+ By default this will perform a full navigation (i.e., a cross-document navigation, unless the
+ given URL differs only in a fragment from the current
+ one). The navigateEvent.intercept() method can
+ be used to convert it into a same-document navigation.
The returned promises will behave as follows:
- For navigations that get aborted, both promises will reject with an "AbortError " DOMException .
-
- For same-document navigations created by using the navigateEvent.intercept() method, committed will fulfill immediately, and finished will fulfill or reject according to any promsies returned by handlers passed to intercept() .
-
- For other same-document navigations (e.g., non-intercepted fragment navigations), both promises will fulfill immediately.
-
- For cross-document navigations, or navigations that result in 204 or 205 statuses or `Content-Disposition: attachment ` header fields from the server (and thus do not actually navigate), both promises will never settle.
+ For navigations that get aborted, both promises will reject with an
+ "AbortError " DOMException .
+
+ For same-document navigations created by using the navigateEvent.intercept() method, committed will fulfill immediately, and finished will fulfill or reject according to any
+ promsies returned by handlers passed to intercept() .
+
+ For other same-document navigations (e.g., non-intercepted fragment navigations), both promises will fulfill
+ immediately.
+
+ For cross-document navigations, or navigations that result in 204 or 205 statuses or `Content-Disposition: attachment ` header fields from
+ the server (and thus do not actually navigate), both promises will never settle.
- In all cases ,when the returned promises fulfill, it will be with the NavigationHistoryEntry that was navigated to.
+ In all cases ,when the returned promises fulfill, it will be with the
+ NavigationHistoryEntry that was navigated to.
{ committed, finished } = navigation.reload(options)
-
-
Reloads the current page. options can contain info and state , which behave as described above.
+ Reloads the current page. options can contain info and state , which behave as described above.
- The default behavior of performing a from-network-or-cache reload of the current page can be overriden by the using the navigateEvent.intercept() method. Doing so will mean this call only updates state or passes along the appropriate info , plus performing whater actions the navigate event handlers see fit to carry out.
+ The default behavior of performing a from-network-or-cache reload of the current page can be
+ overriden by the using the navigateEvent.intercept() method. Doing so will mean
+ this call only updates state or passes along the appropriate info , plus performing whater actions the navigate event handlers see fit to carry out.
The returned promises will behave as follows:
- If the reload is intercepted by using the navigateEvent.intercept() method, committed will fulfill immediately, and finished will fulfill or reject according to any promsies returned by handlers passed to intercept() .
+ If the reload is intercepted by using the navigateEvent.intercept() method, committed will fulfill immediately, and finished will fulfill or reject according to any
+ promsies returned by handlers passed to intercept() .
Otherwise, both promises will never settle.
@@ -89329,230 +89594,427 @@ interface NavigationHistoryEntry : EventTarget
{ committed, finished } = navigation.traverseTo(key)
{ committed, finished } = navigation.traverseTo(key, { info })
-
-
Traverses to the closest session history entry that matches the NavigationHistoryEntry with the given key. info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
+ Traverses to the closest session
+ history entry that matches the NavigationHistoryEntry with the given
+ key. info can be set to any value;
+ it will populate the info property of the
+ corresponding NavigateEvent .
- If a traversal to that session history entry is already in progress, then this will return the promises for that original traversal, and info will be ignored.
+ If a traversal to that session history entry is already in progress, then this
+ will return the promises for that original traversal, and info will be ignored.
The returned promises will behave as follows:
- If there is no NavigationHistoryEntry in navigation.entries() whose key matches key, both promises will reject with an "InvalidStateError " DOMException .
-
- For same-document traversals intercepted by the navigateEvent.intercept() method, committed will fulfill as soon as the traversal is processed and navigation.currentEntry is updated, and finished will fulfill or reject according to any promsies returned by the handlers passed to intercept() .
-
- For non-intercepted same-document travesals, both promises will fulfill as soon as the traversal is processed and navigation.currentEntry is updated.
+ If there is no NavigationHistoryEntry in navigation.entries() whose key matches key, both promises will
+ reject with an "InvalidStateError "
+ DOMException .
- For cross-document traversals, including attempted cross-document traversals that end up resulting in a 204 or 205 statuses or `Content-Disposition: attachment ` header fields from the server (and thus do not actually traverse), both promises will never settle.
+ For same-document traversals intercepted by the navigateEvent.intercept() method, committed will fulfill as soon as the traversal
+ is processed and navigation.currentEntry is
+ updated, and finished will fulfill or
+ reject according to any promsies returned by the handlers passed to intercept() .
+
+ For non-intercepted same-document travesals, both promises will fulfill as soon as the
+ traversal is processed and navigation.currentEntry is updated.
+
+ For cross-document traversals, including attempted cross-document traversals that end up
+ resulting in a 204 or 205 statuses or `Content-Disposition: attachment ` header fields from
+ the server (and thus do not actually traverse), both promises will never settle.
{ committed, finished } = navigation.back(key)
{ committed, finished } = navigation.back(key, { info })
-
-
Traverses to the closest previous session history entry which results in this navigable traversing, i.e. which corresponds to a different NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
+ Traverses to the closest previous session history entry which results in this
+ navigable traversing, i.e. which corresponds to a different
+ NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the
+ info property of the corresponding
+ NavigateEvent .
- If a traversal to that session history entry is already in progress, then this will return the promises for that original traversal, and info will be ignored.
+ If a traversal to that session history entry is already in progress, then this
+ will return the promises for that original traversal, and info will be ignored.
- The returned promises behave equivalently to those returned by traverseTo() .
+ The returned promises behave equivalently to those returned by traverseTo() .
{ committed, finished } = navigation.forward(key)
{ committed, finished } = navigation.forward(key, { info })
-
-
Traverses to the closest forward session history entry which results in this navigable traversing, i.e. which corresponds to a different NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the info property of the corresponding NavigateEvent .
+ Traverses to the closest forward session history entry which results in this
+ navigable traversing, i.e. which corresponds to a different
+ NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the
+ info property of the corresponding
+ NavigateEvent .
- If a traversal to that session history entry is already in progress, then this will return the promises for that original traversal, and info will be ignored.
+ If a traversal to that session history entry is already in progress, then this
+ will return the promises for that original traversal, and info will be ignored.
- The returned promises behave equivalently to those returned by traverseTo() .
+ The returned promises behave equivalently to those returned by traverseTo() .
- The navigate(options) method steps are:
+ The navigate(options) method steps are:
- Parse url relative to this's relevant settings object. If that returns failure, then return an early error result for a "SyntaxError " DOMException . Otherwise, let urlRecord be the resulting URL record.
+ Parse url relative to this's
+ relevant settings object. If that returns failure, then return an early error result for a
+ "SyntaxError " DOMException . Otherwise, let
+ urlRecord be the resulting URL record.
- Let document be this's relevant global object's associated Document .
+ Let document be this's relevant global object's associated Document .
- If options["history "] is "push ", and the navigation must be a replace given urlRecord and document, then return an early error result for a "NotSupportedError " DOMException .
+ If options["history "] is "push ", and the navigation must be a
+ replace given urlRecord and document, then return an early error result for a
+ "NotSupportedError " DOMException .
- Let state be options["state "], if it exists; otherwise, undefined.
+ Let state be options["state "], if it exists; otherwise, undefined.
-
-
Let serializedState be StructuredSerializeForStorage(state). If this throws an exception, then return an early error result for that exception.
+ Let serializedState be
+ StructuredSerializeForStorage(state). If this throws an exception, then
+ return an early error result for that
+ exception.
- It is importantly to perform this step early, since serialization can invoke web developer code, which in turn might change various things we check in later steps.
+ It is importantly to perform this step early, since serialization can invoke web
+ developer code, which in turn might change various things we check in later steps.
- If document is not fully active, then return an early error result for an "InvalidStateError " DOMException .
+ If document is not fully active, then return an early error result for an
+ "InvalidStateError " DOMException .
- If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError " DOMException .
+ If document's unload counter is greater than 0, then return an
+ early error result for an
+ "InvalidStateError " DOMException .
- Let info be options["info "], if it exists; otherwise, undefined.
+ Let info be options["info "], if it exists;
+ otherwise, undefined.
- Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for this given info and serializedState.
+ Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for
+ this given info and serializedState.
-
Navigate document's node navigable to urlRecord using document, with historyHandling set to options["history "] and navigationAPIState set to serializedState.
- Unlike location.assign() and friends, which are exposed across origin-domain boundaries, navigation.navigate() can only be accessed by code with direct synchronous access to the window.navigation property. Thus, we avoid the complications about attributing the source document of the navigation, and we don't need to deal with the allowed by sandboxing to navigate check and its acccompanying exceptionsEnabled flag. We just treat all navigations as if they come from the Document corresponding to this Navigation object itself (i.e., document).
+ Unlike location.assign() and friends,
+ which are exposed across origin-domain boundaries,
+ navigation.navigate() can only be accessed by code
+ with direct synchronous access to the window.navigation
+ property. Thus, we avoid the complications about attributing the source document of the
+ navigation, and we don't need to deal with the allowed by sandboxing to navigate
+ check and its acccompanying exceptionsEnabled flag. We just
+ treat all navigations as if they come from the Document corresponding to this
+ Navigation object itself (i.e., document).
-
-
If this's upcoming non-traverse API method tracker is apiMethodTracker, then:
+ If this's upcoming non-traverse API method tracker is
+ apiMethodTracker, then:
- This means the navigate algorithm bailed out before ever getting to the inner navigate event firing algorithm which would promote that upcoming API method tracker to ongoing.
+ This means the navigate algorithm bailed out before ever getting to
+ the inner navigate event firing algorithm
+ which would promote that
+ upcoming API method tracker to ongoing.
- Set this's upcoming non-traverse API method tracker to null.
+ Set this's upcoming non-traverse API method tracker to
+ null.
- Return an early error result for an "AbortError " DOMException .
+ Return an early error result for
+ an "AbortError " DOMException .
- Return a navigation API method tracker-derived result for apiMethodTracker.
+ Return a navigation API method tracker-derived result for
+ apiMethodTracker.
- The reload(options) method steps are:
+ The reload(options) method steps are:
- Let document be this's relevant global object's associated Document .
+ Let document be this's relevant global object's associated Document .
- Let serializedState be StructuredSerializeForStorage(undefined).
+ Let serializedState be
+ StructuredSerializeForStorage(undefined).
-
-
If options["state "] exists, then set serializedState to StructuredSerializeForStorage(options["state "]). If this throws an exception, then return an early error result for that exception.
+ If options["state "] exists, then set serializedState to
+ StructuredSerializeForStorage(options["state "]). If this throws an exception, then
+ return an early error result for that
+ exception.
- It is importantly to perform this step early, since serialization can invoke web developer code, which in turn might change various things we check in later steps.
+ It is importantly to perform this step early, since serialization can invoke web
+ developer code, which in turn might change various things we check in later steps.
-
Otherwise:
- Let current be the current entry of this.
+ Let current be the current
+ entry of this.
- If current is not null, then set serializedState to current's session history entry's navigation API state.
+ If current is not null, then set serializedState to
+ current's session history entry's navigation API state.
- If document is not fully active, then return an early error result for an "InvalidStateError " DOMException .
+ If document is not fully active, then return an early error result for an
+ "InvalidStateError " DOMException .
- If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError " DOMException .
+ If document's unload counter is greater than 0, then return an
+ early error result for an
+ "InvalidStateError " DOMException .
- Let info be options["info "], if it exists; otherwise, undefined.
+ Let info be options["info "], if it exists;
+ otherwise, undefined.
- Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for this given info and serializedState.
+ Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for
+ this given info and serializedState.
- Reload document's node navigable with navigationAPIState set to serializedState.
+ Reload document's node navigable with navigationAPIState set to
+ serializedState.
- Return a navigation API method tracker-derived result for apiMethodTracker.
+ Return a navigation API method tracker-derived result for
+ apiMethodTracker.
- The traverseTo(key, options) method steps are:
+ The traverseTo(key, options)
+ method steps are:
- If this's current entry index is −1, then return an early error result for an "InvalidStateError " DOMException .
+ If this's current entry
+ index is −1, then return an early
+ error result for an "InvalidStateError "
+ DOMException .
- If this's entry list does not contain a NavigationHistoryEntry whose session history entry's navigation API key equals key, then return an early error result for an "InvalidStateError " DOMException .
+ If this's entry list does not
+ contain a NavigationHistoryEntry whose session history entry's navigation
+ API key equals key, then return an early error result for an
+ "InvalidStateError " DOMException .
- Return the result of performing a navigation API traversal given this, key, and options.
+ Return the result of performing a navigation API traversal given
+ this, key, and options.
- The back(options) method steps are:
+ The back(options) method steps are:
- If this's current entry index is −1 or 0, then return an early error result for an "InvalidStateError " DOMException .
+ If this's current entry
+ index is −1 or 0, then return an early error result for an
+ "InvalidStateError " DOMException .
- Let key be this's entry list[this's current entry index − 1]'s session history entry's navigation API key.
+ Let key be this's entry
+ list[this's current entry
+ index − 1]'s session history entry's navigation API key.
- Return the result of performing a navigation API traversal given this, key, and options.
+ Return the result of performing a navigation API traversal given
+ this, key, and options.
- The forward(options) method steps are:
+ The forward(options) method steps are:
- If this's current entry index is −1 or is equal to this's entry list's size − 1, then return an early error result for an "InvalidStateError " DOMException .
+ If this's current entry
+ index is −1 or is equal to this's entry list's size −
+ 1, then return an early error result for
+ an "InvalidStateError " DOMException .
- Let key be this's entry list[this's current entry index + 1]'s session history entry's navigation API key.
+ Let key be this's entry
+ list[this's current entry
+ index + 1]'s session history entry's navigation API key.
- Return the result of performing a navigation API traversal given this, key, and options.
+ Return the result of performing a navigation API traversal given
+ this, key, and options.
- To perform a navigation API traversal given a Navigation navigation, a string key, and a NavigationOptions options:
+ To perform a navigation API traversal
+ given a Navigation navigation, a string key, and a
+ NavigationOptions options:
- Let document be navigation's relevant global object's associated Document .
+ Let document be navigation's relevant global object's
+ associated Document .
- If document is not fully active, then return an early error result for an "InvalidStateError " DOMException .
+ If document is not fully active, then return an early error result for an
+ "InvalidStateError " DOMException .
- If document's unload counter is greater than 0, then return an early error result for an "InvalidStateError " DOMException .
+ If document's unload counter is greater than 0, then return an
+ early error result for an
+ "InvalidStateError " DOMException .
- Let current be the current entry of navigation.
+ Let current be the current entry
+ of navigation.
- If key equals current's session history entry's navigation API key, then return «[ "committed " → a promise resolved with current, "finished " → a promise resolved with current ]».
+ If key equals current's session history
+ entry's navigation API key, then return «[
+ "committed " → a promise resolved
+ with current, "finished "
+ → a promise resolved with current ]».
- If navigation's upcoming traverse API method trackers[key] exists, then return a navigation API method tracker-derived result for navigation's upcoming traverse API method trackers[key].
+ If navigation's upcoming traverse API method
+ trackers[key] exists, then return a
+ navigation API method tracker-derived result for navigation's
+ upcoming traverse API method trackers[key].
- Let info be options["info "], if it exists; otherwise, undefined.
+ Let info be options["info "], if it exists;
+ otherwise, undefined.
- Let apiMethodTracker be the result of adding an upcoming traverse API method tracker for navigation given key and info.
+ Let apiMethodTracker be the result of adding an upcoming traverse API method tracker for
+ navigation given key and info.
Let navigable be document's node navigable.
- Let traversable be navigable's traversable navigable.
+ Let traversable be navigable's traversable navigable.
- Let sourceSnapshotParams be the result of snapshotting source snapshot params given document.
+ Let sourceSnapshotParams be the result of snapshotting source snapshot
+ params given document.
-
-
Append the following session history traversal steps to traversable:
+ Append the following session history
+ traversal steps to traversable:
- Let navigableSHEs be the result of getting session history entries given navigable.
+ Let navigableSHEs be the result of getting session history
+ entries given navigable.
-
-
Let targetSHE be the session history entry in navigableSHEs whose navigation API key is key. If no such entry exists, then:
+ Let targetSHE be the session history entry in
+ navigableSHEs whose navigation API key
+ is key. If no such entry exists, then:
- Queue a global task on the navigation and traversal task source given navigation's relevant global object to reject the finished promise for apiMethodTracker with an "InvalidStateError " DOMException .
+ Queue a global task on the navigation and traversal task
+ source given navigation's relevant global object to
+ reject the finished promise for apiMethodTracker with an
+ "InvalidStateError " DOMException .
Abort these steps.
- This path is taken if navigation's entry list was outdated compared to navigableSHEs, which can occur for brief periods while all the relevant threads and processes are being synchronized in reaction to a history change.
+ This path is taken if navigation's entry list was outdated compared to
+ navigableSHEs, which can occur for brief periods while all the relevant threads and
+ processes are being synchronized in reaction to a history change.
-
-
If targetSHE is navigable's active session history entry, then abort these steps.
+ If targetSHE is navigable's active session history entry, then abort these
+ steps.
- This can occur if a previously queued traversal already took us to this session history entry. In that case the previous traversal will have dealt with apiMethodTracker already.
+ This can occur if a previously queued traversal already took us to
+ this session history entry. In that case the previous traversal will have dealt
+ with apiMethodTracker already.
- Let result be the result of applying the traverse history step given by targetSHE's step to traversable, given sourceSnapshotParams, navigable, and "none ".
+ Let result be the result of applying the traverse history step given by targetSHE's step to traversable, given sourceSnapshotParams,
+ navigable, and "none ".
- If result is "canceled-by-beforeunload ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to reject the finished promise for apiMethodTracker with a new "AbortError " DOMException created in navigation's relevant realm.
+ If result is "canceled-by-beforeunload ", then
+ queue a global task on the navigation and traversal task source given
+ navigation's relevant global object to reject the finished
+ promise for apiMethodTracker with a new
+ "AbortError " DOMException created in
+ navigation's relevant realm.
-
-
If result is "initiator-disallowed ", then queue a global task on the navigation and traversal task source given navigation's relevant global object to reject the finished promise for apiMethodTracker with a new "SecurityError " DOMException created in navigation's relevant realm.
+ If result is "initiator-disallowed ", then queue a
+ global task on the navigation and traversal task source given
+ navigation's relevant global object to reject the finished
+ promise for apiMethodTracker with a new
+ "SecurityError " DOMException created in
+ navigation's relevant realm.
- When result is "canceled-by-beforeunload " or "initiator-disallowed ", the navigate event was never fired, finalizing with an aborted navigation error would not be correct; it would result in a navigateerror event without a preceding navigate event.
-
- In the "canceled-by-navigate " case, navigate is fired, but the inner navigate event firing algorithm will take care of finalizing with an aborted navigation error.
+ When result is "canceled-by-beforeunload " or "initiator-disallowed ", the navigate
+ event was never fired, finalizing
+ with an aborted navigation error would not be correct; it would result in a navigateerror event without a preceding navigate event.
+
+ In the "canceled-by-navigate " case, navigate is fired, but the inner navigate event firing algorithm will take care of finalizing with an aborted navigation
+ error.
- Return a navigation API method tracker-derived result for apiMethodTracker.
+ Return a navigation API method tracker-derived result for
+ apiMethodTracker.
- An early error result for an exception e is a NavigationResult dictionary instance given by «[ "committed " → a promise rejected with e, "finished " → a promise rejected with e ]».
+ An early error result for an exception
+ e is a NavigationResult dictionary instance given by «[ "committed " → a promise rejected with
+ e, "finished " → a promise
+ rejected with e ]».
- A navigation API method tracker-derived result for a navigation API method tracker is a NavigationResult dictionary instance given by «[ apiMethodTracker's committed promise, "finished " → apiMethodTracker's finished promise ]».
+ A navigation API method tracker-derived result for a navigation API method
+ tracker is a NavigationResult dictionary instance given by «[
+ apiMethodTracker's committed
+ promise, "finished " →
+ apiMethodTracker's finished
+ promise ]».
@@ -89561,7 +90023,8 @@ interface NavigationHistoryEntry : EventTarget
- During any given navigation (in the broad sense of the word), the Navigation object needs to keep track of the following:
+ During any given navigation (in the broad sense of the
+ word), the Navigation object needs to keep track of the following:
For all navigations
@@ -89629,73 +90092,106 @@ interface NavigationHistoryEntry : EventTarget
So that we can suppress the normal scroll restoration logic in favor of the behavior given by the scroll option
|
- We also cannot assume there is only a single navigation requested at any given time, due to web developer code such as:
+ We also cannot assume there is only a single navigation requested at any given time, due to web
+ developer code such as:
const p1 = navigation.navigate(url1).finished;
const p2 = navigation.navigate(url2).finished;
- That is, in this scenario, we need to ensure that while navigating to url2 , we still have the promise p1 around so that we can reject it. We can't just get rid of any ongoing navigation promises the moment the second call to navigate() happens.
+ That is, in this scenario, we need to ensure that while navigating to url2 , we still have the promise p1 around so that we can
+ reject it. We can't just get rid of any ongoing navigation promises the moment the second call to
+ navigate() happens.
- We end up accomplishing all this by associating the following with each Navigation :
+ We end up accomplishing all this by associating the following with each
+ Navigation :
- Ongoing navigate event, a NavigateEvent or null, initially null.
+ Ongoing navigate event, a
+ NavigateEvent or null, initially null.
- Ongoing navigation signal, an AbortSignal or null, initially null.
+ Ongoing navigation signal, an AbortSignal or null, initially
+ null.
Focus changed during ongoing navigation, a boolean, initially false.
- Suppress normal scroll restoration during ongoing navigation, a boolean, initially false.
+ Suppress normal scroll restoration during ongoing navigation, a boolean,
+ initially false.
- Ongoing API method tracker, a navigation API method tracker or null, initially null.
+ Ongoing API method tracker, a navigation API method tracker or
+ null, initially null.
- Upcoming non-traverse API method tracker, a navigation API method tracker or null, initially null.
+ Upcoming non-traverse API method tracker, a navigation API method
+ tracker or null, initially null.
- Upcoming traverse API method trackers, a map from strings to navigation API method trackers, initially empty.
+ Upcoming traverse API method trackers, a map from strings to navigation API method trackers, initially
+ empty.
- The state here that is not stored in navigation API method trackers is state which needs to be tracked even for navigations that are not via navigation API methods.
+ The state here that is not stored in navigation API method trackers is state which needs to be tracked even for
+ navigations that are not via navigation API methods.
- A navigation API method tracker is a struct with the following items:
+ A navigation API method tracker is a struct with the following items:
- A navigation object, a Navigation
+ A navigation object, a
+ Navigation
A key, a string or null
- An info, a JavaScript value
+ An info, a JavaScript
+ value
- A serialized state, a serialized state or null
+ A serialized state, a
+ serialized state or null
- A committed-to entry, a NavigationHistoryEntry or null
+ A committed-to entry,
+ a NavigationHistoryEntry or null
- A committed promise, a promise
+ A committed promise, a
+ promise
- A finished promise, a promise
+ A finished promise, a
+ promise
All this state is then managed via the following algorithms.
- To set the upcoming non-traverse API method tracker given a Navigation navigation, a JavaScript value info, and a serialized state-or-null serializedState:
+ To set the upcoming non-traverse API method tracker given a Navigation
+ navigation, a JavaScript value info, and a serialized
+ state-or-null serializedState:
- Let committedPromise and finishedPromise be new promises created in navigation's relevant realm.
+ Let committedPromise and finishedPromise be new promises created in
+ navigation's relevant realm.
-
Mark as handled finishedPromise.
- The web developer doesn’t necessarily care about finishedPromise being rejected:
+ The web developer doesn’t necessarily care about finishedPromise being
+ rejected:
They might only care about committedPromise.
- They could be doing multiple synchronous navigations within the same task, in which case all but the last will be aborted (causing their finishedPromise to reject). This could be an application bug, but also could just be an emergent feature of disparate parts of the application overriding each others' actions.
+ They could be doing multiple synchronous navigations within the same task, in which
+ case all but the last will be aborted (causing their finishedPromise to reject).
+ This could be an application bug, but also could just be an emergent feature of disparate
+ parts of the application overriding each others' actions.
- They might prefer to listen to other transition-failure signals instead of finishedPromise, e.g., the navigateerror event, or the navigation.transition.finished promise.
+ They might prefer to listen to other transition-failure signals instead of
+ finishedPromise, e.g., the navigateerror
+ event, or the navigation.transition.finished
+ promise.
- As such, we mark it as handled to ensure that it never triggers unhandledrejection events.
+ As such, we mark it as handled to ensure that it never triggers unhandledrejection events.
@@ -89726,22 +90222,28 @@ const p2 = navigation.navigate(url2).finished;
- Assert: navigation's upcoming non-traverse API method tracker is null.
+ Assert: navigation's upcoming non-traverse API method
+ tracker is null.
- Set navigation's upcoming non-traverse API method tracker to apiMethodTracker.
+ Set navigation's upcoming non-traverse API method tracker to
+ apiMethodTracker.
Return apiMethodTracker.
- To add an upcoming traverse API method tracker given a Navigation navigation, a string destinationKey, and a JavaScript value info:
+ To add an upcoming traverse API method tracker given a Navigation
+ navigation, a string destinationKey, and a JavaScript value
+ info:
- Let committedPromise and finishedPromise be new promises created in navigation's relevant realm.
+ Let committedPromise and finishedPromise be new promises created in
+ navigation's relevant realm.
-
Mark as handled finishedPromise.
- See the previous discussion about why this is done.
+ See the previous
+ discussion about why this is done.
-
@@ -89771,29 +90273,37 @@ const p2 = navigation.navigate(url2).finished;
- Set navigation's upcoming traverse API method trackers[key] to apiMethodTracker.
+ Set navigation's upcoming traverse API method
+ trackers[key] to apiMethodTracker.
Return apiMethodTracker.
- To promote an upcoming API method tracker to ongoing given a Navigation navigation and a string-or-null destinationKey:
+ To promote an upcoming API method tracker to ongoing given a Navigation
+ navigation and a string-or-null destinationKey:
- Assert: navigation's ongoing API method tracker is null.
+ Assert: navigation's ongoing API method tracker is
+ null.
-
If destinationKey is not null, then:
- Assert: navigation's upcoming non-traverse API method tracker is null.
+ Assert: navigation's upcoming non-traverse API method
+ tracker is null.
-
-
If navigation's upcoming traverse API method trackers[destinationKey] exists, then:
+ If navigation's upcoming traverse API method
+ trackers[destinationKey] exists, then:
- Set navigation's ongoing API method tracker to navigation's upcoming traverse API method trackers[destinationKey].
+ Set navigation's ongoing API method tracker to
+ navigation's upcoming traverse API method
+ trackers[destinationKey].
- Remove navigation's upcoming traverse API method trackers[destinationKey].
+ Remove navigation's upcoming
+ traverse API method trackers[destinationKey].
@@ -89803,99 +90313,153 @@ const p2 = navigation.navigate(url2).finished;
Otherwise:
- Set navigation's ongoing API method tracker to navigation's upcoming non-traverse API method tracker.
+ Set navigation's ongoing API method tracker to
+ navigation's upcoming non-traverse API method tracker.
- Set navigation's upcoming non-traverse API method tracker to null.
+ Set navigation's upcoming non-traverse API method tracker to
+ null.
- To clean up a navigation API method tracker apiMethodTracker:
+ To clean up a navigation API
+ method tracker apiMethodTracker:
- Let navigation be apiMethodTracker's navigation object.
+ Let navigation be apiMethodTracker's navigation object.
- If navigation's ongoing API method tracker is apiMethodTracker, then set navigation's ongoing API method tracker to null.
+ If navigation's ongoing API method tracker is
+ apiMethodTracker, then set navigation's ongoing API method
+ tracker to null.
-
Otherwise:
- Let key be apiMethodTracker's key.
+ Let key be apiMethodTracker's key.
Assert: key is not null.
- Assert: navigation's upcoming traverse API method trackers[key] exists.
+ Assert: navigation's upcoming traverse API method
+ trackers[key] exists.
- Remove navigation's upcoming traverse API method trackers[key].
+ Remove navigation's upcoming traverse
+ API method trackers[key].
- To notify about the committed-to entry given a navigation API method tracker apiMethodTracker and a NavigationHistoryEntry nhe:
+ To notify about the committed-to entry given a navigation API method
+ tracker apiMethodTracker and a NavigationHistoryEntry
+ nhe:
- Set apiMethodTracker's committed-to entry to nhe.
+ Set apiMethodTracker's committed-to entry to
+ nhe.
-
-
If apiMethodTracker's serialized state is not null, then set nhe's session history entry's navigation API state to apiMethodTracker's serialized state.
+ If apiMethodTracker's serialized state is not null, then set
+ nhe's session history entry's navigation API state to apiMethodTracker's
+ serialized state.
- If it's null, then we're traversing to nhe via navigation.traverseTo() , which does not allow changing the state.
+ If it's null, then we're traversing to nhe via navigation.traverseTo() , which does not allow changing
+ the state.
- At this point, apiMethodTracker's serialized state is no longer needed. Implementations might want to clear it out to avoid keeping it alive for the lifetime of the navigation API method tracker.
+ At this point, apiMethodTracker's serialized state is no longer needed.
+ Implementations might want to clear it out to avoid keeping it alive for the lifetime of the
+ navigation API method tracker.
-
-
Resolve apiMethodTracker's committed promise with nhe.
+ Resolve apiMethodTracker's committed promise with
+ nhe.
- At this point, apiMethodTracker's committed promise is only needed in cases where it has not yet been returned to author code. Implementations might want to clear it out to avoid keeping it alive for the lifetime of the navigation API method tracker.
+ At this point, apiMethodTracker's committed promise is only needed in
+ cases where it has not yet been returned to author code. Implementations might want to clear it
+ out to avoid keeping it alive for the lifetime of the navigation API method
+ tracker.
- To resolve the finished promise for a navigation API method tracker apiMethodTracker:
+ To resolve the finished promise for a navigation API method tracker
+ apiMethodTracker:
-
-
Resolve apiMethodTracker's committed promise with its committed-to entry.
+ Resolve apiMethodTracker's committed promise with its committed-to entry.
- Usually, notify about the committed-to entry has previously been called on apiMethodTracker, and so this will do nothing. However, in some cases resolve the finished promise is called directly, in which case this step is necessary.
+ Usually, notify about the committed-to entry has previously been
+ called on apiMethodTracker, and so this will do nothing. However, in some cases
+ resolve the finished promise is called directly, in which case this step is
+ necessary.
- Resolve apiMethodTracker's finished promise with its committed-to entry.
+ Resolve apiMethodTracker's finished promise with its committed-to entry.
- Clean up apiMethodTracker.
+ Clean up
+ apiMethodTracker.
- To reject the finished promise for a navigation API method tracker apiMethodTracker with a JavaScript value exception:
+ To reject the finished promise for a navigation API method tracker
+ apiMethodTracker with a JavaScript value exception:
-
-
Reject apiMethodTracker's committed promise with exception.
+ Reject apiMethodTracker's committed promise with
+ exception.
- This will do nothing if apiMethodTracker's committed promise was previously resolved via notify about the committed-to entry.
+ This will do nothing if apiMethodTracker's committed promise was previously
+ resolved via notify about the committed-to entry.
- Reject apiMethodTracker's finished promise with exception.
+ Reject apiMethodTracker's finished promise with
+ exception.
- Clean up apiMethodTracker.
+ Clean up
+ apiMethodTracker.
- To finalize with an aborted navigation error given a Navigation navigation, a navigation API method tracker or null apiMethodTracker, and an optional DOMException error:
+ To finalize with an aborted navigation error given a Navigation
+ navigation, a navigation API method tracker or null
+ apiMethodTracker, and an optional DOMException error:
- Set navigation's focus changed during ongoing navigation to false.
+ Set navigation's focus changed during ongoing navigation to
+ false.
- Set navigation's suppress normal scroll restoration during ongoing navigation to false.
+ Set navigation's suppress normal scroll restoration during ongoing
+ navigation to false.
- If error was not given, then let error be a new "AbortError " DOMException created in navigation's relevant realm.
+ If error was not given, then let error be a new
+ "AbortError " DOMException created in
+ navigation's relevant realm.
-
-
If navigation's ongoing navigate event is non-null, then:
+ If navigation's ongoing navigate
+ event is non-null, then:
- Set navigation's ongoing navigate event's canceled flag to true.
+ Set navigation's ongoing navigate
+ event's canceled flag to true.
- Set navigation's ongoing navigate event to null.
+ Set navigation's ongoing navigate
+ event to null.
@@ -89903,58 +90467,94 @@ const p2 = navigation.navigate(url2).finished;
If navigation's ongoing navigation signal is non-null, then:
- Signal abort on navigation's ongoing navigation signal given error.
+ Signal abort on navigation's ongoing navigation
+ signal given error.
Set navigation's ongoing navigation signal to null.
-
-
Fire an event named navigateerror at navigation using ErrorEvent , with error initialized to error, and message , filename , lineno , and colno initialized to appropriate values that can be extracted from error and the current JavaScript stack in the same underspecified way that the report the exception algorithm does.
+ Fire an event named navigateerror at navigation using
+ ErrorEvent , with error initialized to
+ error, and message , filename , lineno , and colno initialized to appropriate values
+ that can be extracted from error and the current JavaScript stack in the same
+ underspecified way that the report the exception algorithm does.
- Thus, for example, if this algorithm is reached because of a call to window.stop() , these properties would probably end up initialized based on the line of script that called window.stop() . But if it's because the user clicked the stop button, these properties would probably end up with default values like the empty string or 0.
+ Thus, for example, if this algorithm is reached because of a call to window.stop() , these properties would probably end up
+ initialized based on the line of script that called window.stop() . But if it's because the user clicked the stop
+ button, these properties would probably end up with default values like the empty string or
+ 0.
- If apiMethodTracker is non-null, then reject the finished promise for apiMethodTracker with error.
+ If apiMethodTracker is non-null, then reject the finished promise
+ for apiMethodTracker with error.
-
-
If navigation's transition is not null, then:
+ If navigation's transition is
+ not null, then:
- Reject navigation's transition's finished promise with error.
+ Reject navigation's transition's finished promise with
+ error.
- Set navigation's transition to null.
+ Set navigation's transition to null.
- To inform the navigation API about aborting navigation in a navigable navigable:
+ To inform the navigation API about aborting navigation in a navigable
+ navigable:
- If this algorithm is running on navigable's active window's relevant agent's event loop, then continue on to the following steps. Otherwise, queue a global task on the navigation and traversal task source given navigable's active window to run the following steps.
+ If this algorithm is running on navigable's active
+ window's relevant agent's event
+ loop, then continue on to the following steps. Otherwise, queue a global task
+ on the navigation and traversal task source given navigable's active window to run the following steps.
- Let navigation be navigable's active window's navigation API.
+ Let navigation be navigable's active
+ window's navigation API.
- If navigation's ongoing navigation signal is null, then return.
+ If navigation's ongoing navigation signal is null, then
+ return.
- Finalize with an aborted navigation error given navigation and navigation's ongoing API method tracker.
+ Finalize with an aborted navigation error given navigation and
+ navigation's ongoing API method tracker.
- To inform the navigation API about child navigable destruction given a navigable navigable:
+ To inform the navigation API about child navigable destruction given a
+ navigable navigable:
- Inform the navigation API about aborting navigation in navigable.
+ Inform the navigation API about aborting navigation in
+ navigable.
- Let navigation be navigable's active window's navigation API.
+ Let navigation be navigable's active
+ window's navigation API.
- Let traversalAPIMethodTrackers to be clone of navigation's upcoming traverse API method trackers.
+ Let traversalAPIMethodTrackers to be clone of
+ navigation's upcoming traverse API method trackers.
- For each apiMethodTracker of traversalAPIMethodTrackers: finalize with an aborted navigation error given navigation and apiMethodTracker.
+ For each apiMethodTracker of
+ traversalAPIMethodTrackers: finalize with an aborted navigation error
+ given navigation and apiMethodTracker.
- The ongoing navigation concept is most-directly exposed to web developers through the navigation.transition property, which is an instance of the NavigationTransition interface:
+ The ongoing navigation concept is most-directly exposed to web developers through the navigation.transition property, which is an instance of
+ the NavigationTransition interface:
[Exposed=Window]
interface NavigationTransition {
@@ -89968,38 +90568,71 @@ interface NavigationTransition {
navigation.transition
-
-
A NavigationTransition representing any ongoing navigation that hasn't yet reached the navigatesuccess or navigateerror stage, if one exists; or null, if there is no such transition ongoing.
+ A NavigationTransition representing any ongoing navigation that hasn't yet
+ reached the navigatesuccess or navigateerror stage, if one exists; or null, if there is no
+ such transition ongoing.
- Since navigation.currentEntry (and other properties like location.href ) are updated immediately upon navigation, this navigation.transition property is useful for determining when such navigations are not yet fully settled, according to any handlers passed to navigateEvent.intercept() .
+ Since navigation.currentEntry (and other
+ properties like location.href ) are updated immediately
+ upon navigation, this navigation.transition
+ property is useful for determining when such navigations are not yet fully settled, according to
+ any handlers passed to navigateEvent.intercept() .
navigation.transition.navigationType
- One of "push ", "replace ", "reload ", or "traverse ", indicating what type of navigation this transition is for.
+ One of "push ", "replace ", "reload ", or "traverse ", indicating what type of navigation this
+ transition is for.
navigation.transition.from
- The NavigationHistoryEntry from which the transition is coming. This can be useful to compare against navigation.currentEntry .
+ The NavigationHistoryEntry from which the transition is coming. This can be
+ useful to compare against navigation.currentEntry .
navigation.transition.finished
- A promise which fulfills at the same time as the navigatesuccess fires, or rejects at the same time the navigateerror event fires.
+ A promise which fulfills at the same time as the navigatesuccess fires, or rejects at the same time the
+ navigateerror event fires.
- Each Navigation has a transition, which is a NavigationTransition or null, initially null.
+ Each Navigation has a transition, which is a
+ NavigationTransition or null, initially null.
- The transition getter steps are to return this's transition.
+ The transition getter steps are to return
+ this's transition.
- Each NavigationTransition has an associated navigation type, which is a NavigationType .
+ Each NavigationTransition has an associated navigation type, which is a
+ NavigationType .
- Each NavigationTransition has an associated from entry, which is a NavigationHistoryEntry .
+ Each NavigationTransition has an associated from entry, which is a
+ NavigationHistoryEntry .
- Each NavigationTransition has an associated finished promise, which is a promise.
+ Each NavigationTransition has an associated finished promise, which is a promise.
- The navigationType getter steps are to return this's navigation type.
+ The navigationType getter steps are to
+ return this's navigation
+ type.
- The from getter steps are to return this's from entry.
+ The from getter steps are to return
+ this's from entry.
- The finished getter steps are to return this's finished promise.
+ The finished getter steps are to return
+ this's finished
+ promise.
@@ -90007,7 +90640,14 @@ interface NavigationTransition {
The navigate event
- A major feature of the navigation API is the navigate event. This event is fired on any navigation (in the broad sense of the word), allowing web developers to monitor such outgoing navigations. In many cases, the event is cancelable , which allows preventing the navigation from happening. And in others, the navigation can be intercepted and replaced with a same-document navigation by using the intercept() method of the NavigateEvent class.
+ A major feature of the navigation API is the navigate
+ event. This event is fired on any navigation (in the broad sense of
+ the word), allowing web developers to monitor such outgoing navigations. In many cases, the
+ event is cancelable , which allows preventing the
+ navigation from happening. And in others, the navigation can be intercepted and replaced with a
+ same-document navigation by using the intercept() method of the NavigateEvent
+ class.
The NavigateEvent interface
@@ -90061,92 +90701,180 @@ callback NavigationInterceptHandler = Promise<undefined>
event.navigationType
- One of "push ", "replace ", "reload ", or "traverse ", indicating what type of navigation this is.
+ One of "push ", "replace ", "reload ", or "traverse ", indicating what type of navigation this
+ is.
event.destination
- A NavigationDestination representing the destination of the navigation.
+ A NavigationDestination representing the destination of the
+ navigation.
event.canIntercept
-
-
True if intercept() can be called to intercept this navigation and convert it into a same-document navigation, replacing its usual behavior; false otherwise.
+ True if intercept() can be called to
+ intercept this navigation and convert it into a same-document navigation, replacing its usual
+ behavior; false otherwise.
- Generally speaking, this will be true whenever the current Document can have its URL rewritten to the destination URL, except for in the case of cross-document "traverse " navigations, where it will always be false.
+ Generally speaking, this will be true whenever the current Document can
+ have its URL rewritten to the destination URL, except for in the case of cross-document
+ "traverse " navigations, where it will always
+ be false.
event.userInitiated
- True if this navigation was due to a user clicking on an a element, submitting a form element, or using the browser UI to navigate; false otherwise.
+ True if this navigation was due to a user clicking on an a element,
+ submitting a form element, or using the browser UI
+ to navigate; false otherwise.
event.hashChange
- True for a fragment navigation; false otherwise.
+ True for a fragment navigation; false
+ otherwise.
event.signal
-
-
An AbortSignal which will become aborted if the navigation gets canceled, e.g., by the user pressing their browser's "Stop" button, or by another navigation interrupting this one.
+ An AbortSignal which will become aborted if the navigation gets canceled, e.g.,
+ by the user pressing their browser's "Stop" button, or by another navigation interrupting this
+ one.
- The expected pattern is for developers to pass this along to any async operations, such as fetch() , which they perform as part of handling this navigation.
+ The expected pattern is for developers to pass this along to any async operations, such as
+ fetch() , which they perform as part of handling this navigation.
event.formData
-
-
The FormData representing the submitted form entries for this navigation, if this navigation is a "push " or "replace " navigation representing a POST form submission; null otherwise.
+ The FormData representing the submitted form entries for this navigation, if
+ this navigation is a "push " or "replace " navigation representing a POST form submission; null otherwise.
- (Notably, this will be null even for "reload " or "traverse " navigations that are revisiting a session history entry that was originally created from a form submission.)
+ (Notably, this will be null even for "reload "
+ or "traverse " navigations that are revisiting
+ a session history entry that was originally created from a form submission.)
event.downloadRequest
-
-
Represents whether or not this navigation was requested to be a download, by using an a or area element's download attribute:
+ Represents whether or not this navigation was requested to be a download, by using an
+ a or area element's download attribute:
If a download was not requested, then this property is null.
- If a download was requested, returns the filename that was supplied as the download attribute's value. (This could be the empty string.)
+ If a download was requested, returns the filename that was supplied as the download attribute's value. (This could be the empty
+ string.)
- Note that a download being requested does not always mean that a download will happen: for example, a download might be blocked by browser security policies, or end up being treated as a "push " navigation for unspecified reasons.
+ Note that a download being requested does not always mean that a download will happen: for
+ example, a download might be blocked by browser security policies, or end up being treated as a
+ "push " navigation for unspecified reasons.
- Similarly, a navigation might end up being a download even if it was not requested to be one, due to the destination server responding with a `Content-Disposition: attachment ` header.
+ Similarly, a navigation might end up being a download even if it was not requested to be one,
+ due to the destination server responding with a `Content-Disposition: attachment ` header.
- Finally, note that the navigate event will not fire at all for downloads initiated using browser UI affordances, e.g., those created by right-clicking and choosing to save the target of a link.
+ Finally, note that the navigate event will not fire at
+ all for downloads initiated using browser UI affordances, e.g., those created by right-clicking
+ and choosing to save the target of a link.
event.info
- An arbitrary JavaScript value passed via one of the navigation API methods which initiated this navigation, or undefined if the navigation was initiated by the user or by a different API.
+ An arbitrary JavaScript value passed via one of the navigation API methods which initiated this
+ navigation, or undefined if the navigation was initiated by the user or by a different
+ API.
event.intercept({ handler, focusReset, scroll })
-
-
Intercepts this navigation, preventing its normal handling and instead converting it into a same-document navigation of the same type to the destination URL.
-
- The handler option can be a function that returns a promise. The handler function will run after the navigate event has finished firing, and the navigation.currentEntry property has been synchronously updated. This returned promise is used to signal the duration, and success or failure, of the navigation. After it settles, the browser signals to the user (e.g., via a loading spinner UI, or assistive technology) that the navigation is finished. Additionally, it fires navigatesuccess or navigateerror events as appropriate, which other parts of the web application can respond to.
-
- By default, using this method will cause focus to reset when any handlers' returned promises settle. Focus will be reset to the first element with the autofocus attribute set, or the body element if the attribute isn't present. The focusReset option can be set to "manual " to avoid this behavior.
-
- By default, using this method will delay the browser's scroll restoration logic for "traverse " or "reload " navigations, or its scroll-reset/scroll-to-a-fragment logic for "push " or "replace " navigations, until any handlers' returned promises settle. The scroll option can be set to "manual " to turn off any browser-driven scroll behavior entirely for this navigation, or scroll() can be called before the promise settles to trigger this behavior early.
-
- This method will throw a "SecurityError " DOMException if canIntercept is false, or if isTrusted is false. It will throw an "InvalidStateError " DOMException if not called synchronously, during event dispatch.
+ Intercepts this navigation, preventing its normal handling and instead converting it into a
+ same-document navigation of the same type to the destination URL.
+
+ The handler option can be a
+ function that returns a promise. The handler function will run after the navigate event has finished firing, and the navigation.currentEntry property has been
+ synchronously updated. This returned promise is used to signal the duration, and success or
+ failure, of the navigation. After it settles, the browser signals to the user (e.g., via a
+ loading spinner UI, or assistive technology) that the navigation is finished. Additionally, it
+ fires navigatesuccess or navigateerror events as appropriate, which other parts of
+ the web application can respond to.
+
+ By default, using this method will cause focus to reset when any handlers' returned promises
+ settle. Focus will be reset to the first element with the autofocus attribute set, or the body element if
+ the attribute isn't present. The focusReset option can be set to "manual " to avoid this behavior.
+
+ By default, using this method will delay the browser's scroll restoration logic for "traverse " or "reload " navigations, or its
+ scroll-reset/scroll-to-a-fragment logic for "push "
+ or "replace " navigations, until any handlers'
+ returned promises settle. The scroll
+ option can be set to "manual " to turn
+ off any browser-driven scroll behavior entirely for this navigation, or scroll() can be called before the promise settles to
+ trigger this behavior early.
+
+ This method will throw a "SecurityError " DOMException
+ if canIntercept is false, or if isTrusted is false. It will throw an
+ "InvalidStateError " DOMException if not called
+ synchronously, during event dispatch.
event.scroll()
-
-
For "traverse " or "reload " navigations, restores the scroll position using the browser's usual scroll restoration logic.
-
- For "push " or "replace " navigations, either resets the scroll position to the top of the document or scrolls to the fragment specified by destination.url if there is one.
-
- If called more than once, or called after automatic post-transition scroll processing has happened due to the scroll option being left as "after-transition ", or called before the navigation has committed, this method will throw an "InvalidStateError " DOMException .
+ For "traverse " or "reload " navigations, restores the scroll position
+ using the browser's usual scroll restoration logic.
+
+ For "push " or "replace " navigations, either resets the scroll
+ position to the top of the document or scrolls to the fragment specified by destination.url if there is one.
+
+ If called more than once, or called after automatic post-transition scroll processing has
+ happened due to the scroll option
+ being left as "after-transition ", or called
+ before the navigation has committed, this method will throw an
+ "InvalidStateError " DOMException .
- 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.
+ 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.
- Each NavigateEvent has a focus reset behavior, a NavigationFocusReset -or-null, initially null.
+ Each NavigateEvent has a focus
+ reset behavior, a NavigationFocusReset -or-null, initially null.
- Each NavigateEvent has a scroll behavior, a NavigationScrollBehavior -or-null, initially null.
+ Each NavigateEvent has a scroll
+ behavior, a NavigationScrollBehavior -or-null, initially null.
- Each NavigateEvent has an interception state, which is either "none ", "intercepted ", "committed ", "scrolled ", or "finished ", initially "none ".
+ Each NavigateEvent has an interception state, which is either "none ", "intercepted ", "committed ",
+ "scrolled ", or "finished ", initially "none ".
- Each NavigateEvent has a navigation handler list, a list of NavigationInterceptHandler callbacks, initially empty.
+ Each NavigateEvent has a navigation handler list, a
+ list of NavigationInterceptHandler callbacks, initially empty.
The navigationType , NavigationInterceptHandler = Promise<undefined>
for="NavigateEvent">formData , downloadRequest , and info attributes must
- return the values they are initialized to.
+ for="NavigateEvent"> info attributes must return
+ the values they are initialized to.
- The intercept(options) method steps are:
+ The intercept(options) method steps
+ are:
- Perform shared checks given this.
+ Perform shared checks given
+ this.
- If this's canIntercept attribute was initialized to false, then throw a "SecurityError " DOMException .
+ If this's canIntercept
+ attribute was initialized to false, then throw a "SecurityError "
+ DOMException .
- If this's dispatch flag is unset, then throw an "InvalidStateError " DOMException .
+ If this's dispatch flag is unset, then throw an
+ "InvalidStateError " DOMException .
- Assert: this's interception state is either "none " or "intercepted ".
+ Assert: this's interception state is either "none " or "intercepted ".
- Set this's interception state to "intercepted ".
+ Set this's interception state to "intercepted ".
- If options["handler "] exists, then append it to this's navigation handler list.
+ If options["handler "] exists, then append it to this's
+ navigation handler
+ list.
-
-
If options["focusReset "] exists, then:
+ If options["focusReset "] exists, then:
- If this's focus reset behavior is not null, and it is not equal to options["focusReset "], then the user agent may report a warning to the console indicating that the focusReset option for a previous call to intercept() was overridden by this new value, and the previous value will be ignored.
+ If this's focus reset
+ behavior is not null, and it is not equal to options["focusReset "], then the user agent may
+ report a warning to the console indicating that the focusReset option for a previous call
+ to intercept() was overridden by this new
+ value, and the previous value will be ignored.
- Set this's focus reset behavior to options["focusReset "].
+ Set this's focus reset
+ behavior to options["focusReset "].
-
-
If options["scroll "] exists, then:
+ If options["scroll "]
+ exists, then:
- If this's scroll behavior is not null, and it is not equal to options["scroll "], then the user agent may report a warning to the console indicating that the scroll option for a previous call to intercept() was overridden by this new value, and the previous value will be ignored.
+ If this's scroll
+ behavior is not null, and it is not equal to options["scroll "], then the user agent may
+ report a warning to the console indicating that the scroll option for a previous call to
+ intercept() was overridden by this new value,
+ and the previous value will be ignored.
- Set this's scroll behavior to options["scroll "].
+ Set this's scroll
+ behavior to options["scroll "].
- The scroll() method steps are:
+ The scroll() method steps are:
- Perform shared checks given this.
+ Perform shared checks given
+ this.
- If this's interception state is not "committed ", then throw an "InvalidStateError " DOMException .
+ If this's interception state is not "committed ", then throw an "InvalidStateError "
+ DOMException .
Process scroll behavior given this.
- To perform shared checks for a NavigateEvent event:
+ To perform shared checks for a
+ NavigateEvent event:
- If event's relevant global object's associated Document is not fully active, then throw an "InvalidStateError " DOMException .
+ If event's relevant global object's associated Document is not fully
+ active, then throw an "InvalidStateError "
+ DOMException .
- If event's isTrusted attribute was initialized to false, then throw a "SecurityError " DOMException .
+ If event's isTrusted attribute was
+ initialized to false, then throw a "SecurityError "
+ DOMException .
- If event's canceled flag is set, then throw an "InvalidStateError " DOMException .
+ If event's canceled flag is set, then throw an
+ "InvalidStateError " DOMException .
@@ -90239,84 +91012,153 @@ interface NavigationDestination {
The URL being navigated to.
event.destination.key
- The value of the key property of the destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
+ The value of the key property of the
+ destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
event.destination.id
- The value of the id property of the destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
+ The value of the id property of the
+ destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
event.destination.index
- The value of the index property of the destination NavigationHistoryEntry , if this is a "traverse " navigation, or −1 otherwise.
+ The value of the index property of
+ the destination NavigationHistoryEntry , if this is a "traverse " navigation, or −1 otherwise.
+
event.destination.sameDocument
-
-
Indicates whether or not this navigation is to the same Document as the current one, or not. This will be true, for example, in the case of fragment navigations or history.pushState() navigations.
+ Indicates whether or not this navigation is to the same Document as the current
+ one, or not. This will be true, for example, in the case of fragment navigations or history.pushState() navigations.
- Note that this property indicates the original nature of the navigation. If a cross-document navigation is converted into a same-document navigation using navigateEvent.intercept() , that will not change the value of this property.
+ Note that this property indicates the original nature of the navigation. If a cross-document
+ navigation is converted into a same-document navigation using navigateEvent.intercept() , that will not change the
+ value of this property.
event.destination.getState()
-
-
For "traverse " navigations, returns the deserialization of the state stored in the destination session history entry.
+ For "traverse " navigations, returns the
+ deserialization of the state stored in the
+ destination session history entry.
- For "push " or "replace " navigations, returns the deserialization of the state passed to navigation.navigate() , if the navigation was initiated by that method, or undefined it if it wasn't.
+ For "push " or "replace " navigations, returns the deserialization of the state passed to navigation.navigate() , if the navigation was initiated
+ by that method, or undefined it if it wasn't.
- For "reload " navigations, returns the deserialization of the state passed to navigation.reload() , if the reload was initiated by that method, or undefined it if it wasn't.
+ For "reload " navigations, returns the deserialization of the state passed to navigation.reload() , if the reload was initiated by that
+ method, or undefined it if it wasn't.
- Each NavigationDestination has a URL, which is a URL.
+ Each NavigationDestination has a URL, which is a URL.
- Each NavigationDestination has a key, which is a string or null.
+ Each NavigationDestination has a key, which is a string or null.
- Each NavigationDestination has an ID, which is a string or null.
+ Each NavigationDestination has an ID, which is a string or null.
- Each NavigationDestination has an index, which is an integer.
+ Each NavigationDestination has an index, which is an integer.
- Each NavigationDestination has a state, which is a serialized state.
+ Each NavigationDestination has a state, which is a serialized
+ state.
- Each NavigationDestination has an is same document, which is a boolean.
+ Each NavigationDestination has an is same document, which is a
+ boolean.
- The url getter steps are to return this's URL, serialized.
+ The url getter steps are to return
+ this's URL, serialized.
- The key getter steps are to return this's key.
+ The key getter steps are to return
+ this's key.
- The id getter steps are to return this's ID.
+ The id getter steps are to return
+ this's ID.
- The index getter steps are to return this's index.
+ The index getter steps are to return
+ this's index.
- The sameDocument getter steps are to return this's is same document.
+ The sameDocument getter steps are to
+ return this's is same
+ document.
- The getState() method steps are to return StructuredDeserialize(this's state).
+ The getState() method steps are to return
+ StructuredDeserialize(this's state).
Firing the event
- Other parts of the standard fire the navigate event, through a series of wrapper algorithms given in this section.
+ Other parts of the standard fire the navigate event,
+ through a series of wrapper algorithms given in this section.
- To fire a traverse navigate event at a Navigation navigation given a session history entry destinationSHE and an optional user navigation involvement userInvolvement (default "none "):
+ To fire a traverse navigate event at a
+ Navigation navigation given a session history entry destinationSHE and an optional
+ user navigation involvement userInvolvement (default "none "):
- Let event be the result of creating an event given NavigateEvent , in navigation's relevant realm.
+ Let event be the result of creating an event given
+ NavigateEvent , in navigation's relevant realm.
- Set event's classic history API state to null.
+ Set event's classic history API state to
+ null.
- Let destination be a new NavigationDestination created in navigation's relevant realm.
+ Let destination be a new NavigationDestination
+ created in navigation's relevant
+ realm.
- Set destination's URL to destinationSHE's URL.
+ Set destination's URL
+ to destinationSHE's URL.
-
-
If destinationSHE's document state's origin is same origin with navigation's relevant settings object's origin, then:
+ If destinationSHE's document state's
+ origin is same origin with
+ navigation's relevant settings object's origin, then:
- Set destination's key to destinationSHE's navigation API key.
+ Set destination's key
+ to destinationSHE's navigation API
+ key.
- Set destination's id to destinationSHE's navigation API ID.
+ Set destination's id
+ to destinationSHE's navigation API
+ ID.
- Set destination's index to the result of getting the navigation API entry index of destinationSHE within navigation.
+ Set destination's index to the result of getting the
+ navigation API entry index of destinationSHE within
+ navigation.
- Set destination's state to destinationSHE's navigation API state.
+ Set destination's state to destinationSHE's navigation API state.
@@ -90324,95 +91166,180 @@ interface NavigationDestination {
Otherwise,
- Set destination's key to null.
+ Set destination's key
+ to null.
- Set destination's id to null.
+ Set destination's id
+ to null.
- Set destination's index to −1.
+ Set destination's index to −1.
- Set destination's state to StructuredSerializeForStorage(null).
+ Set destination's state to
+ StructuredSerializeForStorage(null).
- Set destination's is same document to true if destinationSHE's document is equal to navigation's relevant global object's associated Document ; otherwise false.
+ Set destination's is
+ same document to true if destinationSHE's document is equal to navigation's relevant global
+ object's associated Document ;
+ otherwise false.
- Return the result of performing the inner navigate event firing algorithm given navigation, "traverse ", event, destination, userInvolvement, null, and null.
+ Return the result of performing the inner navigate event firing algorithm given
+ navigation, "traverse ",
+ event, destination, userInvolvement, null, and null.
- To fire a push/replace/reload navigate event at a Navigation navigation given a NavigationType navigationType, a URL destinationURL, a boolean isSameDocument, an optional user navigation involvement userInvolvement (default "none "), an optional entry list-or-null formDataEntryList (default null), an optional serialized state navigationAPIState (default StructuredSerializeForStorage(null)), and an optional serialized state-or-null classicHistoryAPIState (default null):
+ To fire a push/replace/reload navigate event at
+ a Navigation navigation given a NavigationType navigationType, a URL destinationURL, a boolean isSameDocument, an optional user
+ navigation involvement userInvolvement (default "none "), an optional entry list-or-null formDataEntryList (default null), an
+ optional serialized state navigationAPIState (default
+ StructuredSerializeForStorage(null)), and an optional serialized
+ state-or-null classicHistoryAPIState (default
+ null):
- Let event be the result of creating an event given NavigateEvent , in navigation's relevant realm.
+ Let event be the result of creating an event given
+ NavigateEvent , in navigation's relevant realm.
- Set event's classic history API state to classicHistoryAPIState.
+ Set event's classic history API state to
+ classicHistoryAPIState.
- Let destination be a new NavigationDestination created in navigation's relevant realm.
+ Let destination be a new NavigationDestination
+ created in navigation's relevant
+ realm.
- Set destination's URL to destinationURL.
+ Set destination's URL
+ to destinationURL.
- Set destination's key to null.
+ Set destination's key
+ to null.
- Set destination's id to null.
+ Set destination's id to
+ null.
- Set destination's index to −1.
+ Set destination's index to −1.
- Set destination's state to navigationAPIState.
+ Set destination's state to
+ navigationAPIState.
- Set destination's is same document to isSameDocument.
+ Set destination's is
+ same document to isSameDocument.
- Return the result of performing the inner navigate event firing algorithm given navigation, navigationType, event, destination, userInvolvement, formDataEntryList, and null.
+ Return the result of performing the inner navigate event firing algorithm given
+ navigation, navigationType, event, destination,
+ userInvolvement, formDataEntryList, and null.
- To fire a download request navigate event at a Navigation navigation given a URL destinationURL, a user navigation involvement userInvolvement, and a string filename:
+ To fire a download request navigate event at a
+ Navigation navigation given a URL destinationURL, a user
+ navigation involvement userInvolvement, and a string
+ filename:
- Let event be the result of creating an event given NavigateEvent , in navigation's relevant realm.
+ Let event be the result of creating an event given
+ NavigateEvent , in navigation's relevant realm.
- Set event's classic history API state to null.
+ Set event's classic history API state to
+ null.
- Let destination be a new NavigationDestination created in navigation's relevant realm.
+ Let destination be a new NavigationDestination
+ created in navigation's relevant
+ realm.
- Set destination's URL to destinationURL.
+ Set destination's URL
+ to destinationURL.
- Set destination's key to null.
+ Set destination's key
+ to null.
- Set destination's id to null.
+ Set destination's id to
+ null.
- Set destination's index to −1.
+ Set destination's index to −1.
- Set destination's state to StructuredSerializeForStorage(null).
+ Set destination's state to
+ StructuredSerializeForStorage(null).
- Set destination's is same document to false.
+ Set destination's is
+ same document to false.
- Return the result of performing the inner navigate event firing algorithm given navigation, "push ", event, destination, userInvolvement, null, and filename.
+ Return the result of performing the inner navigate event firing algorithm given
+ navigation, "push ", event,
+ destination, userInvolvement, null, and filename.
- The inner navigate event firing algorithm consists of the following steps, given a Navigation navigation, a NavigationType navigationType, a NavigateEvent event, a NavigationDestination destination, a user navigation involvement userInvolvement, an entry list-or-null formDataEntryList, and a string-or-null downloadRequestFilename:
+ The inner navigate event firing algorithm
+ consists of the following steps, given a Navigation navigation, a
+ NavigationType navigationType, a NavigateEvent
+ event, a NavigationDestination destination, a user
+ navigation involvement userInvolvement, an entry list-or-null
+ formDataEntryList, and a string-or-null downloadRequestFilename:
- Promote an upcoming API method tracker to ongoing given navigation and destination's key.
+ Promote an upcoming API method tracker to ongoing given navigation
+ and destination's key.
- Let apiMethodTracker be navigation's ongoing API method tracker.
+ Let apiMethodTracker be navigation's ongoing API method
+ tracker.
-
If navigation has entries and events disabled, then:
-
-
If apiMethodTracker is not null, then clean up apiMethodTracker.
-
- In this case the committed promise and finished promise will never fulfill, since we never create a NavigationHistoryEntry object for such Document s, and so we have nothing to resolve them with.
+ If apiMethodTracker is not null, then clean up
+ apiMethodTracker.
+
+ In this case the committed promise and finished promise will never fulfill,
+ since we never create a NavigationHistoryEntry object for such
+ Document s, and so we have nothing to resolve them with.
Return true.
- Let navigable be navigation's relevant global object's navigable.
+ Let navigable be navigation's relevant global object's
+ navigable.
- Let document be navigation's relevant global object's associated Document .
+ Let document be navigation's relevant global object's
+ associated Document .
- If document can have its URL rewritten to destination's URL, and either destination's is same document is true or navigationType is not "traverse ", then initialize event's canIntercept to true. Otherwise, initialize it to false.
+ If document can have its URL rewritten to destination's
+ URL, and either destination's
+ is same document is true or
+ navigationType is not "traverse ",
+ then initialize event's canIntercept to true. Otherwise, initialize it to
+ false.
-
Let traverseCanBeCanceled be true if all of the following are true:
@@ -90420,9 +91347,12 @@ interface NavigationDestination {
navigable is a top-level traversable;
- destination's is same document is true; and
+ destination's is
+ same document is true; and
- either userInvolvement is not "browser UI ", or navigation's relevant global object has transient activation.
+ either userInvolvement is not "browser
+ UI ", or navigation's relevant global object has transient
+ activation.
Otherwise, let it be false.
@@ -90432,75 +91362,116 @@ interface NavigationDestination {
If either:
- navigationType is not "traverse "; or
+ navigationType is not "traverse "; or
traverseCanBeCanceled is true
- the initialize event's cancelable to true. Otherwise, initialize it to false.
+ the initialize event's cancelable to
+ true. Otherwise, initialize it to false.
- Initialize event's type to "navigate ".
+ Initialize event's type to "navigate ".
- Initialize event's navigationType to navigationType.
+ Initialize event's navigationType to
+ navigationType.
- Initialize event's destination to destination.
+ Initialize event's destination to destination.
- Initialize event's downloadRequest to downloadRequestFilename.
+ Initialize event's downloadRequest to
+ downloadRequestFilename.
-
-
If apiMethodTracker is not null, then initialize event's info to apiMethodTracker's info. Otherwise, initialize it to undefined.
+ If apiMethodTracker is not null, then initialize event's info to apiMethodTracker's info. Otherwise, initialize it to
+ undefined.
- At this point apiMethodTracker's info is no longer needed and can be nulled out instead of keeping it alive for the lifetime of the navigation API method tracker.
+ At this point apiMethodTracker's info is no longer needed and can be nulled
+ out instead of keeping it alive for the lifetime of the navigation API method
+ tracker.
- Initialize event's signal to a new AbortSignal created in navigation's relevant realm.
+ Initialize event's signal to a
+ new AbortSignal created in navigation's relevant realm.
- Let currentURL be document's URL.
+ Let currentURL be document's URL.
-
If all of the following are true:
- destination's is same document is true;
+ destination's is
+ same document is true;
- destination's URL equals currentURL with exclude fragments set to true; and
+ destination's URL
+ equals currentURL with exclude fragments set to true; and
- destination's URL's fragment is not identical to currentURL's fragment
+ destination's URL's
+ fragment is not identical to
+ currentURL's fragment
- then initialize event's hashChange to true. Otherwise, initialize it to false.
+ then initialize event's hashChange to true. Otherwise, initialize it to
+ false.
- If userInvolvement is not "none ", then initialize event's userInitiated to true. Otherwise, initialize it to false.
+ If userInvolvement is not "none ", then
+ initialize event's userInitiated
+ to true. Otherwise, initialize it to false.
- If formDataEntryList is not null, then initialize event's formData to a new FormData created in navigation's relevant realm, associated to formDataEntryList. Otherwise, initialize it to null.
+ If formDataEntryList is not null, then initialize event's formData to a new FormData
+ created in navigation's relevant realm,
+ associated to formDataEntryList. Otherwise, initialize it to null.
- Assert: navigation's ongoing navigate event is null.
+ Assert: navigation's ongoing navigate event is null.
- Set navigation's ongoing navigate event to event.
+ Set navigation's ongoing navigate
+ event to event.
- Assert: navigation's ongoing navigation signal is null.
+ Assert: navigation's ongoing navigation signal is
+ null.
- Set navigation's ongoing navigation signal to event's signal .
+ Set navigation's ongoing navigation signal to event's
+ signal .
- Set navigation's focus changed during ongoing navigation to false.
+ Set navigation's focus changed during ongoing navigation to
+ false.
- Set navigation's suppress normal scroll restoration during ongoing navigation to false.
+ Set navigation's suppress normal scroll restoration during ongoing
+ navigation to false.
- Let dispatchResult be the result of dispatching event at navigation.
+ Let dispatchResult be the result of dispatching event at
+ navigation.
-
If dispatchResult is false:
-
-
If event's signal is not aborted:
+ If event's signal is not aborted:
- If navigationType is "traverse ", then consume history-action user activation.
+ If navigationType is "traverse ", then consume history-action user
+ activation.
- Finalize with an aborted navigation error given navigation and apiMethodTracker.
+ Finalize with an aborted navigation error given navigation and
+ apiMethodTracker.
@@ -90508,49 +91479,111 @@ interface NavigationDestination {
- Let endResultIsSameDocument be true if event's interception state is not "none " or event's destination 's is same document is true.
+ Let endResultIsSameDocument be true if event's interception state is not "none " or event's destination 's is same document is true.
-
-
Prepare to run script given navigation's relevant settings object.
+ Prepare to run script given navigation's relevant settings
+ object.
- This is done to avoid the JavaScript execution context stack becoming empty right after any currententrychange event handlers run as a result of the URL and history update steps that could soon happen. If the stack were to become empty at that time, then it would immediately perform a microtask checkpoint, causing various promise fulfillment handlers to run interleaved with the event handlers and before any handlers passed to navigateEvent.intercept() . This is undesirable since it means promise handler ordering vs. currententrychange event handler ordering vs. intercept() handler ordering would be dependent on whether the navigation is happening with an empty JavaScript execution context stack (e.g., because the navigation was user-initiated) or with a nonempty one (e.g., because the navigation was caused by a JavaScript API call).
-
- By inserting an otherwise-unnecessary JavaScript execution context onto the stack in this step, we essentially suppress the perform a microtask checkpoint algorithm until later, thus ensuring that the sequence is always: currententrychange event handlers, then intercept() handlers, then promise handlers.
+ This is done to avoid the JavaScript execution context stack becoming empty
+ right after any currententrychange event
+ handlers run as a result of the URL and history update steps that could soon
+ happen. If the stack were to become empty at that time, then it would immediately perform
+ a microtask checkpoint, causing various promise fulfillment handlers to run interleaved
+ with the event handlers and before any handlers passed to navigateEvent.intercept() . This is undesirable
+ since it means promise handler ordering vs. currententrychange event handler ordering vs. intercept() handler ordering would be dependent on
+ whether the navigation is happening with an empty JavaScript execution context
+ stack (e.g., because the navigation was user-initiated) or with a nonempty one (e.g.,
+ because the navigation was caused by a JavaScript API call).
+
+ By inserting an otherwise-unnecessary JavaScript execution context onto the
+ stack in this step, we essentially suppress the perform a microtask checkpoint
+ algorithm until later, thus ensuring that the sequence is always: currententrychange event handlers, then intercept() handlers, then promise handlers.
-
-
If event's interception state is not "none ":
+ If event's interception
+ state is not "none ":
- Set event's interception state to "committed ".
+ Set event's interception state to "committed ".
- Let fromNHE be the current entry of navigation.
+ Let fromNHE be the current
+ entry of navigation.
Assert: fromNHE is not null.
- Set navigation's transition to a new NavigationTransition created in navigation's relevant realm, whose navigation type is navigationType, from entry is fromNHE, and whose finished promise is a new promise created in navigation's relevant realm.
+ Set navigation's transition to a new
+ NavigationTransition created in navigation's relevant realm, whose navigation type is
+ navigationType, from entry
+ is fromNHE, and whose finished
+ promise is a new promise created in navigation's relevant realm.
-
-
Mark as handled navigation's transition's finished promise.
+ Mark as handled navigation's transition's finished promise.
- See the discussion about other finished promises to understand why this is done.
+ See the discussion
+ about other finished promises to understand why this is done.
-
-
If navigationType is "traverse ", then set navigation's suppress normal scroll restoration during ongoing navigation to true.
-
- If event's scroll behavior was set to "after-transition ", then scroll restoration will happen as part of finishing the relevant NavigateEvent . Otherwise, there will be no scroll restoration. That is, no navigation which is intercepted by intercept() goes through the normal scroll restoration process; scroll restoration for such navigations is either done manually, by the web developer, or is done after the transition.
+ If navigationType is "traverse ", then set navigation's
+ suppress normal scroll restoration during ongoing navigation to true.
+
+ If event's scroll
+ behavior was set to "after-transition ", then scroll
+ restoration will happen as part of finishing the
+ relevant NavigateEvent . Otherwise, there will be no scroll restoration. That is,
+ no navigation which is intercepted by intercept() goes through the normal scroll
+ restoration process; scroll restoration for such navigations is either done manually, by the
+ web developer, or is done after the transition.
-
-
If navigationType is "push " or "replace ", then run the URL and history update steps given document and event's destination 's URL, with serialiedData set to event's classic history API state and historyHandling set to navigationType.
+ If navigationType is "push " or
+ "replace ", then run the URL and history
+ update steps given document and event's destination 's URL, with serialiedData set to event's classic history API state and
+ historyHandling set to navigationType.
- If navigationType is "reload ", then we are converting a reload into a "same-document reload", for which the URL and history update steps are not appropriate. Navigation API-related stuff still happens, such as updating the active session history entry's navigation API state if this was caused by a call to navigation.reload() , and all the ongoing navigation tracking.
-
- If navigationType is "traverse ", then this event firing is happening as part of the traversal process, and that process will take care of performing the appropriate session history entry updates.
+ If navigationType is "reload ",
+ then we are converting a reload into a "same-document reload", for which the
+ URL and history update steps are not appropriate. Navigation API-related stuff
+ still happens, such as updating the active session
+ history entry's navigation API state if
+ this was caused by a call to navigation.reload() ,
+ and all the ongoing navigation tracking.
+
+ If navigationType is "traverse ", then this event firing is happening as
+ part of the traversal process, and that
+ process will take care of performing the appropriate session history entry updates.
@@ -90563,66 +91596,113 @@ interface NavigationDestination {
Let promisesList be an empty list.
-
-
For each handler of event's navigation handler list:
+ For each handler of event's navigation handler list:
- Append the result of invoking handler with an empty arguments list to promisesList.
+ Append the result of invoking handler with an empty
+ arguments list to promisesList.
-
-
If promisesList's size is 0, then set promisesList to « a promise resolved with undefined ».
-
- There is a subtle timing difference between how waiting for all schedules its success and failure steps when given zero promises versus ≥1 promises. For most uses of waiting for all, this does not matter. However, with this API, there are so many events and promise handlers which could fire around the same time that the difference is pretty easily observable: it can cause the event/promise handler sequence to vary. (Some of the events and promises involved include: navigatesuccess / navigateerror , currententrychange , dispose , apiMethodTracker's promises, and the navigation.transition.finished promise.)
+ If promisesList's size is 0, then set
+ promisesList to « a promise resolved with undefined ».
+
+ There is a subtle timing difference between how waiting for all schedules its success and failure steps when given zero promises
+ versus ≥1 promises. For most uses of waiting for all,
+ this does not matter. However, with this API, there are so many events and promise handlers
+ which could fire around the same time that the difference is pretty easily observable: it can
+ cause the event/promise handler sequence to vary. (Some of the events and promises involved
+ include: navigatesuccess / navigateerror , currententrychange , dispose , apiMethodTracker's promises, and the navigation.transition.finished promise.)
-
Wait for all of promisesList, with the following success steps:
- If event's signal is aborted, then abort these steps.
+ If event's signal is aborted, then abort these steps.
- If event equals navigation's ongoing navigate event, then set navigation's ongoing navigate event to null.
+ If event equals navigation's ongoing navigate event, then set navigation's
+ ongoing navigate event to null.
- Finish event given true.
+ Finish event given
+ true.
- Fire an event named navigatesuccess at navigation.
+ Fire an event named navigatesuccess at navigation.
- If navigation's transition is not null, then resolve navigation's transition's finished promise with undefined.
+ If navigation's transition is not null, then resolve
+ navigation's transition's
+ finished promise with
+ undefined.
- Set navigation's transition to null.
+ Set navigation's transition to null.
- If apiMethodTracker is non-null, then resolve the finished promise for apiMethodTracker.
+ If apiMethodTracker is non-null, then resolve the finished
+ promise for apiMethodTracker.
and the following failure steps given reason rejectionReason:
- If event's signal is aborted, then abort these steps.
+ If event's signal is aborted, then abort these steps.
- Finish event given false.
-
- Fire an event named navigateerror at navigation using ErrorEvent , with error initialized to rejectionReason, and message , filename , lineno , and colno initialized to appropriate values that can be extracted from rejectionReason in the same underspecified way that the report the exception algorithm does.
-
- If navigation's transition is not null, then reject navigation's transition's finished promise with rejectionReason.
-
- Set navigation's transition to null.
+ Finish event given
+ false.
- If apiMethodTracker is non-null, then reject the finished promise for apiMethodTracker with rejectionReason.
+ Fire an event named navigateerror at navigation using
+ ErrorEvent , with error initialized to
+ rejectionReason, and message , filename , lineno , and colno initialized to appropriate
+ values that can be extracted from rejectionReason in the same underspecified way
+ that the report the exception algorithm does.
+
+ If navigation's transition is not null, then reject
+ navigation's transition's
+ finished promise with
+ rejectionReason.
+
+ Set navigation's transition to null.
+
+ If apiMethodTracker is non-null, then reject the finished
+ promise for apiMethodTracker with rejectionReason.
- Otherwise, if apiMethodTracker is non-null, then clean up apiMethodTracker.
+ Otherwise, if apiMethodTracker is non-null, then clean up
+ apiMethodTracker.
-
-
Clean up after running script given navigation's relevant settings object.
+ Clean up after running script given navigation's relevant
+ settings object.
- Per the previous note, this stops suppress any potential promise handler microtasks, causing them to run at this point or later.
+ Per the previous
+ note, this stops suppress any potential promise handler microtasks, causing them to run at
+ this point or later.
- If event's interception state is "none ", then return true.
+ If event's interception
+ state is "none ", then return true.
Return false.
@@ -90630,65 +91710,98 @@ interface NavigationDestination {
- By calling navigateEvent.intercept() , web developers can suppress the normal scroll and focus behavior for same-document navigations, instead invoking cross-document navigation-like behavior at a later time. The algorithms in this section are called at those appropriate later points.
+ By calling navigateEvent.intercept() , web
+ developers can suppress the normal scroll and focus behavior for same-document navigations,
+ instead invoking cross-document navigation-like behavior at a later time. The algorithms in this
+ section are called at those appropriate later points.
- To finish a NavigateEvent event, given a boolean didFulfill:
+ To finish a NavigateEvent
+ event, given a boolean didFulfill:
- Assert: event's interception state is not "intercepted " or "finished ".
+ Assert: event's interception state is not "intercepted " or "finished ".
- If event's interception state is "none ", then return.
+ If event's interception
+ state is "none ", then return.
Potentially reset the focus given event.
- If didFulfill is true, then potentially process scroll behavior given event.
+ If didFulfill is true, then potentially process scroll behavior
+ given event.
- Set event's interception state to "finished ".
+ Set event's interception state to "finished ".
- To potentially reset the focus given a NavigateEvent event:
+ To potentially reset the focus given a NavigateEvent
+ event:
- Assert: event's interception state is "committed " or "scrolled ".
+ Assert: event's interception state is "committed " or "scrolled ".
- Let navigation be event's relevant global object's navigation API.
+ Let navigation be event's relevant global object's
+ navigation API.
- Let focusChanged be navigation's focus changed during ongoing navigation.
+ Let focusChanged be navigation's focus changed during ongoing
+ navigation.
- Set navigation's focus changed during ongoing navigation to false.
+ Set navigation's focus changed during ongoing navigation to
+ false.
If focusChanged is true, then return.
-
-
If event's focus reset behavior is "manual ", then return.
+ If event's focus reset
+ behavior is "manual ", then
+ return.
- If it was left as null, then we treat that as "after-transition ", and continue onward.
+ If it was left as null, then we treat that as "after-transition ", and continue
+ onward.
- Let document be event's relevant global object's associated Document .
+ Let document be event's relevant global object's associated Document .
- Let focusTarget be the autofocus delegate for document.
+ Let focusTarget be the autofocus delegate for
+ document.
- If focusTarget is null, then set focusTarget to document's body element.
+ If focusTarget is null, then set focusTarget to
+ document's body element.
- If focusTarget is null, then set focusTarget to document's document element.
+ If focusTarget is null, then set focusTarget to
+ document's document element.
- Run the focusing steps for focusTarget, with document's viewport as the fallback target.
+ Run the focusing steps for focusTarget, with document's
+ viewport as the fallback target.
- Move the sequential focus navigation starting point to focusTarget.
+ Move the sequential focus navigation starting point to
+ focusTarget.
- To potentially process scroll behavior given a NavigateEvent event:
+ To potentially process scroll behavior given a NavigateEvent
+ event:
- Assert: event's interception state is "committed " or "scrolled ".
+ Assert: event's interception state is "committed " or "scrolled ".
- If event's interception state is "scrolled ", then return.
+ If event's interception
+ state is "scrolled ", then return.
-
-
If event's scroll behavior is "manual ", then return.
+ If event's scroll behavior is
+ "manual ", then return.
- If it was left as null, then we treat that as "after-transition ", and continue onward.
+ If it was left as null, then we treat that as "after-transition ", and continue
+ onward.
Process scroll behavior given event.
@@ -90697,19 +91810,31 @@ interface NavigationDestination {
To process scroll behavior given a NavigateEvent event:
- Assert: event's interception state is "committed ".
+ Assert: event's interception state is "committed ".
- Set event's interception state to "scrolled ".
+ Set event's interception state to "scrolled ".
- If event's navigationType was initialized to "traverse " or "reload ", then restore scroll position data given event's relevant global object's navigable's active session history entry.
+ If event's navigationType was initialized to "traverse " or "reload ", then restore scroll position data
+ given event's relevant global object's navigable's active session history
+ entry.
-
Otherwise:
- Let document be event's relevant global object's associated Document .
+ Let document be event's relevant global object's
+ associated Document .
- If document's indicated part is null, then scroll to the beginning of the document given document.
+ If document's indicated part is null, then scroll to the
+ beginning of the document given document.
Otherwise, scroll to the fragment given document.
@@ -90720,7 +91845,8 @@ interface NavigationDestination {
Event interfaces
- The NavigateEvent interface has its own dedicated section, due to its complexity.
+ The NavigateEvent interface has its own
+ dedicated section, due to its complexity.
The NavigationCurrentEntryChangeEvent interface
@@ -90740,19 +91866,31 @@ dictionary NavigationCurrentEntryChangeEventInit : E
event.navigationType
- Returns the type of navigation which caused the current entry to change, or null if the change is due to navigation.updateCurrentEntry() .
+ Returns the type of navigation which caused the current entry to change, or null if the
+ change is due to navigation.updateCurrentEntry() .
event.from
-
-
Returns the previous value of navigation.currentEntry , before the current entry changed.
+ Returns the previous value of navigation.currentEntry , before the current entry
+ changed.
- If navigationType is null or "reload ", then this value will be the same as navigation.currentEntry . In that case, the event signifies that the contents of the entry changed, even if we did not move to a new entry or replace the current one.
+ If navigationType
+ is null or "reload ", then this value will be the
+ same as navigation.currentEntry . In that case,
+ the event signifies that the contents of the entry changed, even if we did not move to a new
+ entry or replace the current one.
- The navigationType and from attributes must return the values they were initialized to.
+ The navigationType and from attributes must return the
+ values they were initialized to.
@@ -90919,8 +92057,8 @@ interface BeforeUnloadEvent : Event {
The returnValue attribute controls the
- process of checking if unloading is canceled. When the event is created, the
+ data-x="dom-BeforeUnloadEvent-returnValue">returnValue attribute controls the process
+ of checking if unloading is canceled. When the event is created, the
attribute must be set to the empty string. On getting, it must return the last value it was set
to. On setting, the attribute must be set to the new value.
@@ -91667,8 +92805,8 @@ interface BeforeUnloadEvent : Event {
Let toUnload be traversable's active
document's inclusive descendant navigables.
- If the result of checking if unloading is canceled for toUnload
- is true, then return.
+ If the result of checking if unloading is canceled for toUnload is
+ true, then return.
Unload the active
documents of each of toUnload. In what
@@ -91957,8 +93095,8 @@ interface BeforeUnloadEvent : Event {
popup sandboxing flag set.
- If the newly created navigable chosen is immediately navigated, then the navigation will be done as a "If the newly created navigable chosen is immediately
+ navigated, then the navigation will be done as a "replace " navigation.
@@ -93584,8 +94722,8 @@ location.href = '#foo';
After Document creation, the relevant traversable navigable's session history gets updated. The
- NavigationHistoryBehavior enumeration is used to indicate the desired type of
- session history update to the navigate algorithm. It is one of the following:
+ NavigationHistoryBehavior enumeration is used to indicate the desired type of session
+ history update to the navigate algorithm. It is one of the following:
- "
push "
@@ -93744,8 +94882,8 @@ location.href = '#foo';
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=1946 to 1955 -->
-
-
If historyHandling is "auto ", then:
+ If historyHandling is "auto ",
+ then:
If url equals
@@ -93782,8 +94920,8 @@ location.href = '#foo';
then:
- Navigate to a fragment given
- navigable, url, historyHandling, userInvolvement,
+ Navigate to a fragment given navigable,
+ url, historyHandling, userInvolvement,
navigationAPIState, and navigationId.
Return.
@@ -93884,9 +95022,9 @@ location.href = '#foo';
Let continue be the result of firing a push/replace/reload navigate
event at navigation with navigationType set to
- historyHandling, isSameDocument
- set to false, userInvolvement set to
+ data-x="fire-navigate-prr-navigationType">navigationType set to historyHandling,
+ isSameDocument set to false, userInvolvement set to
userInvolvement, formDataEntryList set to
entryListForFiring, destinationURL
@@ -94455,9 +95593,9 @@ location.href = '#foo';
To navigate to a fragment given a navigable
navigable, a URL url, a history handling behavior
- historyHandling, a user navigation involvement
- userInvolvement, a serialized state-or-null
- navigationAPIState, and a navigation ID navigationId:
+ historyHandling, a user navigation involvement userInvolvement,
+ a serialized state-or-null navigationAPIState, and a navigation
+ ID navigationId:
Let navigation be navigable's active
@@ -94470,12 +95608,11 @@ location.href = '#foo';
If navigationAPIState is not null, then set
destinationNavigationAPIState to navigationAPIState.
- Let continue be the result of firing a push/replace/reload navigate
- event at navigation with navigationType set to historyHandling,
- isSameDocument set to true, userInvolvement set to
+ Let continue be the result of firing a push/replace/reload navigate event at
+ navigation with navigationType set to
+ historyHandling, isSameDocument set
+ to true, userInvolvement set to
userInvolvement, and destinationURL
set to url, and navigationAPIState set to
@@ -94509,8 +95646,8 @@ location.href = '#foo';
data-x="she-navigation-api-state">navigation API state . (This will set it to the
serialization of undefined, if no value is provided for that option.) For other fragment
navigations, including user-initiated ones, the navigation API state is carried over from the
- previous entry.
+ data-x="she-navigation-api-state">navigation API state is carried over from the previous
+ entry.
The classic history API state is never
carried over.
@@ -94532,8 +95669,8 @@ location.href = '#foo';
data-x="concept-history-length">length.
-
-
If historyHandling is "push ", then:
+ If historyHandling is "push ",
+ then:
Set history's state to
@@ -94874,11 +96011,11 @@ location.href = '#foo';
href="#descendant-navigable-traversal-navigate-events">other traversal navigate events, which happen later.
- Additionally, because we want beforeunload
- events to fire before navigate events, this means we
- need to fire beforeunload for
- traversable here (if applicable), instead of doing it as part of the below loop
- over documentsToFireBeforeunload.
+ Additionally, because we want beforeunload events
+ to fire before navigate events, this means we need to
+ fire beforeunload for traversable here
+ (if applicable), instead of doing it as part of the below loop over
+ documentsToFireBeforeunload.
@@ -94890,14 +96027,14 @@ location.href = '#foo';
contains traversable; otherwise
false.
- If needsBeforeunload is true, then remove traversable's active
- document from documentsToFireBeforeunload.
+ If needsBeforeunload is true, then remove
+ traversable's active document from
+ documentsToFireBeforeunload.
-
-
Queue a global task on the navigation and traversal task
- source given traversable's active window
- to perform the following steps:
+ Queue a global task on the navigation and traversal task source
+ given traversable's active window to perform the
+ following steps:
-
@@ -94918,8 +96055,8 @@ location.href = '#foo';
- If finalStatus is "canceled-by-beforeunload ",
- then abort these steps.
+ If finalStatus is "canceled-by-beforeunload ", then
+ abort these steps.
Let navigation be traversable's active window's navigation
@@ -94958,9 +96095,9 @@ location.href = '#foo';
Let (unloadPromptShownForThisDocument,
- unloadPromptCanceledByThisDocument) be the result of running the steps to
- fire beforeunload given document
- and unloadPromptShown.
+ unloadPromptCanceledByThisDocument) be the result of running the steps to fire
+ beforeunload given document and
+ unloadPromptShown.
If unloadPromptShownForThisDocument is true, then set
unloadPromptShown to true.
@@ -94989,11 +96126,11 @@ location.href = '#foo';
data-x="concept-agent-event-loop">event loop's termination nesting level by
1.
- Let eventFiringResult be the result of firing an event named beforeunload at document's relevant global
- object, using BeforeUnloadEvent , with the cancelable attribute initialized to true.
+ Let eventFiringResult be the result of firing
+ an event named beforeunload at
+ document's relevant global object, using BeforeUnloadEvent ,
+ with the cancelable attribute initialized to
+ true.
Decrease document's relevant agent's event loop's termination nesting level by
@@ -95027,8 +96164,8 @@ location.href = '#foo';
relevant global object, "beforeunload ", and "".
-
-
Ask the user to confirm that they wish to unload the document, and pause
- while waiting for the user's response.
+ Ask the user to confirm that they wish to unload the document, and pause while
+ waiting for the user's response.
The message shown to the user is not customizable, but instead determined by
the user agent. In particular, the actual value of the
newValue:
- If navigable's ongoing navigation is equal to
- newValue, then return.
+ If navigable's ongoing navigation is equal to newValue,
+ then return.
Inform the navigation API about aborting navigation given
navigable.
@@ -95104,10 +96241,9 @@ location.href = '#foo';
data-x="dom-NavigationType-reload">reload", isSameDocument set to false, userInvolvement set to
- userInvolvement, and destinationURL set to navigable's
- active session history entry's URL, and userInvolvement, and destinationURL
+ set to navigable's active session history
+ entry's URL, and navigationAPIState set to
destinationNavigationAPIState.
@@ -95133,8 +96269,8 @@ location.href = '#foo';
To traverse the history by a delta given a traversable navigable
- traversable, an integer delta, and an optional Document
- sourceDocument:
+ traversable, an integer delta, and an optional Document sourceDocument:
Let sourceSnapshotParams and initiatorToCheck be null.
@@ -95245,8 +96381,8 @@ location.href = '#foo';
"replace ", otherwise null.
-
-
If historyHandling is "push ", then:
+ If historyHandling is "push ",
+ then:
Increment document's history object's
@@ -95277,10 +96413,9 @@ location.href = '#foo';
Set navigable's active session history
entry to newEntry.
- Update the entries for a same-document navigation given
- document's relevant global object's navigation API, newEntry, and
- historyHandling.
+ Update the entries for a same-document navigation given document's
+ relevant global object's navigation API,
+ newEntry, and historyHandling.
Let traversable be navigable's traversable navigable.
@@ -96488,13 +97623,13 @@ location.href = '#foo';
Now for the algorithm itself.
- To apply the traverse history step given a non-negative integer step to
- a traversable navigable traversable, with source snapshot
- params sourceSnapshotParams, navigable
- initiatorToCheck, and user navigation involvement
- userInvolvement, perform the following steps. They return either "initiator-disallowed ", "canceled-by-beforeunload ", "canceled-by-navigate ", or "applied ".
+ To apply the traverse history step given a non-negative integer step to a
+ traversable navigable traversable, with source snapshot
+ params sourceSnapshotParams, navigable initiatorToCheck,
+ and user navigation involvement userInvolvement, perform the following
+ steps. They return either "initiator-disallowed ", "canceled-by-beforeunload ", "canceled-by-navigate ", or
+ "applied ".
Return the result of applying the history
@@ -96508,8 +97643,7 @@ location.href = '#foo';
traversable, with booleans checkForCancelation and
fireNavigateEventOnCommit, source snapshot params-or-null
sourceSnapshotParams, navigable-or-null initiatorToCheck, and
- user navigation involvement-or-null
- userInvolvementForNavigateEvents:
+ user navigation involvement-or-null userInvolvementForNavigateEvents:
Assert: This is running within traversable's
For each navigable of get all
navigables whose current session history entry will change or reload: if
initiatorToCheck is not allowed by sandboxing to navigate
- navigable given sourceSnapshotParams, then return
- "initiator-disallowed ".
+ navigable given sourceSnapshotParams, then return "initiator-disallowed ".
@@ -96893,8 +98027,8 @@ location.href = '#foo';
- If navigable is not traversable, and targetEntry is not
- navigable's current session history
+ If navigable is not traversable, and targetEntry is
+ not navigable's current session history
entry, and targetEntry's document
state's origin is the same as navigable's
If targetEntry's document is equal to
displayedDocument, then perform updateDocument.
- Otherwise, queue a global task on the navigation and traversal
- task source given targetEntry's document's relevant global object to perform
- updateDocument.
+ Otherwise, queue a global task on the navigation and traversal task
+ source given targetEntry's document's
+ relevant global object to perform updateDocument.
Increment completedChangeJobs.
@@ -97363,9 +98496,8 @@ location.href = '#foo';
data-x="concept-relevant-realm">relevant realm.
Let state be StructuredDeserialize(entry's classic history API state,
- targetRealm). If this throws an exception, catch it and let state be
- null.
+ data-x="she-classic-history-api-state">classic history API state, targetRealm).
+ If this throws an exception, catch it and let state be null.
Set document's history object's state to state.
@@ -97426,8 +98558,8 @@ location.href = '#foo';
Update the entries for reactivation given document's
- relevant global object's navigation
- API, entriesForNavigationAPI, and reactivatedEntry.
+ relevant global object's navigation API,
+ entriesForNavigationAPI, and reactivatedEntry.
-
If document's current document readiness is "
If suppress normal scroll restoration during ongoing navigation is
true, then restoring scroll position data
might still happen at a later point, as part of finishing the relevant NavigateEvent , or via
- a navigateEvent.scroll() method call.
+ data-x="NavigateEvent-finish">finishing the relevant NavigateEvent , or via a
+ navigateEvent.scroll() method call.
-
@@ -99045,17 +100177,17 @@ new PaymentRequest(…); // Allowed to use
- All calls to navigate initiated by the mechanisms mentioned above must have the
- userInvolvement argument set to "All calls to navigate initiated by the mechanisms mentioned above must have the userInvolvement argument set to "browser UI ".
All calls to reload initiated by the mechanisms mentioned above must have the userInvolvement argument set to "browser UI ".
- All calls to traverse the history by a delta initiated by the mechanisms
- mentioned above must not pass a value for the sourceDocument argument.
+ All calls to traverse the history by a delta initiated by the mechanisms mentioned
+ above must not pass a value for the sourceDocument
+ argument.
@@ -117209,11 +118341,11 @@ dictionary StorageEventInit : EventInit {
the new encoding and the confidence to
certain. Whenever possible, this should be done without actually contacting the network
layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not
- being cacheable. If this is not possible and contacting the network layer would involve
- repeating a request that uses a method other than `GET `, then instead set
- the confidence to certain and ignore
- the new encoding. The resource will be misinterpreted. User agents may notify the user of the
- situation, to aid in application development.
+ being cacheable. If this is not possible and contacting the network layer would involve repeating
+ a request that uses a method other than ` GET `, then instead set the confidence to certain and ignore the new
+ encoding. The resource will be misinterpreted. User agents may notify the user of the situation,
+ to aid in application development.
This algorithm is only invoked when a new encoding is found declared on a
From e4c0b453367f4f9ea12232d59db8a883929f311d Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 17:07:03 +0900
Subject: [PATCH 14/30] Add IPR and ack
---
source | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/source b/source
index 7dac64d811f..3640937bd3f 100644
--- a/source
+++ b/source
@@ -138138,6 +138138,7 @@ INSERT INTERFACES HERE
Mustaq Ahmed,
Myles Borins,
Nadia Heninger,
+ Nate Chapin,
NARUSE Yui,
Navid Zolghadr,
Neil Deakin,
@@ -138647,6 +138648,13 @@ INSERT INTERFACES HERE
href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">W3C Software and
Document License.
+ Part of the revision history of the navigation API feature can be found in the WICG/navigation-api
+ repository, which is available under the W3C Software and
+ Document License.
+
Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0
International License. To the extent portions of it are incorporated into source code, such
From 79c21045d65823d494269107063cd32c87a6e070 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Mon, 6 Mar 2023 17:23:08 +0900
Subject: [PATCH 15/30] Remove new CSS
A whatwg.org PR is out
---
source | 4 ----
1 file changed, 4 deletions(-)
diff --git a/source b/source
index 3640937bd3f..f091bc5f88e 100644
--- a/source
+++ b/source
@@ -44,10 +44,6 @@
link.hash = location.hash;
}
-
From 20c36583cdb4c57700d15bab1619caafb9347cbf Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Fri, 10 Mar 2023 17:03:06 +0900
Subject: [PATCH 16/30] Fixes to child navigable destruction
Similar to https://chromium-review.googlesource.com/c/chromium/src/+/4313039
---
source | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/source b/source
index f091bc5f88e..9e2f8f0efa5 100644
--- a/source
+++ b/source
@@ -89980,16 +89980,15 @@ interface NavigationHistoryEntry : EventTarget
When result is "canceled-by-beforeunload " or "initiator-disallowed ", the navigate
- event was never fired, finalizing
- with an aborted navigation error would not be correct; it would result in a aborting the ongoing
+ navigation would not be correct; it would result in a navigateerror event without a preceding navigate event.
In the "canceled-by-navigate " case, navigate is fired, but the inner navigate event firing algorithm will take care of finalizing with an aborted navigation
- error.
+ data-x="event-navigate">navigate event firing algorithm will take care of
+ aborting the ongoing navigation.
@@ -90431,9 +90430,8 @@ const p2 = navigation.navigate(url2).finished;
apiMethodTracker.
- To finalize with an aborted navigation error given a Navigation
- navigation, a navigation API method tracker or null
- apiMethodTracker, and an optional DOMException error:
+ To abort the ongoing navigation given a Navigation
+ navigation and an optional DOMException error:
Set navigation's focus changed during ongoing navigation to
@@ -90489,8 +90487,9 @@ const p2 = navigation.navigate(url2).finished;
0.
- If apiMethodTracker is non-null, then reject the finished promise
- for apiMethodTracker with error.
+ If navigation's ongoing API method tracker is non-null, then
+ reject the finished promise for apiMethodTracker with
+ error.
-
If navigation's transition is
@@ -90524,8 +90523,7 @@ const p2 = navigation.navigate(url2).finished;
If navigation's ongoing navigation signal is null, then
return.
- Finalize with an aborted navigation error given navigation and
- navigation's ongoing API method tracker.
+ Abort the ongoing navigation given navigation.
To inform the navigation API about child navigable destruction given a
@@ -90542,8 +90540,10 @@ const p2 = navigation.navigate(url2).finished;
navigation's upcoming traverse API method trackers.
For each apiMethodTracker of
- traversalAPIMethodTrackers: finalize with an aborted navigation error
- given navigation and apiMethodTracker.
+ traversalAPIMethodTrackers: reject the finished promise for
+ apiMethodTracker with a new "AbortError "
+ DOMException created in navigation's relevant realm.
@@ -91466,8 +91466,7 @@ interface NavigationDestination {
data-x="dom-NavigationType-traverse">traverse", then consume history-action user
activation.
- Finalize with an aborted navigation error given navigation and
- apiMethodTracker.
+ Abort the ongoing navigation given navigation.
From c031deb6e596457068789babdddbef23ca0c9875 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Tue, 14 Mar 2023 18:10:37 +0900
Subject: [PATCH 17/30] Adapt code cleanup from Chromium
https://chromium-review.googlesource.com/c/chromium/src/+/4316506
---
source | 62 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 41 insertions(+), 21 deletions(-)
diff --git a/source b/source
index 9e2f8f0efa5..ec4a426e862 100644
--- a/source
+++ b/source
@@ -89715,12 +89715,18 @@ interface NavigationHistoryEntry : EventTarget
data-x="dom-NavigationOptions-info">info"], if it exists;
otherwise, undefined.
- Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for
- this given info and serializedState.
+ Let apiMethodTracker be the result of maybe setting the upcoming non-traverse API method
+ tracker for this given info and
+ serializedState.
-
-
Navigate document's node navigable to urlRecord using document, with historyHandling set to options["history "] and navigationAPIState set to serializedState.
+ Navigate document's node
+ navigable to urlRecord using document, with historyHandling set to options["history "] and navigationAPIState set to
+ serializedState.
Unlike location.assign() and friends,
which are exposed across origin-domain boundaries,
@@ -89802,9 +89808,10 @@ interface NavigationHistoryEntry : EventTarget
data-x="dom-NavigationOptions-info">info"], if it exists;
otherwise, undefined.
- Let apiMethodTracker be the result of setting the upcoming non-traverse API method tracker for
- this given info and serializedState.
+ Let apiMethodTracker be the result of maybe setting the upcoming non-traverse API method
+ tracker for this given info and
+ serializedState.
Reload document's node navigable with navigationAPIState set to
@@ -90155,9 +90162,9 @@ const p2 = navigation.navigate(url2).finished;
All this state is then managed via the following algorithms.
- To set the upcoming non-traverse API method tracker given a Navigation
- navigation, a JavaScript value info, and a serialized
- state-or-null serializedState:
+ To maybe set the upcoming non-traverse API method tracker given a
+ Navigation navigation, a JavaScript value info, and a
+ serialized state-or-null serializedState:
Let committedPromise and finishedPromise be new promises created in
@@ -90220,8 +90227,19 @@ const p2 = navigation.navigate(url2).finished;
Assert: navigation's upcoming non-traverse API method
tracker is null.
- Set navigation's upcoming non-traverse API method tracker to
- apiMethodTracker.
+ -
+
If navigation does not have
+ entries and events disabled, then set navigation's upcoming
+ non-traverse API method tracker to apiMethodTracker.
+
+ If navigation has entries and events disabled, then
+ committedPromise and finishedPromise will never fulfill (since we never
+ create a NavigationHistoryEntry object for such Document s, and so we
+ have nothing to resolve them with); there is no NavigationHistoryEntry to apply
+ serializedState to; and there is no navigate
+ event to include info with. So, we don't need to track this API method call after
+ all.
+
Return apiMethodTracker.
@@ -91308,15 +91326,17 @@ interface NavigationDestination {
-
-
If apiMethodTracker is not null, then clean up
- apiMethodTracker.
-
- In this case the committed promise and finished promise will never fulfill,
- since we never create a NavigationHistoryEntry object for such
- Document s, and so we have nothing to resolve them with.
+ Assert: apiMethodTracker is null.
+
+ This assertion holds because traverseTo() , back() , and forward() cannot be called when entries and events are
+ disabled (since there are no entries to traverse to), and if our starting point is instead
+ navigate() or reload() , then we avoided setting the
+ upcoming non-traverse API method tracker in the first place.
Return true.
From 5a7db73b8969ba49a8eeeb98e1e826d87bd746a7 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Sun, 19 Mar 2023 20:51:09 +0900
Subject: [PATCH 18/30] Easy fixes
---
source | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/source b/source
index ec4a426e862..418917f1294 100644
--- a/source
+++ b/source
@@ -76777,11 +76777,11 @@ END:VCARD
The last activation timestamp and last history-action
activation timestamp are retained even after the Document changes its
- fully active status (e.g. after navigating away from a Document , or
+ fully active status (e.g., after navigating away from a Document , or
navigating to a cached Document ). This means sticky activation state
spans multiple navigations as long as the same Document gets reused. For the
transient activation state, the original expiry time
- remains unchanged (i.e. the state still expires within the transient activation
+ remains unchanged (i.e., the state still expires within the transient activation
duration limit from the original activation triggering input event). It is
important to consider this when deciding whether to base certain things off sticky
activation or transient activation.
@@ -88702,7 +88702,7 @@ interface History {
The navigation API
The navigation API, provided by the global navigation
- object, provides a modern and web application-focused way of managing same-origin
+ property, provides a modern and web application-focused way of managing same-origin
same-navigable history entries and navigations. Its entry point is the
Navigation interface:
@@ -89632,7 +89632,7 @@ interface NavigationHistoryEntry : EventTarget
{ committed, finished } = navigation.back(key, { info })
-
Traverses to the closest previous session history entry which results in this
- navigable traversing, i.e. which corresponds to a different
+ navigable traversing, i.e., which corresponds to a different
NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the
@@ -89651,7 +89651,7 @@ interface NavigationHistoryEntry : EventTarget
{ committed, finished } = navigation.forward(key, { info })
-
Traverses to the closest forward session history entry which results in this
- navigable traversing, i.e. which corresponds to a different
+ navigable traversing, i.e., which corresponds to a different
NavigationHistoryEntry and thus will cause navigation.currentEntry to change. info can be set to any value; it will populate the
@@ -90012,11 +90012,11 @@ interface NavigationHistoryEntry : EventTarget
rejected with e ]».
A navigation API method tracker-derived result for a navigation API method
- tracker is a NavigationResult dictionary instance given by «[
- apiMethodTracker's committed
- promise, "finished " →
- apiMethodTracker's finished
- promise ]».
+ tracker is a NavigationResult dictionary instance given by «[ "committed " apiMethodTracker's committed promise, "finished " → apiMethodTracker's finished promise ]».
@@ -90133,7 +90133,7 @@ const p2 = navigation.navigate(url2).finished;
The state here that is not stored in navigation API method trackers is state which needs to be tracked even for
- navigations that are not via navigation API methods.
+ navigations that are not initiated via navigation API methods.
A navigation API method tracker is a struct with the following items:
@@ -90670,7 +90670,7 @@ interface NavigateEvent : Event {
constructor(DOMString type, NavigateEventInit eventInitDict);
readonly attribute NavigationType navigationType;
- readonly attribute NavigationDestination destination;
+ readonly attribute NavigationDestination destination;
readonly attribute boolean canIntercept;
readonly attribute boolean userInitiated;
readonly attribute boolean hashChange;
@@ -90685,7 +90685,7 @@ interface NavigateEvent : Event {
dictionary NavigateEventInit : EventInit {
NavigationType navigationType = " push";
- required NavigationDestination destination;
+ required NavigationDestination destination;
boolean canIntercept = false;
boolean userInitiated = false;
boolean hashChange = false;
@@ -94760,7 +94760,7 @@ location.href = '#foo';
A history handling behavior is a NavigationHistoryBehavior that is
either "push " or "replace ", i.e. that has been resolved away from
+ data-x="NavigationHistoryBehavior-replace">replace", i.e., that has been resolved away from
any initial "auto " value.
The navigation must be a replace, given a URL url and a
From 0252d6da08da68f1c3d6458e790207199524caeb Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 22 Mar 2023 11:17:13 +0900
Subject: [PATCH 19/30] Cancelable traversals logic fix
Follows https://chromium-review.googlesource.com/c/chromium/src/+/4357920
---
source | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/source b/source
index 418917f1294..964bb9fd2df 100644
--- a/source
+++ b/source
@@ -91477,18 +91477,13 @@ interface NavigationDestination {
If dispatchResult is false:
- -
-
If event's signal is not aborted:
-
-
- If navigationType is "traverse ", then consume history-action user
- activation.
+ If navigationType is "traverse ", then consume history-action user
+ activation.
- Abort the ongoing navigation given navigation.
-
-
+ If event's signal is not
+ aborted, then abort the ongoing
+ navigation given navigation.
Return false.
From 2249652d4e1f2031af290a146106852efc2db521 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 22 Mar 2023 14:43:39 +0900
Subject: [PATCH 20/30] Slight simplification and invariant fix, again
Follows https://chromium-review.googlesource.com/c/chromium/src/+/4355034
---
source | 104 +++++++++++++++++++++++++++------------------------------
1 file changed, 49 insertions(+), 55 deletions(-)
diff --git a/source b/source
index 964bb9fd2df..9c1d6675ff1 100644
--- a/source
+++ b/source
@@ -90112,9 +90112,6 @@ const p2 = navigation.navigate(url2).finished;
Ongoing navigate event, a
NavigateEvent or null, initially null.
- Ongoing navigation signal, an AbortSignal or null, initially
- null.
-
Focus changed during ongoing navigation, a boolean, initially false.
Suppress normal scroll restoration during ongoing navigation, a boolean,
@@ -90452,6 +90449,11 @@ const p2 = navigation.navigate(url2).finished;
navigation and an optional DOMException error:
+ Let event be navigation's ongoing navigate event.
+
+ Assert: event is not null.
+
Set navigation's focus changed during ongoing navigation to
false.
@@ -90462,29 +90464,14 @@ const p2 = navigation.navigate(url2).finished;
"AbortError " DOMException created in
navigation's relevant realm.
- -
-
If navigation's ongoing navigate
- event is non-null, then:
-
-
- Set navigation's ongoing navigate
- event's canceled flag to true.
-
- Set navigation's ongoing navigate
- event to null.
-
-
+ If event's dispatch flag is set, then set event's
+ canceled flag to true.
- -
-
If navigation's ongoing navigation signal is non-null, then:
+ Signal abort on event's signal given error.
-
- Signal abort on navigation's ongoing navigation
- signal given error.
-
- Set navigation's ongoing navigation signal to null.
-
-
+ Set navigation's ongoing navigate
+ event to null.
-
Fire an event named
Let navigation be navigable's active
window's navigation API.
- If navigation's ongoing navigation signal is null, then
- return.
+ If navigation's ongoing navigate
+ event is null, then return.
Abort the ongoing navigation given navigation.
@@ -91314,35 +91301,40 @@ interface NavigationDestination {
formDataEntryList, and a string-or-null downloadRequestFilename:
- Promote an upcoming API method tracker to ongoing given navigation
- and destination's key.
-
- Let apiMethodTracker be navigation's ongoing API method
- tracker.
-
-
If navigation has entries and events disabled, then:
- -
-
Assert: apiMethodTracker is null.
-
- This assertion holds because traverseTo() , back() , and forward() cannot be called when entries and events are
- disabled (since there are no entries to traverse to), and if our starting point is instead
- navigate() or reload() , then we avoided setting the
- upcoming non-traverse API method tracker in the first place.
-
+ Assert: navigation's ongoing API method tracker is
+ null.
+
+ Assert: navigation's upcoming non-traverse API method
+ tracker is null.
+
+ Assert: navigation's upcoming traverse API method
+ trackers is empty.
Return true.
+
+ These assertions holds because traverseTo() , back() , and forward() will immediately fail when entries and events
+ are disabled (since there are no entries to traverse to), and if our starting point is instead
+ navigate() or reload() , then we avoided setting the
+ upcoming non-traverse API method tracker in the first place.
+ Promote an upcoming API method tracker to ongoing given navigation
+ and destination's key.
+
+ Let apiMethodTracker be navigation's ongoing API method
+ tracker.
+
Let navigable be navigation's relevant global object's
navigable.
@@ -91457,12 +91449,6 @@ interface NavigationDestination {
Set navigation's ongoing navigate
event to event.
- Assert: navigation's ongoing navigation signal is
- null.
-
- Set navigation's ongoing navigation signal to event's
- signal .
-
Set navigation's focus changed during ongoing navigation to
false.
@@ -91640,9 +91626,11 @@ interface NavigationDestination {
If event's signal is aborted, then abort these steps.
- If event equals navigation's ongoing navigate event, then set navigation's
- ongoing navigate event to null.
+ Assert: event equals navigation's ongoing
+ navigate event.
+
+ Set navigation's ongoing navigate event to null.
Finish event given
true.
@@ -91669,6 +91657,12 @@ interface NavigationDestination {
If event's signal is aborted, then abort these steps.
+ Assert: event equals navigation's ongoing
+ navigate event.
+
+ Set navigation's ongoing navigate event to null.
+
Finish event given
false.
From 338d450a2a99bd453b86cb462fa035ada6b1d778 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 22 Mar 2023 15:38:45 +0900
Subject: [PATCH 21/30] Address Jake's review
---
source | 68 +++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/source b/source
index 9c1d6675ff1..ca3c55839c0 100644
--- a/source
+++ b/source
@@ -88909,7 +88909,7 @@ enum NavigationHistoryBehavior {
Initializing and updating the entry list
- To initialize the entries for a new Navigation given a
+ To initialize the navigation API entries for a new document given a
Navigation navigation, a list of session history entries newSHEs, and a session history
entry initialSHE:
@@ -88938,6 +88938,11 @@ enum NavigationHistoryBehavior {
Append newNHE to navigation's
entry list.
+
+ newSHEs will have originally come from getting session history
+ entries for the navigation API, and thus each newSHE will be contiguous same origin with
+ initialSHE.
Set navigation's current entry
@@ -88945,10 +88950,10 @@ enum NavigationHistoryBehavior {
initialSHE within navigation.
- To update the entries for reactivation given a Navigation
- navigation, a list of session history
- entries newSHEs, and a session history entry
- reactivatedSHE:
+ To update the navigation API entries for reactivation given a
+ Navigation navigation, a list of session history entries newSHEs, and a session history
+ entry reactivatedSHE:
If navigation has entries and events disabled, then
@@ -88995,6 +89000,11 @@ enum NavigationHistoryBehavior {
newNHEs.
+ newSHEs will have originally come from getting session history
+ entries for the navigation API, and thus each newSHE will be contiguous same origin with
+ reactivatedSHE.
+
By the end of this loop, all NavigationHistoryEntry s that remain in
oldNHEs represent session history entries
which have been disposed while the Document was in NavigationHistoryBehavior {
- To update the entries for a same-document navigation given a Navigation
- navigation, a session history entry destinationSHE, and a
- NavigationType navigationType:
+ To update the navigation API entries for a same-document navigation given a
+ Navigation navigation, a session history entry
+ destinationSHE, and a NavigationType navigationType:
If navigation has entries and events disabled, then
@@ -89066,8 +89076,8 @@ enum NavigationHistoryBehavior {
This algorithm is only called for same-document traversals. Cross-document
- traversals will instead call either initialize the entries for a new
- Navigation or update the entries for reactivation.
+ traversals will instead call either initialize the navigation API entries for a new
+ document or update the navigation API entries for reactivation.
-
@@ -89171,6 +89181,12 @@ enum NavigationHistoryBehavior {
settings object.
+ In implementations, same-document navigations can cause session history entries to be disposed by falling off the back of the
+ session history entry list. This is not yet handled by the above algorithm (or by any other part
+ of this standard). See issue #8620 to
+ track progress on defining the correct behavior in such cases.
+
@@ -89209,7 +89225,7 @@ interface NavigationHistoryEntry : EventTarget
data-x="dom-NavigationType-replace">replace" navigations, and will survive reloads and
session restores.
- This is useful for navigating back to this entry in the navigation hisotyr list, using This is useful for navigating back to this entry in the navigation history list, using navigation.traverseTo(key) .
@@ -94993,20 +95009,20 @@ location.href = '#foo';
-
-
If all of the following are false:
+ If all of the following are true:
- userInvolvement is "browser
+ userInvolvement is not "browser
UI ";
navigable's active document's origin is not same origin-domain with
+ data-x="concept-document-origin">origin is same origin-domain with
sourceDocument's origin;
navigable's active document's is
- initial about:blank ; and
+ initial about:blank is false; and
- url's scheme is not a fetch
+ url's scheme is a fetch
scheme
@@ -95702,7 +95718,7 @@ location.href = '#foo';
untouched, and no events are fired.
- Update the entries for a same-document navigation given
+ Update the navigation API entries for a same-document navigation given
navigation, historyEntry, and historyHandling.
-
@@ -96417,9 +96433,10 @@ location.href = '#foo';
Set navigable's active session history
entry to newEntry.
- Update the entries for a same-document navigation given document's
- relevant global object's navigation API,
- newEntry, and historyHandling.
+ Update the navigation API entries for a same-document navigation given
+ document's relevant global object's navigation API, newEntry, and
+ historyHandling.
Let traversable be navigable's traversable navigable.
@@ -98419,7 +98436,7 @@ location.href = '#foo';
If documentIsNew is false, then:
- Update the entries for a same-document navigation given
+ Update the navigation API entries for a same-document navigation given
navigation, entry, and "traverse ".
@@ -98455,7 +98472,7 @@ location.href = '#foo';
Restore persisted state given entry.
- Initialize the entries for a new Navigation given
+ Initialize the navigation API entries for a new document given
navigation, entriesForNavigationAPI, and entry.
@@ -98561,9 +98578,10 @@ location.href = '#foo';
- Update the entries for reactivation given document's
- relevant global object's navigation API,
- entriesForNavigationAPI, and reactivatedEntry.
+ Update the navigation API entries for reactivation given
+ document's relevant global object's navigation API, entriesForNavigationAPI, and
+ reactivatedEntry.
-
If document's current document readiness is "
Date: Wed, 22 Mar 2023 15:52:28 +0900
Subject: [PATCH 22/30] Restrictions on user navigation involvement
Also quoted all instances of event.type comparison...
---
source | 68 +++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/source b/source
index ca3c55839c0..c8eeddb4f98 100644
--- a/source
+++ b/source
@@ -76820,12 +76820,18 @@ END:VCARD
data-x="dom-Event-type">type is one of:
- keydown , provided the key is neither the Esc key nor a
- shortcut key reserved by the user agent.
- mousedown .
- pointerdown , provided the event's pointerType is "mouse".
- pointerup , provided the event's pointerType is not "mouse".
- touchend .
+ - "
keydown ", provided the key is neither the
+ Esc key nor a shortcut key reserved by the user agent.
+
+ - "
mousedown ".
+
+ - "
pointerdown ", provided the event's
+ pointerType is "mouse ".
+
+ - "
pointerup ", provided the event's
+ pointerType is not "mouse ".
+
+ - "
touchend ".
Activation consuming APIs defined in this and
@@ -82661,13 +82667,13 @@ dictionary DragEventInit : MouseEventInit {
Let document be target's node document.
If event is a PointerEvent and event's type is pointerdown , then:
- set document's popover pointerdown target to the result of running
+ data-x="dom-Event-type">type is "pointerdown ",
+ then: set document's popover pointerdown target to the result of running
topmost clicked popover given target.
-
If event is a PointerEvent and event's type is pointerup ,
+ data-x="dom-Event-type">type is "pointerup ",
then:
@@ -94808,10 +94814,21 @@ location.href = '#foo';
For convenience at certain call sites, the user navigation
- involvement for an Event is defined to be "activation " if event's isTrusted is initialized to true, and "none " otherwise.
+ involvement for an Event event is defined as follows:
+
+
+ Assert: this algorithm is being called as part of an activation
+ behavior definition.
+
+ Assert: event's type is
+ "click ".
+
+ If event's isTrusted is initialized
+ to true, then return "activation ".
+
+ Return "none ".
+
+
Beginning navigation
@@ -106323,7 +106340,7 @@ import "https://example.com/foo/../module2.mjs";
Let special error event handling be true if event is an
ErrorEvent object, event's type is
- error , and event's error ", and event's currentTarget implements the
WindowOrWorkerGlobalScope mixin. Otherwise, let special error event
handling be false.
@@ -106371,8 +106388,8 @@ import "https://example.com/foo/../module2.mjs";
- If event is a
BeforeUnloadEvent object and event's type is beforeunload
+ data-x="dom-Event-type">type is "beforeunload "
+
The navigation API, provided by the global navigation
- property, provides a modern and web application-focused way of managing same-origin
- same-navigable history entries and navigations. Its entry point is the
- Navigation interface:
+ property, provides a modern and web application-focused way of managing navigations and history entries. It is a successor to the classic location and history APIs.
+
+ One ability the API provides is inspecting session history entries. For example, the following will display the entries' URLs in an ordered list:
+
+ const ol = document.createElement("ol");
+ol.start = 0; // so that the list items' ordinal values match up with the entry indices
+
+for (const entry of navigation.entries()) {
+ const li = document.createElement("li");
+
+ if (entry.index < navigation.currentEntry.index) {
+ li.className = "backward";
+ } else if (entry.index > navigation.currentEntry.index) {
+ li.className = "forward";
+ } else {
+ li.className = "current";
+ }
+
+ li.textContent = entry.url;
+ ol.append(li);
+}
+
+ The navigation.entries() array contains NavigationHistoryEntry instances, which have other useful properties in addition to the url and index properties shown here. Note that the array only contains NavigationHistoryEntry objects that represent the current navigable, and thus its contents are not impacted by navigations inside navigable containers such as iframe s, or by navigations of the parent navigable in cases where the navigation API is itself being used inside an iframe . Additionally, it only contains NavigationHistoryEntry objects representing same-origin session history entries, meaning that if the user has visited other origins before or after the current one, there will not be corresponding NavigationHistoryEntry s.
+
+
+
+ The navigation API can also be used to navigate, reload, or traverse through the history:
+
+ <button onclick="navigation.reload()">Reload</button>
+
+<input type="url" id="navigationURL">
+<button onclick="navigation.navigate(navigationURL.value)">Navigate</button>
+
+<button id="backButton" onclick="navigation.back()">Back</button>
+<button id="forwardButton" onclick="navigation.forward()">Forward</button>
+
+<select id="traversalDestinations"></select>
+<button id="goButton" onclick="navigation.traverseTo(traversalDestinations.value)">Traverse To</button>
+
+<script>
+backButton.disabled = !navigation.canGoBack;
+forwardButton.disabled = !navigation.canGoForward;
+
+for (const entry of navigation.entries()) {
+ traversalDestinations.append(new Option(entry.url, entry.key));
+}
+</script>
+
+ Note that traversals are again limited to same-origin destinations, meaning that, for example, navigation.canGoBack will be false if the previous session history entry is for a page from another origin.
+
+
+
+ The most powerful part of the navigation API is the navigate event, which fires whenever almost any navigation or traversal occurs in the current navigable:
+
+ navigation.onnavigate = event => {
+ console.log(event.navigationType); // "push", "replace", "reload", or "traverse"
+ console.log(event.destination.url);
+ console.log(event.userInitiated);
+ // ... and other useful properties
+};
+
+ (The event will not fire for location bar-initiated navigations, or navigations initiated from other windows, when the destination of the navigation is a new document.)
+
+ Much of the time, the event's cancelable property will be true, meaning this event can be canceled using preventDefault() :
+
+ navigation.onnavigate = event => {
+ if (event.cancelable && isDisallowedURL(event.destination.url)) {
+ alert(`Please don't go to ${event.destination.url}!`);
+ event.preventDefault();
+ }
+};
+
+
+ The cancelable property will be false for some "traverse " navigations, such as those taking place inside child navigables, those crossing to new origins, or when the user attempts to traverse again shortly after a previous call to preventDefault() prevented them from doing so.
+
+ The NavigateEvent 's intercept() method allows intercepting a navigation and converting it into a same-document navigation:
+
+ navigation.addEventListener("navigate", e => {
+ // Some navigations, e.g. cross-origin navigations, we cannot intercept.
+ // Let the browser handle those normally.
+ if (!e.canIntercept) {
+ return;
+ }
+
+ // Similarly, don't intercept fragment navigations or downloads.
+ if (e.hashChange || e.downloadRequest !== null) {
+ return;
+ }
+
+ const url = new URL(event.destination.url);
+
+ if (url.pathname.startsWith("/articles/")) {
+ e.intercept({
+ async handler() {
+ // The URL has already changed, so show a placeholder while
+ // fetching the new content, such as a spinner or loading page.
+ renderArticlePagePlaceholder();
+
+ // Fetch the new content and display when ready.
+ const articleContent = await getArticleContent(url.pathname, { signal: e.signal });
+ renderArticlePage(articleContent);
+ }
+ });
+ }
+});
+
+ Note that the handler function can return a promise to represent the asynchronous progress, and success or failure, of the navigation. While the promise is still pending, browser UI can treat the navigation as ongoing (e.g., by presenting a loading spinner). Other parts of the navigation API are also sensitive to these promises, such as the return value of navigation.navigate() :
+
+ const { committed, finished } = await navigation.navigate("/articles/the-navigation-api-is-cool");
+
+// The committed promise will fulfill once the URL has changed, which happens
+// immediately (as long as the NavigateEvent wasn't canceled).
+await committed;
+
+// The finished promise will fulfill once the Promise returned by handler() has
+// fulfilled, which happens once the article is downloaded and rendered. (Or,
+// it will reject, if handler() fails along the way).
+await finished;
+
+ The Navigation inteface
+
+
[Exposed=Window]
interface Navigation : EventTarget {
@@ -88980,8 +89103,6 @@ enum NavigationHistoryBehavior {
"replace"
};
-
-
Each Window has an associated navigation
API, which is a Navigation object. Upon creation of the Window
object, its navigation API must be set to a
@@ -100387,9 +100508,9 @@ new PaymentRequest(…); // Allowed to use
Browser user interface
considerations
- Browser user agents should provide the ability to navigate, reload,
- and stop loading any top-level traversable in their
- top-level traversable set.
+ Browser user agents should provide the ability to navigate, reload, and stop loading
+ any top-level traversable in their top-level traversable set.
For example, via a location bar and reload/stop button UI.
@@ -100424,8 +100545,9 @@ new PaymentRequest(…); // Allowed to use
Browser user agents may provide ways for the user to explicitly cause any
- navigable (not just a top-level traversable) to navigate,
- reload, or stop loading.
+ navigable (not just a top-level traversable) to navigate, reload, or stop
+ loading.
For example, via a context menu.
From aaf168b281911f0ef635e215ef2cff34007fb5a4 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Wed, 12 Apr 2023 12:49:21 +0900
Subject: [PATCH 28/30] Share more infrastructure between NavigationDestination
and NavigationHistoryEntry
Follows https://chromium-review.googlesource.com/c/chromium/src/+/4406494.
---
source | 210 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 122 insertions(+), 88 deletions(-)
diff --git a/source b/source
index 53fbe5ce458..cc9c876a620 100644
--- a/source
+++ b/source
@@ -89186,8 +89186,8 @@ enum NavigationHistoryBehavior {
To get the navigation API entry
- index of a string navigationAPIId within a Navigation
- navigation:
+ index of a session history entry she within a
+ Navigation navigation:
Let index be 0.
@@ -89197,9 +89197,8 @@ enum NavigationHistoryBehavior {
data-x="navigation-entry-list">entry list:
- If nhe's session history entry's navigation API ID is equal to
- navigationAPIId, then return index.
+ If nhe's session history entry is equal to
+ she, then return index.
Increment index by 1.
@@ -89292,8 +89291,7 @@ enum NavigationHistoryBehavior {
Set navigation's current entry
index to the result of getting the navigation API entry index of
- initialSHE's navigation API ID within
- navigation.
+ initialSHE within navigation.
To update the navigation API entries for reactivation given a
@@ -89361,8 +89359,7 @@ enum NavigationHistoryBehavior {
Set navigation's current entry
index to the result of getting the navigation API entry index of
- reactivatedSHE's navigation API ID within
- navigation.
+ reactivatedSHE within navigation.
-
Queue a global task on the navigation and traversal task source
@@ -89416,8 +89413,7 @@ enum NavigationHistoryBehavior {
Set navigation's current entry
index to the result of getting the navigation API entry index of
- destinationSHE's navigation API ID
- within navigation.
+ destinationSHE within navigation.
Assert: navigation's current entry index is not −1.
@@ -89619,6 +89615,47 @@ interface NavigationHistoryEntry : EventTarget
Each NavigationHistoryEntry has an associated session
history entry, which is a session history entry.
+ The key of a
+ NavigationHistoryEntry nhe is given by the return value of the following
+ algorithm:
+
+
+ If nhe's relevant global object's associated Document is not fully
+ active, then return the empty string.
+
+ Return nhe's session history entry's navigation API key.
+
+
+ The ID of a
+ NavigationHistoryEntry nhe is given by the return value of the following
+ algorithm:
+
+
+ If nhe's relevant global object's associated Document is not fully
+ active, then return the empty string.
+
+ Return nhe's session history entry's navigation API ID.
+
+
+ The index of a
+ NavigationHistoryEntry nhe is given by the return value of the following
+ algorithm:
+
+
+ If nhe's relevant global object's associated Document is not fully
+ active, then return −1.
+
+ Return the result of getting the navigation API entry index of
+ this's session history entry within
+ this's relevant global object's navigation API.
+
+
The url getter steps are:
@@ -89643,43 +89680,16 @@ interface NavigationHistoryEntry : EventTarget
The key getter steps are:
-
-
- If this's relevant global object's associated Document is not fully
- active, then return the empty string.
-
- Return this's session history entry's navigation API key.
-
+ data-x="dom-NavigationHistoryEntry-key">key getter steps are to return
+ this's key.
The id getter steps are:
-
-
- If this's relevant global object's associated Document is not fully
- active, then return the empty string.
-
- Return this's session history entry's navigation API ID.
-
+ data-x="dom-NavigationHistoryEntry-id">id getter steps are to return
+ this's ID.
The index getter steps are:
-
-
- If this's relevant global object's associated Document is not fully
- active, then return the empty string.
-
- Return the result of getting the navigation API entry index of
- this's session history entry's navigation API ID within this's
- relevant global object's navigation
- API.
-
+ data-x="dom-NavigationHistoryEntry-index">index getter steps are to return
+ this's index.
The sameDocument getter steps are:
@@ -91366,8 +91376,8 @@ callback NavigationInterceptHandler = Promise<undefined>
[Exposed=Window]
interface NavigationDestination {
readonly attribute USVString url;
- readonly attribute DOMString? key;
- readonly attribute DOMString? id;
+ readonly attribute DOMString key;
+ readonly attribute DOMString id;
readonly attribute long long index;
readonly attribute boolean sameDocument;
@@ -91381,12 +91391,12 @@ interface NavigationDestination {
event.destination.key
The value of the key property of the
destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
+ data-x="dom-NavigationType-traverse">traverse " navigation, or the empty string otherwise.
event.destination.id
The value of the id property of the
destination NavigationHistoryEntry , if this is a "traverse " navigation, or null otherwise.
+ data-x="dom-NavigationType-traverse">traverse" navigation, or the empty string otherwise.
event.destination.index
The value of the index property of
@@ -91430,11 +91440,12 @@ interface NavigationDestination {
Each NavigationDestination has a URL, which is a URL.
- Each NavigationDestination has a key, which is a string or null.
-
Each NavigationDestination has an ID, which is a string or null.
+ data-x="concept-NavigationDestination-entry">entry, which is a
+ NavigationHistoryEntry or null.
+
+ It will be non-null if and only if the NavigationDestination
+ corresponds to a "traverse " navigation.
Each NavigationDestination has a state, which is a serialized
@@ -91444,23 +91455,48 @@ interface NavigationDestination {
data-x="concept-NavigationDestination-sameDocument">is same document, which is a
boolean.
+
+
The url getter steps are to return
this's URL, serialized.
The key getter steps are to return
- this's key.
+ data-x="dom-NavigationDestination-key">key getter steps are:
+
+
+ If this's entry is
+ null, then return the empty string.
+
+ Return this's entry's key.
+
The id getter steps are to return
- this's ID.
+ data-x="dom-NavigationDestination-id">id getter steps are:
+
+
+ If this's entry is
+ null, then return the empty string.
+
+ Return this's entry's ID.
+
The index getter steps are to return the result
- of getting the navigation API entry index of this's ID within navigation.
+ data-x="dom-NavigationDestination-index">index getter steps are:
+
+
+ If this's entry is
+ null, then return −1.
+
+ Return this's entry's index.
+
The sameDocument getter steps are to
@@ -91501,20 +91537,18 @@ interface NavigationDestination {
Set destination's URL
to destinationSHE's URL.
+ Let destinationNHE be the NavigationHistoryEntry in
+ navigation's entry list whose session history entry is destinationSHE, or null if no such
+ NavigationHistoryEntry exists.
+
-
-
If destinationSHE's document state's
- origin is same origin with
- navigation's relevant settings object's origin, then:
+ If destinationNHE is non-null, then:
- Set destination's key
- to destinationSHE's navigation API
- key.
-
- Set destination's id
- to destinationSHE's navigation API
- ID.
+ Set destination's entry to
+ destinationNHE.
Set destination's state to destinationSHE's NavigationDestination {
Otherwise,
- Set destination's key
- to null.
-
- Set destination's id
- to null.
+ Set destination's entry to null.
Set destination's state to
@@ -91582,11 +91613,8 @@ interface NavigationDestination {
Set destination's URL
to destinationURL.
- Set destination's key
- to null.
-
- Set destination's id to
- null.
+ Set destination's entry to null.
Set destination's state to
@@ -91624,11 +91652,8 @@ interface NavigationDestination {
Set destination's URL
to destinationURL.
- Set destination's key
- to null.
-
- Set destination's id to
- null.
+ Set destination's entry to null.
Set destination's state to
@@ -91678,9 +91703,18 @@ interface NavigationDestination {
upcoming non-traverse API method tracker in the first place.
- Promote an upcoming API method tracker to ongoing given navigation
- and destination's key.
+ Let destinationKey be null.
+
+ If destination's entry is non-null, then set
+ destinationKey to destination's entry's key.
+
+ Assert: destinationKey is not the empty string.
+
+ Promote an upcoming API method tracker to ongoing given
+ navigation and destinationKey.
Let apiMethodTracker be navigation's ongoing API method
tracker.
From 0818829233c088225d00a40eb8fba83bdbc4f9a8 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Fri, 28 Apr 2023 09:56:39 +0900
Subject: [PATCH 29/30] Found a typo
---
source | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source b/source
index cc9c876a620..669852102f5 100644
--- a/source
+++ b/source
@@ -89931,7 +89931,7 @@ interface NavigationHistoryEntry : EventTarget
the server (and thus do not actually navigate), both promises will never settle.
- In all cases ,when the returned promises fulfill, it will be with the
+ In all cases, when the returned promises fulfill, it will be with the
NavigationHistoryEntry that was navigated to.
From 40c167d7ee9e4a68fab47037833030870607a554 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Thu, 22 Jun 2023 11:52:37 +0900
Subject: [PATCH 30/30] Don't use AbortSignal/signal abort
---
source | 62 +++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 24 deletions(-)
diff --git a/source b/source
index 9381f0fa862..4bee4030b09 100644
--- a/source
+++ b/source
@@ -3246,9 +3246,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
is value
MutationObserver interface and mutation observers in general
+ AbortController and its
+ signal
AbortSignal
- aborted
- - signal abort
+ - signal abort
- The get an attribute by name algorithm
@@ -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
|