Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (0) Refactor 'stable states' to be defined in terms of microtasks
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24724
Affected topics: DOM APIs, HTML Syntax and Parsing

git-svn-id: http://svn.whatwg.org/webapps@8630 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 13, 2014
1 parent 10ef1e1 commit 65ca3ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 43 deletions.
21 changes: 7 additions & 14 deletions complete.html
Expand Up @@ -72525,8 +72525,6 @@ <h5 id=processing-model-5><span class=secno>7.1.4.2 </span>Processing model</h5>

<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><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
Expand Down Expand Up @@ -72587,7 +72585,7 @@ <h5 id=processing-model-5><span class=secno>7.1.4.2 </span>Processing model</h5>

<p><i>Run</i>: Run the selected <a href=#concept-task title=concept-task>task</a>.</p>

<p class=note>This will typically invoke scripted callbacks, which eventually calls the
<p class=note>This might involve invoking scripted callbacks, which eventually calls the
<a href=#clean-up-after-running-a-callback>clean up after running a callback</a> steps, which call this <a href=#perform-a-microtask-checkpoint>perform a microtask
checkpoint</a> algorithm again, which is why we use the <a href=#performing-a-microtask-checkpoint>performing a microtask
checkpoint</a> flag to avoid reentrancy.</p>
Expand Down Expand Up @@ -72624,14 +72622,10 @@ <h5 id=processing-model-5><span class=secno>7.1.4.2 </span>Processing model</h5>

<li><p>Set the <a href=#event-loop>event loop</a>'s <a href=#currently-running-task>currently running task</a> back to <var title="">parent</var>.</li>

</ol><hr><p>When the user agent is to <dfn id=provide-a-stable-state>provide a stable state</dfn>, if any asynchronously-running
algorithms are <dfn id=await-a-stable-state title="await a stable state">awaiting a stable state</dfn>, then the user
agent must run their <dfn id=synchronous-section>synchronous section</dfn> and then resume running their asynchronous
algorithm (if appropriate).</p>

<p class=note>A <a href=#synchronous-section>synchronous section</a> never mutates the DOM, runs any script, or has
any side-effects detectable from another <a href=#synchronous-section>synchronous section</a>, and thus <a href=#synchronous-section title="synchronous section">synchronous sections</a> can be run in any order, and cannot
<a href=#spin-the-event-loop>spin the event loop</a>.</p>
</ol><hr><p>When an asynchronously-running algorithm is to <dfn id=await-a-stable-state>await a stable state</dfn>, the user agent
must <a href=#queue-a-microtask>queue a microtask</a> that first runs the algorithm's <dfn id=synchronous-section>synchronous
section</dfn>, and then resumes running the asynchronous algorithm (if appropriate), as described
in the algorithm's steps.</p>

<p class=note>Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are marked
with &#x231b;.</p>
Expand Down Expand Up @@ -93029,8 +93023,6 @@ <h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title=

<p>If the <a href=#stack-of-script-settings-objects>stack of script settings objects</a> is empty, <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>.</p>

<p>If the <a href=#stack-of-script-settings-objects>stack of script settings objects</a> is empty, <a href=#provide-a-stable-state>provide a stable state</a>.</p>

<p>Let <var title="">script</var> be the <a href=#current-node>current node</a> (which will be a
<code><a href=#the-script-element>script</a></code> element).</p>

Expand Down Expand Up @@ -95637,12 +95629,13 @@ <h3 id=parsing-xhtml-documents><span class=secno>13.2 </span>Parsing XHTML docum
motivated by a desire for user agents to all handle entities in an interoperable fashion without
requiring any network access for handling external subsets. <a href=#refsXML>[XML]</a></p>

<!--CLEANUP-->
<p id=scriptTagXML>When an <a href=#xml-parser>XML parser</a> creates a <code><a href=#the-script-element>script</a></code> element, it
must be marked as being <a href=#parser-inserted>"parser-inserted"</a> and its <a href=#force-async>"force-async"</a> flag
must be unset. If the parser was originally created for the <a href=#xml-fragment-parsing-algorithm>XML fragment parsing
algorithm</a>, then the element must be marked as <a href=#already-started>"already started"</a> also. When the
element's end tag is parsed, the user agent must <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>,
<a href=#provide-a-stable-state>provide a stable state</a>, and then <a href=#prepare-a-script title="prepare a script">prepare</a> the
and then <a href=#prepare-a-script title="prepare a script">prepare</a> the
<code><a href=#the-script-element>script</a></code> element. If this causes there to be a <a href=#pending-parsing-blocking-script>pending parsing-blocking
script</a>, then the user agent must run the following steps:</p>

Expand Down
21 changes: 7 additions & 14 deletions index
Expand Up @@ -72525,8 +72525,6 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even

<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><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
Expand Down Expand Up @@ -72587,7 +72585,7 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even

<p><i>Run</i>: Run the selected <a href=#concept-task title=concept-task>task</a>.</p>

<p class=note>This will typically invoke scripted callbacks, which eventually calls the
<p class=note>This might involve invoking scripted callbacks, which eventually calls the
<a href=#clean-up-after-running-a-callback>clean up after running a callback</a> steps, which call this <a href=#perform-a-microtask-checkpoint>perform a microtask
checkpoint</a> algorithm again, which is why we use the <a href=#performing-a-microtask-checkpoint>performing a microtask
checkpoint</a> flag to avoid reentrancy.</p>
Expand Down Expand Up @@ -72624,14 +72622,10 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even

<li><p>Set the <a href=#event-loop>event loop</a>'s <a href=#currently-running-task>currently running task</a> back to <var title="">parent</var>.</li>

</ol><hr><p>When the user agent is to <dfn id=provide-a-stable-state>provide a stable state</dfn>, if any asynchronously-running
algorithms are <dfn id=await-a-stable-state title="await a stable state">awaiting a stable state</dfn>, then the user
agent must run their <dfn id=synchronous-section>synchronous section</dfn> and then resume running their asynchronous
algorithm (if appropriate).</p>

<p class=note>A <a href=#synchronous-section>synchronous section</a> never mutates the DOM, runs any script, or has
any side-effects detectable from another <a href=#synchronous-section>synchronous section</a>, and thus <a href=#synchronous-section title="synchronous section">synchronous sections</a> can be run in any order, and cannot
<a href=#spin-the-event-loop>spin the event loop</a>.</p>
</ol><hr><p>When an asynchronously-running algorithm is to <dfn id=await-a-stable-state>await a stable state</dfn>, the user agent
must <a href=#queue-a-microtask>queue a microtask</a> that first runs the algorithm's <dfn id=synchronous-section>synchronous
section</dfn>, and then resumes running the asynchronous algorithm (if appropriate), as described
in the algorithm's steps.</p>

<p class=note>Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are marked
with &#x231b;.</p>
Expand Down Expand Up @@ -93029,8 +93023,6 @@ document.body.appendChild(text);

<p>If the <a href=#stack-of-script-settings-objects>stack of script settings objects</a> is empty, <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>.</p>

<p>If the <a href=#stack-of-script-settings-objects>stack of script settings objects</a> is empty, <a href=#provide-a-stable-state>provide a stable state</a>.</p>

<p>Let <var title="">script</var> be the <a href=#current-node>current node</a> (which will be a
<code><a href=#the-script-element>script</a></code> element).</p>

Expand Down Expand Up @@ -95637,12 +95629,13 @@ document.body.appendChild(text);
motivated by a desire for user agents to all handle entities in an interoperable fashion without
requiring any network access for handling external subsets. <a href=#refsXML>[XML]</a></p>

<!--CLEANUP-->
<p id=scriptTagXML>When an <a href=#xml-parser>XML parser</a> creates a <code><a href=#the-script-element>script</a></code> element, it
must be marked as being <a href=#parser-inserted>"parser-inserted"</a> and its <a href=#force-async>"force-async"</a> flag
must be unset. If the parser was originally created for the <a href=#xml-fragment-parsing-algorithm>XML fragment parsing
algorithm</a>, then the element must be marked as <a href=#already-started>"already started"</a> also. When the
element's end tag is parsed, the user agent must <a href=#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>,
<a href=#provide-a-stable-state>provide a stable state</a>, and then <a href=#prepare-a-script title="prepare a script">prepare</a> the
and then <a href=#prepare-a-script title="prepare a script">prepare</a> the
<code><a href=#the-script-element>script</a></code> element. If this causes there to be a <a href=#pending-parsing-blocking-script>pending parsing-blocking
script</a>, then the user agent must run the following steps:</p>

Expand Down
22 changes: 7 additions & 15 deletions source
Expand Up @@ -79880,8 +79880,6 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {

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

<li><p><span>Provide a stable state</span>.</p></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
Expand Down Expand Up @@ -79952,7 +79950,7 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {

<p><i>Run</i>: Run the selected <span data-x="concept-task">task</span>.</p>

<p class="note">This will typically invoke scripted callbacks, which eventually calls the
<p class="note">This might involve invoking scripted callbacks, which eventually calls the
<span>clean up after running a callback</span> steps, which call this <span>perform a microtask
checkpoint</span> algorithm again, which is why we use the <span>performing a microtask
checkpoint</span> flag to avoid reentrancy.</p>
Expand Down Expand Up @@ -79999,15 +79997,10 @@ dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {

<hr>

<p>When the user agent is to <dfn>provide a stable state</dfn>, if any asynchronously-running
algorithms are <dfn data-x="await a stable state">awaiting a stable state</dfn>, then the user
agent must run their <dfn>synchronous section</dfn> and then resume running their asynchronous
algorithm (if appropriate).</p>

<p class="note">A <span>synchronous section</span> never mutates the DOM, runs any script, or has
any side-effects detectable from another <span>synchronous section</span>, and thus <span
data-x="synchronous section">synchronous sections</span> can be run in any order, and cannot
<span>spin the event loop</span>.</p>
<p>When an asynchronously-running algorithm is to <dfn>await a stable state</dfn>, the user agent
must <span>queue a microtask</span> that first runs the algorithm's <dfn>synchronous
section</dfn>, and then resumes running the asynchronous algorithm (if appropriate), as described
in the algorithm's steps.</p>

<p class="note">Steps in <span data-x="synchronous section">synchronous sections</span> are marked
with &#x231B;.</p>
Expand Down Expand Up @@ -102656,8 +102649,6 @@ document.body.appendChild(text);

<p>If the <span>stack of script settings objects</span> is empty, <span>perform a microtask checkpoint</span>.</p>

<p>If the <span>stack of script settings objects</span> is empty, <span>provide a stable state</span>.</p>

<p>Let <var data-x="">script</var> be the <span>current node</span> (which will be a
<code>script</code> element).</p>

Expand Down Expand Up @@ -105546,12 +105537,13 @@ document.body.appendChild(text);
motivated by a desire for user agents to all handle entities in an interoperable fashion without
requiring any network access for handling external subsets. <a href="#refsXML">[XML]</a></p>

<!--CLEANUP-->
<p id="scriptTagXML">When an <span>XML parser</span> creates a <code>script</code> element, it
must be marked as being <span>"parser-inserted"</span> and its <span>"force-async"</span> flag
must be unset. If the parser was originally created for the <span>XML fragment parsing
algorithm</span>, then the element must be marked as <span>"already started"</span> also. When the
element's end tag is parsed, the user agent must <span>perform a microtask checkpoint</span>,
<span>provide a stable state</span>, and then <span data-x="prepare a script">prepare</span> the
and then <span data-x="prepare a script">prepare</span> the
<code>script</code> element. If this causes there to be a <span>pending parsing-blocking
script</span>, then the user agent must run the following steps:</p>

Expand Down

0 comments on commit 65ca3ae

Please sign in to comment.