Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework handling of fully active status #276

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 57 additions & 39 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1268,53 +1268,71 @@ <h3>Notify Pressure Observers</h3>
</ol>
</section>
<section>
<h3>Handling change of fully active</h3>
<h3>Handling change of [=Document/fully active=] status</h3>
<p>
When a {{Document}} |document| is no longer [=Document/fully active=],
deactivate [=data delivery=] of data of all [=supported source types=] to |document|'s [=relevant global object=].
This specification defines the following [=unloading document cleanup
steps=] given a {{Document}} |document|:
</p>
<p>
When a worker with associated {{WorkerGlobalScope}} |relevantGlobal| is no longer
an <a href="https://html.spec.whatwg.org/multipage/workers.html#active-needed-worker">
active needed workers</a>,
deactivate [=data delivery=] of data of all [=supported source types=] to |relevantGlobal|.
</p>
<p>
When a {{Document}} |document| becomes [=Document/fully active=],
for each non-[=list/empty=] [=registered observer list=] associated the [=source type=] |source|,
activate [=data delivery=] of |source| data to |document|'s [=relevant global object=].
</p>
<p>
When a worker with associated {{WorkerGlobalScope}} |relevantGlobal| becomes
an <a href="https://html.spec.whatwg.org/multipage/workers.html#active-needed-worker">
active needed workers</a>,
for each non-[=list/empty=] [=registered observer list=] associated the [=source type=] |source|,
activate [=data delivery=] of |source| data to |document|'s [=relevant global object=].
<ol class="algorithm">
<li>
Let |relevantGlobal| be |document:Document|'s [=relevant global
object=].
</li>
<li>
[=list/For each=] |source| [=map/key=] of the [=registered observer
list=] [=ordered map=]:
<ol>
<li>
Deactivate [=data delivery=] of |source| to |relevantGlobal|.
</li>
</ol>
</li>
</ol>
<p class="issue" data-number="275">
This specification previously included steps covering the case of a
{{Document}} becoming [=Document/fully active=] again (i.e. integration
with {{Document}}'s [=Document/reactivate=] steps). Those steps have been
removed while the intended behavior is discussed.
</p>
</section>

<section>
<h3>Handling changes to worker status</h3>

<aside class="note">
When a document is no longer [=Document/fully active=] (or associated workers no longer
<a href="https://html.spec.whatwg.org/multipage/workers.html#active-needed-worker">
active needed workers</a>), like when
entering the back/forward cache, or "BFCache" for short, then no events are send to the pressure observers
(see [=may receive data=])
in accordance with <a href="https://www.w3.org/TR/design-principles/#listen-fully-active">
Web Platform Design Principles: Listen for changes to fully active status</a>. This means that the
system can safely deactivate [=data delivery=] from the associated [=platform collector=],
but also that it needs to be re-activated when the opposite happens.
<p>
This section is similar to the above, but for workers, which do not
have an equivalent for the [=unloading document cleanup steps=].
</p>
</aside>
</section>

<section id="unload-observers">
<h3>Handle unloading document and closing of workers</h3>
<p>
When a worker with associated {{WorkerGlobalScope}} |relevantGlobal|,
once |relevantGlobal|'s [=WorkerGlobalScope/closing=] flag is set to true,
deactivate [=data delivery=] for all [=supported source types=] to |relevantGlobal|.
</p>
<!--
Note: the steps below do not properly fit into the the process model for
Workers in the HTML spec (i.e. they are not specifically invoked from one
or more locations).

The WebDriver BiDi spec does something similar with different language
that can serve as inspiration:
https://w3c.github.io/webdriver-bidi/#event-script-realmDestroyed
-->

<p>
As one of the [=unloading document cleanup steps=] given {{Document}} |document|,
deactivate [=data delivery=] for all [=supported source types=] to |document|'s [=relevant global object=].
Whenever a {{WorkerGlobalScope}} |relevantGlobal|'s
[=WorkerGlobalScope/closing=] flag is set to true, perform the following
steps:
</p>

<ol class="algorithm">
<li>
[=list/For each=] |source| [=map/key=] of |relevantGlobal|'s
[=registered observer list=] [=ordered map=]:
<ol>
<li>
Deactivate [=data delivery=] of |source| to |relevantGlobal|.
</li>
</ol>
</li>
</ol>
</section>
</section>
</section> <!-- Pressure Observer -->
Expand Down
Loading