Skip to content

Commit 0b273ea

Browse files
authored
Correct unload event timing for different COOP
Sometimes a navigation causes a BCG swap, e.g. when the cross-origin isolated capability changes. In that case: * The timestamps should coarsened based on both documents. * Some user-agents unload in parallel, which should not become part of the new document's timing info. * Time origin should be according to the new global's time origin, but coarsened by both. Closes w3c/navigation-timing#169.
1 parent b85aac6 commit 0b273ea

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

source

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90144,7 +90144,8 @@ new PaymentRequest(…); // Allowed to use
9014490144

9014590145
<li>
9014690146
<p><span data-x="unload a document">Unload</span> <var>previousDocument</var> with
90147-
<var>unloadTimingInfo</var>.</p>
90147+
<var>unloadTimingInfo</var> and <var>newDocument</var>'s
90148+
<span>relevant global object</span>.</p>
9014890149

9014990150
<p>If this instance of the <span data-x="navigate">navigation</span> algorithm is canceled while
9015090151
this step is running the <span>unload a document</span> algorithm, then the <span>unload a
@@ -90154,6 +90155,11 @@ new PaymentRequest(&hellip;); // Allowed to use
9015490155
execution occurring as part of unloading the document or its descendants.)</p>
9015590156
</li>
9015690157

90158+
<li><p>If <var>newDocument</var>'s <span>event loop</span> is not <var>previousDocument</var>'s
90159+
<span>event loop</span>, then the user agent may <span data-x="unload a document">unload</span>
90160+
<var>previousDocument</var> <span>in parallel</span>, In that case, the user agent should set
90161+
<var>unloadTimingInfo</var> to null.</p></li>
90162+
9015790163
<li><p>If <var>navigationParams</var>'s <span
9015890164
data-x="navigation-params-has-cross-origin-redirects">has cross-origin redirects</span> is false,
9015990165
and <var>newDocument</var>'s <span data-x="concept-document-origin">origin</span> is the <span
@@ -91429,8 +91435,9 @@ dictionary <dfn dictionary>PageTransitionEventInit</dfn> : <span>EventInit</span
9142991435
</ol>
9143091436

9143191437
<p>To <dfn export data-x="unload a document" data-lt="unload a document">unload</dfn> a
91432-
<code>Document</code> <var>document</var>, given an optional <var>recursiveFlag</var> and a
91433-
<span>document unload timing info</span>-or-null <var>unloadTimingInfo</var> (default null):</p>
91438+
<code>Document</code> <var>document</var>, given an optional <var>recursiveFlag</var>, a
91439+
<span>document unload timing info</span>-or-null <var>unloadTimingInfo</var> (default null),
91440+
and an optional <span>global object</span> <var>newGlobal</var>:</p>
9143491441

9143591442
<ol>
9143691443
<li><p>Increase the <span>event loop</span>'s <span>termination nesting level</span> by
@@ -91457,11 +91464,14 @@ dictionary <dfn dictionary>PageTransitionEventInit</dfn> : <span>EventInit</span
9145791464
<li><p><span>Update the visibility state</span> of <var>newDocument</var> to
9145891465
"<code data-x="">hidden</code>".</p></li>
9145991466
</ol>
91460-
</li>
91467+
</li>
9146191468

9146291469
<li><p>If <var>unloadTimingInfo</var> is not null, then set <var>unloadTimingInfo</var>'s
9146391470
<span>unload event start time</span> to the <span>current high resolution time</span> given
91464-
<var>document</var>'s <span>relevant global object</span>.</p></li>
91471+
<var>newGlobal</var>, <span data-x="coarsen time">coarsened</span> given <var>document</var>'s
91472+
<span>relevant settings object</span>'s <span
91473+
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
91474+
capability</span>.</p></li>
9146591475

9146691476
<li><p>If <var>document</var>'s <i data-x="concept-document-salvageable">salvageable</i> state is
9146791477
false, then <span data-x="concept-event-fire">fire an event</span> named
@@ -91470,7 +91480,10 @@ dictionary <dfn dictionary>PageTransitionEventInit</dfn> : <span>EventInit</span
9147091480

9147191481
<li><p>If <var>unloadTimingInfo</var> is not null, then set <var>unloadTimingInfo</var>'s
9147291482
<span>unload event end time</span> to the <span>current high resolution time</span> given
91473-
<var>document</var>'s <span>relevant global object</span>.</p></li>
91483+
<var>newGlobal</var>, <span data-x="coarsen time">coarsened</span> given <var>document</var>'s
91484+
<span>relevant settings object</span>'s <span
91485+
data-x="concept-settings-object-cross-origin-isolated-capability">cross-origin isolated
91486+
capability</span>.</p></li>
9147491487

9147591488
<li><p>Decrease the <span>event loop</span>'s <span>termination nesting level</span> by
9147691489
one.</p></li>

0 commit comments

Comments
 (0)