Browse files

[e] (0) Clean up the event loop algorithm

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24390
Affected topics: DOM APIs, Workers

git-svn-id: http://svn.whatwg.org/webapps@8424 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent c6cbc53 commit 0bd41c9d45e0e0fc63549778163cb85903a10f87 @Hixie Hixie committed Jan 27, 2014
Showing with 79 additions and 46 deletions.
  1. +26 −16 complete.html
  2. +26 −16 index
  3. +27 −14 source
View
42 complete.html
@@ -1174,7 +1174,7 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 27 January 2014</
<li><a href=#the-workerglobalscope-common-interface><span class=secno>10.2.1.1 </span>The <code>WorkerGlobalScope</code> common interface</a></li>
<li><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>10.2.1.2 </span>Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a></li>
<li><a href=#shared-workers-and-the-sharedworkerglobalscope-interface><span class=secno>10.2.1.3 </span>Shared workers and the <code>SharedWorkerGlobalScope</code> interface</a></ol></li>
- <li><a href=#the-event-loop><span class=secno>10.2.2 </span>The event loop</a></li>
+ <li><a href=#worker-event-loop><span class=secno>10.2.2 </span>The event loop</a></li>
<li><a href="#the-worker's-lifetime"><span class=secno>10.2.3 </span>The worker's lifetime</a></li>
<li><a href=#processing-model-7><span class=secno>10.2.4 </span>Processing model</a></li>
<li><a href=#runtime-script-errors-0><span class=secno>10.2.5 </span>Runtime script errors</a></li>
@@ -71351,24 +71351,31 @@ <h4 id=event-loops><span class=secno>7.1.4 </span>Event loops</h4>
<h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>
+<!--CLEANUP-->
<p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
- agents must use <dfn id=event-loop title="event loop">event loops</dfn> as described in this section.</p>
+ agents must use <dfn id=event-loop title="event loop">event loops</dfn> as described in this section. There are
+ two kinds of event loops: those for <a href=#browsing-context title="browsing context">browsing contexts</a>, and those for <a href=#workers>workers</a>.</p>
- <p>There must be at least one <a href=#event-loop>event loop</a> per user agent, and at most one <a href=#event-loop>event
- loop</a> per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
+ <p>There must be at least one <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> per user
+ agent, and at most one per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
<p class=note>When there is more than one <a href=#event-loop>event loop</a> for a <a href=#unit-of-related-browsing-contexts>unit of related
browsing contexts</a>, complications arise when a <a href=#browsing-context>browsing context</a> in that group
is <a href=#navigate title=navigate>navigated</a> such that it switches from one <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related
similar-origin browsing contexts</a> to another. This specification does not currently describe
how to handle these complications.</p>
- <p>An <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing context</a>. If an
+<!--CLEANUP-->
+ <p>A <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing context</a>. If such an
<a href=#event-loop>event loop</a>'s <a href=#browsing-context title="browsing context">browsing contexts</a> all go away,
then the <a href=#event-loop>event loop</a> goes away as well. A <a href=#browsing-context>browsing context</a> always has an
<a href=#event-loop>event loop</a> coordinating its activities.</p>
- <p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task queue">task queues</dfn>. A
+ <p><a href=#worker-event-loop>Worker event loops</a> are simpler: each worker has one
+ <a href=#event-loop>event loop</a>, and the <a href=#run-a-worker title="run a worker">worker processing model</a>
+ manages the <a href=#event-loop>event loop</a>'s lifetime.</p>
+
+ <hr><p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task queue">task queues</dfn>. A
<a href=#task-queue>task queue</a> is an ordered list of <dfn id=concept-task title=concept-task>tasks</dfn>, which are
algorithms that are responsible for such work as:</p>
@@ -71408,15 +71415,17 @@ <h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>
<dd><p>Some elements have tasks that trigger in response to DOM manipulation, e.g. when that
element is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into the document</a>.</p>
- </dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a <code><a href=#document>Document</a></code>; if the
+ </dl><!--CLEANUP--><p>Each <a href=#concept-task title=concept-task>task</a> in a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> is associated with a <code><a href=#document>Document</a></code>; if the
task was queued in the context of an element, then it is the element's <code><a href=#document>Document</a></code>; if
the task was queued in the context of a <a href=#browsing-context>browsing context</a>, then it is the
<a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> at the time the task was queued; if
the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is
the <a href=#responsible-document>responsible document</a> specified by the script's <a href=#settings-object>settings object</a>.</p>
+<!--CLEANUP-->
<p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
- the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>
+ the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the
+ <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code> or <a href=#workers>worker</a>.</p>
<p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the given task to one of the <a href=#task-queue title="task queue">task queues</a> of the relevant <a href=#event-loop>event loop</a>.</p>
@@ -71462,8 +71471,8 @@ <h5 id=processing-model-4><span class=secno>7.1.4.2 </span>Processing model</h5>
exists:</p>
<ol><!-- if you add a step here, make sure to go through the spec updating references to the "first
- step" or "step 1" of the event loop --><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one of the <a href=#event-loop>event
- loop</a>'s <a href=#task-queue title="task queue">task queues</a>, if any, ignoring tasks whose
+ step" or "step 1" of the event loop --><!--CLEANUP--><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one of the <a href=#event-loop>event
+ loop</a>'s <a href=#task-queue title="task queue">task queues</a>, if any, ignoring, in the case of a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a>, tasks whose
associated <code><a href=#document>Document</a></code>s are not <a href=#fully-active>fully active</a>. The user agent may pick any
<a href=#task-queue>task queue</a>.</li>
@@ -71478,8 +71487,8 @@ <h5 id=processing-model-4><span class=secno>7.1.4.2 </span>Processing model</h5>
<li>
- <p>If this <a href=#event-loop>event loop</a> is not a worker's <a href=#event-loop>event loop</a>, run these
- substeps:</p>
+ <p>If this <a href=#event-loop>event loop</a> is a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a>
+ (as opposed to a <a href=#workers>worker</a> <a href=#event-loop>event loop</a>), run these substeps:</p>
<ol><li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
@@ -71490,9 +71499,10 @@ <h5 id=processing-model-4><span class=secno>7.1.4.2 </span>Processing model</h5>
</ol></li>
- <li><p>Otherwise, if this <a href=#event-loop>event loop</a> is running for a
- <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, but there are no events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
- loop</a>, aborting these steps.</li>
+<!--CLEANUP-->
+ <li><p>Otherwise, if this is a <a href=#workers>worker</a> <a href=#event-loop>event loop</a> (i.e. one running for a
+ <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>), but there are no <a href=#concept-task title=concept-task>tasks</a> in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
+ loop</a>, aborting these steps, resuming the <a href=#run-a-worker>run a worker</a> steps described in the Web Workers section below.</li>
<li><p>Return to the first step of the <a href=#event-loop>event loop</a>.</li>
@@ -82699,7 +82709,7 @@ <h5 id=shared-workers-and-the-sharedworkerglobalscope-interface><span class=secn
- <h4 id=the-event-loop><span class=secno>10.2.2 </span>The event loop</h4>
+ <h4 id=worker-event-loop><span class=secno>10.2.2 </span>The event loop</h4>
<p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop>event loop</a>, separate
from those used by <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
View
42 index
@@ -1174,7 +1174,7 @@
<li><a href=#the-workerglobalscope-common-interface><span class=secno>10.2.1.1 </span>The <code>WorkerGlobalScope</code> common interface</a></li>
<li><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>10.2.1.2 </span>Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a></li>
<li><a href=#shared-workers-and-the-sharedworkerglobalscope-interface><span class=secno>10.2.1.3 </span>Shared workers and the <code>SharedWorkerGlobalScope</code> interface</a></ol></li>
- <li><a href=#the-event-loop><span class=secno>10.2.2 </span>The event loop</a></li>
+ <li><a href=#worker-event-loop><span class=secno>10.2.2 </span>The event loop</a></li>
<li><a href="#the-worker's-lifetime"><span class=secno>10.2.3 </span>The worker's lifetime</a></li>
<li><a href=#processing-model-7><span class=secno>10.2.4 </span>Processing model</a></li>
<li><a href=#runtime-script-errors-0><span class=secno>10.2.5 </span>Runtime script errors</a></li>
@@ -71351,24 +71351,31 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
<h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>
+<!--CLEANUP-->
<p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
- agents must use <dfn id=event-loop title="event loop">event loops</dfn> as described in this section.</p>
+ agents must use <dfn id=event-loop title="event loop">event loops</dfn> as described in this section. There are
+ two kinds of event loops: those for <a href=#browsing-context title="browsing context">browsing contexts</a>, and those for <a href=#workers>workers</a>.</p>
- <p>There must be at least one <a href=#event-loop>event loop</a> per user agent, and at most one <a href=#event-loop>event
- loop</a> per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
+ <p>There must be at least one <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> per user
+ agent, and at most one per <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
<p class=note>When there is more than one <a href=#event-loop>event loop</a> for a <a href=#unit-of-related-browsing-contexts>unit of related
browsing contexts</a>, complications arise when a <a href=#browsing-context>browsing context</a> in that group
is <a href=#navigate title=navigate>navigated</a> such that it switches from one <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related
similar-origin browsing contexts</a> to another. This specification does not currently describe
how to handle these complications.</p>
- <p>An <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing context</a>. If an
+<!--CLEANUP-->
+ <p>A <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> always has at least one <a href=#browsing-context>browsing context</a>. If such an
<a href=#event-loop>event loop</a>'s <a href=#browsing-context title="browsing context">browsing contexts</a> all go away,
then the <a href=#event-loop>event loop</a> goes away as well. A <a href=#browsing-context>browsing context</a> always has an
<a href=#event-loop>event loop</a> coordinating its activities.</p>
- <p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task queue">task queues</dfn>. A
+ <p><a href=#worker-event-loop>Worker event loops</a> are simpler: each worker has one
+ <a href=#event-loop>event loop</a>, and the <a href=#run-a-worker title="run a worker">worker processing model</a>
+ manages the <a href=#event-loop>event loop</a>'s lifetime.</p>
+
+ <hr><p>An <a href=#event-loop>event loop</a> has one or more <dfn id=task-queue title="task queue">task queues</dfn>. A
<a href=#task-queue>task queue</a> is an ordered list of <dfn id=concept-task title=concept-task>tasks</dfn>, which are
algorithms that are responsible for such work as:</p>
@@ -71408,15 +71415,17 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
<dd><p>Some elements have tasks that trigger in response to DOM manipulation, e.g. when that
element is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into the document</a>.</p>
- </dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a <code><a href=#document>Document</a></code>; if the
+ </dl><!--CLEANUP--><p>Each <a href=#concept-task title=concept-task>task</a> in a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a> is associated with a <code><a href=#document>Document</a></code>; if the
task was queued in the context of an element, then it is the element's <code><a href=#document>Document</a></code>; if
the task was queued in the context of a <a href=#browsing-context>browsing context</a>, then it is the
<a href=#browsing-context>browsing context</a>'s <a href=#active-document>active document</a> at the time the task was queued; if
the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is
the <a href=#responsible-document>responsible document</a> specified by the script's <a href=#settings-object>settings object</a>.</p>
+<!--CLEANUP-->
<p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
- the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>
+ the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the
+ <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code> or <a href=#workers>worker</a>.</p>
<p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the given task to one of the <a href=#task-queue title="task queue">task queues</a> of the relevant <a href=#event-loop>event loop</a>.</p>
@@ -71462,8 +71471,8 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
exists:</p>
<ol><!-- if you add a step here, make sure to go through the spec updating references to the "first
- step" or "step 1" of the event loop --><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one of the <a href=#event-loop>event
- loop</a>'s <a href=#task-queue title="task queue">task queues</a>, if any, ignoring tasks whose
+ step" or "step 1" of the event loop --><!--CLEANUP--><li><p>Run the oldest <a href=#concept-task title=concept-task>task</a> on one of the <a href=#event-loop>event
+ loop</a>'s <a href=#task-queue title="task queue">task queues</a>, if any, ignoring, in the case of a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a>, tasks whose
associated <code><a href=#document>Document</a></code>s are not <a href=#fully-active>fully active</a>. The user agent may pick any
<a href=#task-queue>task queue</a>.</li>
@@ -71478,8 +71487,8 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
<li>
- <p>If this <a href=#event-loop>event loop</a> is not a worker's <a href=#event-loop>event loop</a>, run these
- substeps:</p>
+ <p>If this <a href=#event-loop>event loop</a> is a <a href=#browsing-context>browsing context</a> <a href=#event-loop>event loop</a>
+ (as opposed to a <a href=#workers>worker</a> <a href=#event-loop>event loop</a>), run these substeps:</p>
<ol><li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
@@ -71490,9 +71499,10 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
</ol></li>
- <li><p>Otherwise, if this <a href=#event-loop>event loop</a> is running for a
- <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, but there are no events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
- loop</a>, aborting these steps.</li>
+<!--CLEANUP-->
+ <li><p>Otherwise, if this is a <a href=#workers>worker</a> <a href=#event-loop>event loop</a> (i.e. one running for a
+ <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>), but there are no <a href=#concept-task title=concept-task>tasks</a> in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
+ loop</a>, aborting these steps, resuming the <a href=#run-a-worker>run a worker</a> steps described in the Web Workers section below.</li>
<li><p>Return to the first step of the <a href=#event-loop>event loop</a>.</li>
@@ -82699,7 +82709,7 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})
- <h4 id=the-event-loop><span class=secno>10.2.2 </span>The event loop</h4>
+ <h4 id=worker-event-loop><span class=secno>10.2.2 </span>The event loop</h4>
<p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop>event loop</a>, separate
from those used by <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
View
41 source
@@ -79688,23 +79688,32 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
<h5>Definitions</h5>
+<!--CLEANUP-->
<p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
- agents must use <dfn data-x="event loop">event loops</dfn> as described in this section.</p>
+ agents must use <dfn data-x="event loop">event loops</dfn> as described in this section. There are
+ two kinds of event loops: those for <span data-x="browsing context">browsing contexts</span>, and those for <a href="#workers">workers</a>.</p>
- <p>There must be at least one <span>event loop</span> per user agent, and at most one <span>event
- loop</span> per <span>unit of related similar-origin browsing contexts</span>.</p>
+ <p>There must be at least one <span>browsing context</span> <span>event loop</span> per user
+ agent, and at most one per <span>unit of related similar-origin browsing contexts</span>.</p>
<p class="note">When there is more than one <span>event loop</span> for a <span>unit of related
browsing contexts</span>, complications arise when a <span>browsing context</span> in that group
is <span data-x="navigate">navigated</span> such that it switches from one <span>unit of related
similar-origin browsing contexts</span> to another. This specification does not currently describe
how to handle these complications.</p>
- <p>An <span>event loop</span> always has at least one <span>browsing context</span>. If an
+<!--CLEANUP-->
+ <p>A <span>browsing context</span> <span>event loop</span> always has at least one <span>browsing context</span>. If such an
<span>event loop</span>'s <span data-x="browsing context">browsing contexts</span> all go away,
then the <span>event loop</span> goes away as well. A <span>browsing context</span> always has an
<span>event loop</span> coordinating its activities.</p>
+ <p><a href="#worker-event-loop">Worker event loops</a> are simpler: each worker has one
+ <span>event loop</span>, and the <span data-x="run a worker">worker processing model</span>
+ manages the <span>event loop</span>'s lifetime.</p>
+
+ <hr>
+
<p>An <span>event loop</span> has one or more <dfn data-x="task queue">task queues</dfn>. A
<span>task queue</span> is an ordered list of <dfn data-x="concept-task">tasks</dfn>, which are
algorithms that are responsible for such work as:</p>
@@ -79749,16 +79758,18 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
</dl>
- <p>Each <span data-x="concept-task">task</span> is associated with a <code>Document</code>; if the
+<!--CLEANUP-->
+ <p>Each <span data-x="concept-task">task</span> in a <span>browsing context</span> <span>event loop</span> is associated with a <code>Document</code>; if the
task was queued in the context of an element, then it is the element's <code>Document</code>; if
the task was queued in the context of a <span>browsing context</span>, then it is the
<span>browsing context</span>'s <span>active document</span> at the time the task was queued; if
the task was queued by or for a <span data-x="concept-script">script</span> then the document is
the <span>responsible document</span> specified by the script's <span>settings object</span>.</p>
+<!--CLEANUP-->
<p>A <span data-x="concept-task">task</span> is intended for a specific <span>event loop</span>:
- the <span>event loop</span> that is handling <span data-x="concept-task">tasks</span> for the <span
- data-x="concept-task">task</span>'s associated <code>Document</code>.</p>
+ the <span>event loop</span> that is handling <span data-x="concept-task">tasks</span> for the
+ <span data-x="concept-task">task</span>'s associated <code>Document</code> or <a href="#workers">worker</a>.</p>
<p>When a user agent is to <dfn>queue a task</dfn>, it must add the given task to one of the <span
data-x="task queue">task queues</span> of the relevant <span>event loop</span>.</p>
@@ -79813,8 +79824,9 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
<!-- if you add a step here, make sure to go through the spec updating references to the "first
step" or "step 1" of the event loop -->
+<!--CLEANUP-->
<li><p>Run the oldest <span data-x="concept-task">task</span> on one of the <span>event
- loop</span>'s <span data-x="task queue">task queues</span>, if any, ignoring tasks whose
+ loop</span>'s <span data-x="task queue">task queues</span>, if any, ignoring, in the case of a <span>browsing context</span> <span>event loop</span>, tasks whose
associated <code>Document</code>s are not <span>fully active</span>. The user agent may pick any
<span>task queue</span>.</p></li>
@@ -79829,8 +79841,8 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
<li>
- <p>If this <span>event loop</span> is not a worker's <span>event loop</span>, run these
- substeps:</p>
+ <p>If this <span>event loop</span> is a <span>browsing context</span> <span>event loop</span>
+ (as opposed to a <a href="#workers">worker</a> <span>event loop</span>), run these substeps:</p>
<ol>
@@ -79845,11 +79857,12 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
</li>
- <li><p>Otherwise, if this <span>event loop</span> is running for a
- <code>WorkerGlobalScope</code>, but there are no events in the <span>event loop</span>'s <span
+<!--CLEANUP-->
+ <li><p>Otherwise, if this is a <a href="#workers">worker</a> <span>event loop</span> (i.e. one running for a
+ <code>WorkerGlobalScope</code>), but there are no <span data-x="concept-task">tasks</span> in the <span>event loop</span>'s <span
data-x="task queue">task queues</span> and the <code>WorkerGlobalScope</code> object's <span
data-x="dom-WorkerGlobalScope-closing">closing</span> flag is true, then destroy the <span>event
- loop</span>, aborting these steps.</p></li>
+ loop</span>, aborting these steps, resuming the <span>run a worker</span> steps described in the Web Workers section below.</p></li>
<li><p>Return to the first step of the <span>event loop</span>.</p></li>
@@ -92057,7 +92070,7 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})
- <h4>The event loop</h4>
+ <h4 id="worker-event-loop">The event loop</h4>
<p>Each <code>WorkerGlobalScope</code> object has a distinct <span>event loop</span>, separate
from those used by <span data-x="unit of related similar-origin browsing contexts">units of related

0 comments on commit 0bd41c9

Please sign in to comment.