Skip to content

Commit cbe7e06

Browse files
committed
Make algo better
1 parent 3768a29 commit cbe7e06

File tree

1 file changed

+77
-48
lines changed

1 file changed

+77
-48
lines changed

source

Lines changed: 77 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -101349,10 +101349,9 @@ interface <dfn interface>NavigationDestination</dfn> {
101349101349
<span>StructuredSerializeForStorage</span>(null)), an optional <span>serialized
101350101350
state</span>-or-null <dfn
101351101351
data-x="fire-navigate-prr-classicHistoryAPIState"><var>classicHistoryAPIState</var></dfn> (default
101352-
null), an optional <span>navigation API method tracker</span>-or-null <dfn
101353-
data-x="fire-navigate-prr-api-method-tracker"><var>apiMethodTracker</var></dfn> (default null),
101354-
and a list <dfn data-x="fire-navigate-prr-defer-commit-promise-list">deferCommitPromiseList</dfn>
101355-
(default an empty list):</p>
101352+
null), and an optional <span>navigation API method tracker</span>-or-null <dfn
101353+
data-x="fire-navigate-prr-api-method-tracker"><var>apiMethodTracker</var></dfn> (default
101354+
null):</p>
101356101355

101357101356
<ol>
101358101357
<li><p>Let <var>document</var> be <var>navigation</var>'s <span>relevant global object</span>'s <span
@@ -101393,9 +101392,6 @@ interface <dfn interface>NavigationDestination</dfn> {
101393101392
data-x="concept-NavigateEvent-classic-history-API-state">classic history API state</span> to
101394101393
<var>classicHistoryAPIState</var>.</p></li>
101395101394

101396-
<li><p>Set <var>event</var>'s <span>deferred commit promise list</span> to
101397-
<var>deferCommitPromiseList</var>.</p></li>
101398-
101399101395
<li><p>Let <var>destination</var> be a <span>new</span> <code>NavigationDestination</code>
101400101396
created in <var>navigation</var>'s <span data-x="concept-relevant-realm">relevant
101401101397
realm</span>.</p></li>
@@ -106441,8 +106437,6 @@ location.href = '#foo';</code></pre>
106441106437
<var>navigationAPIState</var> is not null; otherwise,
106442106438
<span>StructuredSerializeForStorage</span>(undefined).</p></li>
106443106439

106444-
<li><p>Let <var>deferCommitPromiseList</var> be an empty list.</p></li>
106445-
106446106440
<li><p>Let <var>continue</var> be the result of <span data-x="fire a push/replace/reload
106447106441
navigate event">firing a push/replace/reload <code data-x="event-navigate">navigate</code>
106448106442
event</span> at <var>navigation</var> with <i
@@ -106454,11 +106448,9 @@ location.href = '#foo';</code></pre>
106454106448
data-x="fire-navigate-prr-formDataEntryList">formDataEntryList</i> set to
106455106449
<var>entryListForFiring</var>, <i data-x="fire-navigate-prr-destinationURL">destinationURL</i>
106456106450
set to <var>url</var>, <i data-x="fire-navigate-prr-navigationAPIState">navigationAPIState</i>
106457-
set to <var>navigationAPIStateForFiring</var>, <i
106451+
set to <var>navigationAPIStateForFiring</var>, and <i
106458106452
data-x="fire-navigate-prr-api-method-tracker">apiMethodTracker</i> set to
106459-
<var>apiMethodTracker</var>, and <i
106460-
data-x="fire-navigate-prr-defer-commit-promise-list">deferCommitPromiseList</i> set to
106461-
<var>deferCommitPromiseList</var>.</p></li>
106453+
<var>apiMethodTracker</var>.</p></li>
106462106454

106463106455
<li><p>If <var>continue</var> is false, then return.</p>
106464106456
</ol>
@@ -106470,29 +106462,9 @@ location.href = '#foo';</code></pre>
106470106462
data-x="navigate-fragid">navigate to a fragment</span> path.</p>
106471106463
</li>
106472106464

106473-
<li><p>Let <var>proceedWithCommit</var> be false.</p></li>
106474-
106475-
<li><p><span>Wait for all</span> <var>deferCommitPromiseList</var> with the following steps as
106476-
both the success and failure step: set <var>proceedWithCommit</var> to true.</p></li>
106477-
106478-
<li>
106479-
<p>Let <var>waitForCommitDeferringConditions</var> be the following steps:</p>
106480-
106481-
<ol>
106482-
<li><p><span>Assert</span>: this is running <span>in parallel</span>.</p></li>
106483-
106484-
<li>
106485-
<p>Wait until any of the following becomes true:</p>
106486-
106487-
<ul>
106488-
<li><p><var>proceedWithCommit</var> is true; or</p></li>
106489-
106490-
<li><p><var>navigable</var>'s <span>ongoing navigation</span> changes to no longer equal
106491-
<var>navigationId</var>.</p></li>
106492-
</ul>
106493-
</li>
106494-
</ol>
106495-
</li>
106465+
<li><p>Let <var>shouldDeferCommit</var> be true if <var>navigation</var>'s <span>ongoing <code
106466+
data-x="event-navigate">navigate</code> event</span>'s <span>deferred commit promise list</span>
106467+
is non-empty; Otherwise false.</p></li>
106496106468

106497106469
<li><p>If <var>sourceDocument</var> is <var>navigable</var>'s <span
106498106470
data-x="nav-container-document">container document</span>, then <span>reserve deferred fetch
@@ -106683,9 +106655,8 @@ location.href = '#foo';</code></pre>
106683106655
<var>targetSnapshotParams</var>, <var>userInvolvement</var>, <var>navigationId</var>,
106684106656
<var>navigationParams</var>, <var>cspNavigationType</var>, with <i
106685106657
data-x="attempt-to-populate-allow-post">allowPOST</i> set to true, <i
106686-
data-x="attempt-to-populate-wait-for-commit-deferring-conditions">waitForCommitDeferringConditions</i>
106687-
set to <var>waitForCommitDeferringConditions</var>, and <i
106688-
data-x="attempt-to-populate-completion-steps">completionSteps</i> set to the following
106658+
data-x="attempt-to-populate-defer-commit">deferCommit</i> set to <var>shouldDeferCommit</var>,
106659+
and <i data-x="attempt-to-populate-completion-steps">completionSteps</i> set to the following
106689106660
step:</p>
106690106661

106691106662
<ol>
@@ -108062,10 +108033,9 @@ location.href = '#foo';</code></pre>
108062108033
(default null), an optional <span>navigation params</span>-or-null <var>navigationParams</var>
108063108034
(default null), an optional string <var>cspNavigationType</var> (default "<code
108064108035
data-x="">other</code>"), an optional boolean <dfn
108065-
data-x="attempt-to-populate-allow-post"><var>allowPOST</var></dfn> (default false), optional
108066-
algorithm steps <dfn
108067-
data-x="attempt-to-populate-wait-for-commit-deferring-conditions"><var>waitForCommitDeferringCondition</var></dfn>
108068-
(default an empty algorithm), and optional algorithm steps <dfn
108036+
data-x="attempt-to-populate-allow-post"><var>allowPOST</var></dfn> (default false), an optional
108037+
boolean <dfn data-x="attempt-to-populate-defer-commit"><var>deferCommit</var></dfn> (default
108038+
false), and optional algorithm steps <dfn
108069108039
data-x="attempt-to-populate-completion-steps"><var>completionSteps</var></dfn> (default an empty
108070108040
algorithm):</p>
108071108041

@@ -108147,16 +108117,33 @@ location.href = '#foo';</code></pre>
108147108117
</ol>
108148108118
</li>
108149108119

108150-
<li><p>Call <var>waitForCommitDeferringConditions</var>.</p></li>
108151-
108152-
<li id="process-a-navigate-response">
108153-
<p><span>Queue a global task</span> on the <span>navigation and traversal task source</span>,
108154-
given <var>navigable</var>'s <span>active window</span>, to run these steps:</p>
108120+
<li>
108121+
<p>Let <dfn data-x="process a navigate response"><var>processNavigateResponse</var></dfn> be to
108122+
<span>queue a global task</span> on the <span>navigation and traversal task source</span>, given
108123+
<var>navigable</var>'s <span>active window</span>, to run these steps:</p>
108155108124

108156108125
<ol>
108157108126
<li><p>If <var>navigable</var>'s <span>ongoing navigation</span> no longer equals
108158108127
<var>navigationId</var>, then run <var>completionSteps</var> and abort these steps.</p></li>
108159108128

108129+
<li>
108130+
<p>If <var>shouldDeferCommit</var> is true, then:</p>
108131+
108132+
<ol>
108133+
<li>
108134+
<p><span>Potentially defer commit</span> given <var>navigable</var>,
108135+
<var>navigationId</var>, and the following steps:</p>
108136+
108137+
<ol>
108138+
<li><p>Set <var>shouldDeferCommit</var> to false.</p></li>
108139+
108140+
<li><p>Call <var>processNavigateResponse</var>.</p></li>
108141+
</ol>
108142+
</li>
108143+
<li><p>Abort these steps.</p></li>
108144+
</ol>
108145+
</li>
108146+
108160108147
<li>
108161108148
<p>Let <var>saveExtraDocumentState</var> be true.</p>
108162108149

@@ -109175,6 +109162,48 @@ location.href = '#foo';</code></pre>
109175109162
</ol>
109176109163
</div>
109177109164

109165+
<div algorithm>
109166+
<p>To <dfn>potentially defer commit</dfn> given a <span>navigable</span> <var>navigable</var>, a
109167+
<span>navigation ID</span> <var>navigationID</var>, and an algorithm <var>proceed</var>:</p>
109168+
109169+
<ol>
109170+
<li><p>Let <var>document</var> be <var>navigable</var>'s <span data-x="nav-document">active
109171+
document</span>.</p></li>
109172+
109173+
<li>
109174+
<p><span>Queue a task</span> on the <span>DOM manipulation task source</span> given
109175+
<var>document</var>'s <span>releant global object</span> to run the steps:</p>
109176+
109177+
<ol>
109178+
<li><p>If <var>navigable</var> <span>ongoing navigation</span> is not <var>navigationID</var>,
109179+
then call <var>proceed</var> and abort these steps.</p></li>
109180+
109181+
<li><p>Let <var>didProceed</var> be false.</p></li>
109182+
109183+
<li>
109184+
<p>Let <var>done</var> be the steps:</p>
109185+
109186+
<ol>
109187+
<li><p>If <var>didProceed</var> is false, call <var>proceed</var>.</p></li>
109188+
109189+
<li><p>Set <var>didProceed</var> to false.</p></li>
109190+
</ol>
109191+
</li>
109192+
109193+
<li><p>Let <var>event</var> be <var>document</var>'s <span>relevant global object</span>'s
109194+
<span data-x="window-navigation-api">navigation API</span>'s <span>ongoing <code
109195+
data-x="event-navigate">navigate</code> event</span>.</p></li>
109196+
109197+
<li><p><span>Wait for all</span> <var>event</var>'s <span>deferred commit promise list</span>,
109198+
with <var>done</var> as the success and failure steps.</p></li>
109199+
109200+
<li><p><span data-x="AbortSignal-add">Add</span> <var>done</var> to <var>event</var>'s <code
109201+
data-x="dom-NavigateEvent-signal">signal</code>.</p></li>
109202+
</ol>
109203+
</li>
109204+
</ol>
109205+
</div>
109206+
109178109207
<div algorithm>
109179109208
<p>An element has a <dfn>browsing context scope origin</dfn> if its <code>Document</code>'s
109180109209
<span>node navigable</span> is a <span>top-level traversable</span> or if all of its

0 commit comments

Comments
 (0)