Skip to content

Commit

Permalink
[giow] (0) Make microtasks work in workers too, since eventually we'l…
Browse files Browse the repository at this point in the history
…l want the JavaScript stuff to hook into this

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

git-svn-id: http://svn.whatwg.org/webapps@8553 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 18, 2014
1 parent 21b53f5 commit cf53bb2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 58 deletions.
29 changes: 11 additions & 18 deletions complete.html
Expand Up @@ -71844,10 +71844,7 @@ <h5 id=script-settings-for-browsing-contexts><span class=secno>7.1.3.2 </span>Sc

<p class=note>The WebIDL specification also uses these algorithms. <a href=#refsWEBIDL>[WEBIDL]</a></p>

<hr><p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=performing-a-microtask-checkpoint>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the algorithm to <a href=#concept-mo-invoke title=concept-mo-invoke>invoke
<code>MutationObserver</code> objects</a>. For the purposes of <code><a href=#mutationobserver>MutationObserver</a></code>
<hr><!--CLEANUP--><p>For the purposes of <code><a href=#mutationobserver>MutationObserver</a></code>
objects, each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> is a distinct <var title="MutationObserver scripting environment"><a href=#mutationobserver-scripting-environment>scripting environment</a></var>.</p>

<p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=global-script-clean-up-jobs-list>global script
Expand Down Expand Up @@ -72169,7 +72166,9 @@ <h5 id=definitions-1><span class=secno>7.1.4.1 </span>Definitions</h5>
processing events from any one <a href=#task-source>task source</a> out of order.</p>

<p>Each <a href=#event-loop>event loop</a> has a <dfn id=currently-running-task>currently running task</dfn>. Initially, this is null.
It is used to handle reentrancy.</p>
It is used to handle reentrancy. Each <a href=#event-loop>event loop</a> also has a <dfn id=performing-a-microtask-checkpoint>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a> algorithm.</p>

<hr><p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
shared state like cookies. At any one point, the <a href=#storage-mutex>storage mutex</a> is either free, or
Expand Down Expand Up @@ -72221,23 +72220,17 @@ <h5 id=processing-model-4><span class=secno>7.1.4.2 </span>Processing model</h5>
<li><p>If a task was run in the <i>run</i> step above, remove that task from its <a href=#task-queue>task
queue</a>.</li>

<li>

<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>

<li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
<li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>

<!--CLEANUP-->
<li><p><i>Update the rendering</i>: If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
<a href=#browsing-context>browsing context</a> to reflect the current state.</li>
<li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>

</ol></li>
<li><p><i>Update the rendering</i>: 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>), then, if necessary, update the rendering or user interface of any
<code><a href=#document>Document</a></code> or <a href=#browsing-context>browsing context</a> to reflect the current state.</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
<li><p>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>

Expand Down
29 changes: 11 additions & 18 deletions index
Expand Up @@ -71844,10 +71844,7 @@ interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {

<p class=note>The WebIDL specification also uses these algorithms. <a href=#refsWEBIDL>[WEBIDL]</a></p>

<hr><p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=performing-a-microtask-checkpoint>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the algorithm to <a href=#concept-mo-invoke title=concept-mo-invoke>invoke
<code>MutationObserver</code> objects</a>. For the purposes of <code><a href=#mutationobserver>MutationObserver</a></code>
<hr><!--CLEANUP--><p>For the purposes of <code><a href=#mutationobserver>MutationObserver</a></code>
objects, each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> is a distinct <var title="MutationObserver scripting environment"><a href=#mutationobserver-scripting-environment>scripting environment</a></var>.</p>

<p>Each <a href=#unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=global-script-clean-up-jobs-list>global script
Expand Down Expand Up @@ -72169,7 +72166,9 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
processing events from any one <a href=#task-source>task source</a> out of order.</p>

<p>Each <a href=#event-loop>event loop</a> has a <dfn id=currently-running-task>currently running task</dfn>. Initially, this is null.
It is used to handle reentrancy.</p>
It is used to handle reentrancy. Each <a href=#event-loop>event loop</a> also has a <dfn id=performing-a-microtask-checkpoint>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a> algorithm.</p>

<hr><p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
shared state like cookies. At any one point, the <a href=#storage-mutex>storage mutex</a> is either free, or
Expand Down Expand Up @@ -72221,23 +72220,17 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
<li><p>If a task was run in the <i>run</i> step above, remove that task from its <a href=#task-queue>task
queue</a>.</li>

<li>

<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>

<li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
<li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>

<!--CLEANUP-->
<li><p><i>Update the rendering</i>: If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
<a href=#browsing-context>browsing context</a> to reflect the current state.</li>
<li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>

</ol></li>
<li><p><i>Update the rendering</i>: 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>), then, if necessary, update the rendering or user interface of any
<code><a href=#document>Document</a></code> or <a href=#browsing-context>browsing context</a> to reflect the current state.</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
<li><p>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>

Expand Down
34 changes: 12 additions & 22 deletions source
Expand Up @@ -80256,10 +80256,8 @@ interface <dfn>NavigatorOnLine</dfn> {

<hr>

<p>Each <span>unit of related similar-origin browsing contexts</span> has a <dfn>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the algorithm to <span data-x="concept-mo-invoke">invoke
<code>MutationObserver</code> objects</span>. For the purposes of <code>MutationObserver</code>
<!--CLEANUP-->
<p>For the purposes of <code>MutationObserver</code>
objects, each <span>unit of related similar-origin browsing contexts</span> is a distinct <var
data-x="MutationObserver scripting environment">scripting environment</var>.</p>

Expand Down Expand Up @@ -80617,7 +80615,9 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
processing events from any one <span>task source</span> out of order.</p>

<p>Each <span>event loop</span> has a <dfn>currently running task</dfn>. Initially, this is null.
It is used to handle reentrancy.</p>
It is used to handle reentrancy. Each <span>event loop</span> also has a <dfn>performing a
microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
invocation of the <span>perform a microtask checkpoint</span> algorithm.</p>

<hr>

Expand Down Expand Up @@ -80678,27 +80678,17 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
<li><p>If a task was run in the <i>run</i> step above, remove that task from its <span>task
queue</span>.</p></li>

<li>

<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>

<li><p><span>Perform a microtask checkpoint</span>.</p></li>

<li><p><span>Provide a stable state</span>.</p></li>

<!--CLEANUP-->
<li><p><i>Update the rendering</i>: If necessary, update the rendering or user interface of any <code>Document</code> or
<span>browsing context</span> to reflect the current state.</p></li>
<li><p><span>Perform a microtask checkpoint</span>.</p></li>

</ol>
<li><p><span>Provide a stable state</span>.</p></li>

</li>
<li><p><i>Update the rendering</i>: 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>), then, if necessary, update the rendering or user interface of any
<code>Document</code> or <span>browsing context</span> to reflect the current state.</p></li>

<!--CLEANUP-->
<li><p>Otherwise, if this is a <a href="#workers">worker</a> <span>event loop</span> (i.e. one running for a
<li><p>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
Expand Down

0 comments on commit cf53bb2

Please sign in to comment.