Skip to content

Commit

Permalink
Correct unload event timing for different COOP
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
noamr committed May 31, 2022
1 parent b85aac6 commit 0b273ea
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -90144,7 +90144,8 @@ new PaymentRequest(…); // Allowed to use

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

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

<li><p>If <var>newDocument</var>'s <span>event loop</span> is not <var>previousDocument</var>'s
<span>event loop</span>, then the user agent may <span data-x="unload a document">unload</span>
<var>previousDocument</var> <span>in parallel</span>, In that case, the user agent should set
<var>unloadTimingInfo</var> to null.</p></li>

<li><p>If <var>navigationParams</var>'s <span
data-x="navigation-params-has-cross-origin-redirects">has cross-origin redirects</span> is false,
and <var>newDocument</var>'s <span data-x="concept-document-origin">origin</span> is the <span
Expand Down Expand Up @@ -91429,8 +91435,9 @@ dictionary <dfn dictionary>PageTransitionEventInit</dfn> : <span>EventInit</span
</ol>

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

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

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

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

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

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

0 comments on commit 0b273ea

Please sign in to comment.