Skip to content

Commit

Permalink
Revert to doing unloading steps *after* pagehide
Browse files Browse the repository at this point in the history
This change reverts 386360c (#3957).
Specifically, it reorders two steps in the “unload a document” algorithm such
that the spec once again requires UAs to wait to run any “unloading document
visibility change steps” from other applicable specifications (in particular,
the Page Visibility spec) until *after* firing the pagehide event.

In practice, in combination with requirements in the Page Visibility spec,
this change has the effect of stating that UAs must wait to fire the
visibilitychange event until after the pagehide event has fired. That
ordering matches the behavior current implemented in all engines.

Otherwise, without this change, the ordering of firing for the events
doesn’t match what implementations actually do.

See also:
* w3c/page-visibility#39
* #5949 (comment)
  • Loading branch information
sideshowbarker committed Oct 1, 2020
1 parent 210b6ea commit 94c1b70
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -85279,20 +85279,21 @@ dictionary <dfn>PageTransitionEventInit</dfn> : <span>EventInit</span> {

<li><p>Set <var>document</var>'s <span>page showing</span> flag to false.</p></li>

<li>
<p>Run any <dfn>unloading document visibility change steps</dfn> for <var>document</var> that
are defined by <span>other applicable specifications</span>.</p>

<p class="note">This is specifically intended for use by <cite>Page Visibility</cite>. <ref spec=PAGEVIS></p>
</li>

<li><p><span data-x="concept-event-fire">Fire an event</span> named <code
data-x="event-pagehide">pagehide</code> at <var>document</var>'s <span>relevant global
object</span>, using <code>PageTransitionEvent</code>, with the <code
data-x="dom-PageTransitionEvent-persisted">persisted</code> attribute initialized to true if
<var>document</var>'s <i data-x="concept-document-salvageable">salvageable</i> state is
true, and false otherwise, and <var>legacy target override flag</var> set.</p></li>

<li>
<p>Run any <dfn>unloading document visibility change steps</dfn> for <var>document</var> that
are defined by <span>other applicable specifications</span>.</p>

<p class="note">This is specifically intended for use by <cite>Page Visibility</cite>.
<ref spec=PAGEVIS></p>
</li>

<li><p><i>Unload event</i>: If <var>document</var>'s <span>fired unload</span> flag is
false, then <span data-x="concept-event-fire">fire an event</span> named <code
data-x="event-unload">unload</code> at <var>document</var>'s <span>relevant global object</span>,
Expand Down

0 comments on commit 94c1b70

Please sign in to comment.