Skip to content
Closed
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
59 changes: 18 additions & 41 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -123423,8 +123423,8 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope

<hr>

<p>A <code>WorkerGlobalScope</code> <var>global</var> is <dfn data-x="active needed
worker">actively needed</dfn> if the following algorithm returns true:</p>
<p id="protected-worker">A <code>WorkerGlobalScope</code> <var>global</var> is <dfn data-x="active
needed worker">actively needed</dfn> if the following algorithm returns true:</p>

<ol>
<li>
Expand All @@ -123443,25 +123443,6 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
<li><p>Return false.</p></li>
</ol>

<p>A <code>WorkerGlobalScope</code> <var>global</var> is <dfn data-x="protected
worker">protected</dfn> if the following algorithm returns true:</p>

<ol>
<li><p>If <var>global</var> is not <span data-x="active needed worker">actively needed</span>,
then return false.</p></li>

<li><p>If <var>global</var> is a <code>SharedWorkerGlobalScope</code>, then return true.</p></li>

<li><p>If <var>global</var>'s <span>the worker's ports</span> is not <span data-x="list is
empty">empty</span>, then return true.</p></li>

<li><p>If <var>global</var> has outstanding timers, database transactions, or network
connections, then return true.</p></li>
<!-- TODO: would be nice to make the above rigorous. -->

<li><p>Return false.</p></li>
</ol>

<p>A <code>WorkerGlobalScope</code> <var>global</var> is <dfn data-x="permissible
worker">permissible</dfn> if the following algorithm returns true:</p>

Expand Down Expand Up @@ -123508,33 +123489,29 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope

<ul>
<li><p>Workers get <a href="#step-closing-orphan-workers">closed as orphans</a> between when
they stop being <span data-x="protected worker">protected</span> and when they stop being <span
data-x="permissible worker">permissible</span>.</p></li>

<li><p>Workers get <a href="#step-suspending-workers">suspended or un-suspended</a> based on
whether they are <span data-x="suspendable worker">suspendable</span>.</p></li>
they stop being <span data-x="active needed worker">actively needed</span> and when they stop
being <span data-x="permissible worker">permissible</span>.</p></li>

<li><p>Workers that have been closed, but keep executing, <a
href="#terminate-rampant-workers">can be terminated</a> at the user agent's discretion, once
they stop being <span data-x="active needed worker">actively needed</span>.</p></li>
</ul>

<p>Note that every <code>WorkerGlobalScope</code> that is <span data-x="active needed
worker">actively needed</span> is <span data-x="protected worker">protected</span>, and every
<code>WorkerGlobalScope</code> that is <span data-x="protected worker">protected</span> is <span
data-x="permissible worker">permissible</span>. (But the converses do not hold.)</p>
<li><p>Workers get <a href="#step-suspending-workers">suspended or un-suspended</a> based on
whether they are <span data-x="suspendable worker">suspendable</span>.</p></li>
</ul>

<p>An important difference between <span data-x="protected worker">protected</span> and <span
data-x="permissible worker">permissible</span> is that a <code>WorkerGlobalScope</code> is <span
data-x="protected worker">protected</span> only if its transitive set of owners contains at least
one <span>fully active</span> <code>Document</code>, whereas a <code>WorkerGlobalScope</code> can
be <span data-x="permissible worker">permissible</span> even if all the <code>Document</code>s in
its transitive set of owners are in <a href="#note-bfcache">bfcache</a>.</p>
<p>An important difference between <span data-x="active needed worker">actively needed</span> and
<span data-x="permissible worker">permissible</span> is that a <code>WorkerGlobalScope</code> is
<span data-x="active needed worker">actively needed</span> only if its transitive set of owners
contains at least one <span>fully active</span> <code>Document</code>, whereas a
<code>WorkerGlobalScope</code> can be <span data-x="permissible worker">permissible</span> even
if all the <code>Document</code>s in its transitive set of owners are in <a
href="#note-bfcache">bfcache</a>.</p>
</div>

<p class="note" id="note-between-loads-shared-worker-timeout-lifetime">The <span>between-loads
shared worker timeout</span> only influences the definition of <span data-x="permissible
worker">permissible</span>, not <span data-x="protected worker">protected</span>, and so
worker">permissible</span>, not <span data-x="active needed worker">actively needed</span>, and so
implementations are not required to keep shared workers alive for that duration. Rather, they are
required to close shared workers after the timeout is reached.</p>

Expand Down Expand Up @@ -123761,9 +123738,9 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
scope</var>.</p>

<li id="step-closing-orphan-workers"><p><i>Closing orphan workers</i>: Start monitoring
<var>worker global scope</var> such that no sooner than it stops being <span data-x="protected
worker">protected</span>, and no later than it stops being <span data-x="permissible
worker">permissible</span>, <var>worker global scope</var>'s <span
<var>worker global scope</var> such that no sooner than it stops being <span data-x="active
needed worker">actively needed</span>, and no later than it stops being <span
data-x="permissible worker">permissible</span>, <var>worker global scope</var>'s <span
data-x="dom-WorkerGlobalScope-closing">closing</span> flag is set to true.</p></li>

<li id="step-suspending-workers"><p><i>Suspending workers</i>: Start monitoring <var>worker
Expand Down