[html5] r2907 - [gow] (2) Fix race conditions in the <video> load mechanism.
whatwg at whatwg.org
whatwg at whatwg.org
Wed Mar 25 01:40:04 PDT 2009
Author: ianh
Date: 2009-03-25 01:40:03 -0700 (Wed, 25 Mar 2009)
New Revision: 2907
Modified:
index
source
Log:
[gow] (2) Fix race conditions in the <video> load mechanism.
Modified: index
===================================================================
--- index 2009-03-25 07:11:43 UTC (rev 2906)
+++ index 2009-03-25 08:40:03 UTC (rev 2907)
@@ -19129,9 +19129,8 @@
these must return a new <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> object (a new
<code><a href=#audio>audio</a></code> element). If the <var title="">src</var> argument
is present, the object created must have its <code title=dom-media-src><a href=#dom-media-src>src</a></code> content attribute set to the
- provided value, and the user agent must asynchronously invoke the
- object's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
- selection algorithm</a> before returning.</p>
+ provided value, and the user agent must invoke the object's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> before returning.</p>
</div>
@@ -19774,7 +19773,7 @@
</ol></li>
- <li><p>Asynchronously invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ <li><p>Invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</a>.</li>
<li>
@@ -19786,8 +19785,10 @@
</ol><p>The <dfn id=concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</dfn> for a <a href=#media-element>media element</a> is as follows. This
- algorithm is always invoked asynchronously, meaning that it runs in
- the background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel.</p>
+ algorithm is always invoked synchronously, but one of the first
+ steps in the algorithm is to return and continue running the
+ remaining steps asynchronously, meaning that it runs in the
+ background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel.</p>
<ol><li>
@@ -19796,18 +19797,37 @@
<ol><li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>.</li>
+ <li><p>Run the remainder of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> steps asynchronously, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to
+ continue.</li>
+
<li><p>While the <a href=#media-element>media element</a> has neither a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor any
- <code><a href=#the-source-element>source</a></code> element children, wait. (This steps might
- wait forever.)</li>
+ <code><a href=#the-source-element>source</a></code> element children, wait. (This step might wait
+ forever.)</li>
+ <li><p>Before the <a href=#concept-task title=concept-task>task</a> that set
+ the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute or inserted
+ the <code><a href=#the-source-element>source</a></code> element has a chance to complete, set the
+ <a href=#media-element>media element</a>'s <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to true (this <a href=#delay-the-load-event title="delay the load
+ event">delays the load event</a>), and set its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+
+ </ol><p>Otherwise, run these substeps:</p>
+
+ <ol><li><p>Set the <a href=#media-element>media element</a>'s
+ <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to true (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a>), and
+ set its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
+ to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+
+ <li><p>Run the remainder of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ algorithm</a> steps asynchronously, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to
+ continue.</li>
+
</ol></li>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
- to true. This <a href=#delay-the-load-event title="delay the load event">delays the load
- event</a>.</li>
+ <li><p class=note>By this point, the algorithm is running
+ asynchronously.</li>
- <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
-
<li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
event</a> called <code title=event-loadstart><a href=#event-loadstart>loadstart</a></code>
at the <a href=#media-element>media element</a>.</li>
@@ -19976,10 +19996,12 @@
node other than the end of the list. (This step might wait
forever.)</li>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ <li><p>Before the <a href=#concept-task title=concept-task>task</a> that
+ inserted the <code><a href=#the-source-element>source</a></code> element has a chance to
+ complete, set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
flag</a> back to true. This <a href=#delay-the-load-event title="delay the load
- event">delays the load event</a> again, in case it hasn't gone
- been fired yet.</li>
+ event">delays the load event</a> again, in case it hasn't been
+ fired yet.</li>
<li><p>Jump back to the step labeled <i>search loop</i>.</li>
@@ -20292,9 +20314,9 @@
</ol><p>If a <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value
<code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into a
- document</a>, the user agent must asynchronously invoke the
- <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
- algorithm</a>.</p>
+ document</a>, the user agent must invoke the <a href=#media-element>media
+ element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource
+ selection algorithm</a>.</p>
</div>
@@ -20942,8 +20964,7 @@
<ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then the user
- agent must asynchronously invoke the <a href=#media-element>media element</a>'s
- <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</a>.</li>
<li>
@@ -20999,8 +21020,7 @@
<ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then the user
- agent must asynchronously invoke the <a href=#media-element>media element</a>'s
- <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+ agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</a>.</li>
<li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, it must
Modified: source
===================================================================
--- source 2009-03-25 07:11:43 UTC (rev 2906)
+++ source 2009-03-25 08:40:03 UTC (rev 2907)
@@ -20604,9 +20604,9 @@
<code>audio</code> element). If the <var title="">src</var> argument
is present, the object created must have its <code
title="dom-media-src">src</code> content attribute set to the
- provided value, and the user agent must asynchronously invoke the
- object's <span title="concept-media-load-algorithm">resource
- selection algorithm</span> before returning.</p>
+ provided value, and the user agent must invoke the object's <span
+ title="concept-media-load-algorithm">resource selection
+ algorithm</span> before returning.</p>
</div>
@@ -21342,7 +21342,7 @@
</li>
- <li><p>Asynchronously invoke the <span>media element</span>'s <span
+ <li><p>Invoke the <span>media element</span>'s <span
title="concept-media-load-algorithm">resource selection
algorithm</span>.</li>
@@ -21357,8 +21357,10 @@
<p>The <dfn title="concept-media-load-algorithm">resource selection
algorithm</dfn> for a <span>media element</span> is as follows. This
- algorithm is always invoked asynchronously, meaning that it runs in
- the background with scripts and other <span
+ algorithm is always invoked synchronously, but one of the first
+ steps in the algorithm is to return and continue running the
+ remaining steps asynchronously, meaning that it runs in the
+ background with scripts and other <span
title="concept-task">tasks</span> running in parallel.</p>
<ol>
@@ -21375,23 +21377,52 @@
title="dom-media-networkState">networkState</code> to <code
title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</code>.</p></li>
+ <li><p>Run the remainder of the <span
+ title="concept-media-load-algorithm">resource selection
+ algorithm</span> steps asynchronously, allowing the <span
+ title="concept-task">task</span> that invoked this algorithm to
+ continue.</p></li>
+
<li><p>While the <span>media element</span> has neither a <code
title="attr-media-src">src</code> attribute nor any
- <code>source</code> element children, wait. (This steps might
- wait forever.)</p></li>
+ <code>source</code> element children, wait. (This step might wait
+ forever.)</p></li>
+ <li><p>Before the <span title="concept-task">task</span> that set
+ the <code title="attr-media-src">src</code> attribute or inserted
+ the <code>source</code> element has a chance to complete, set the
+ <span>media element</span>'s <span>delaying-the-load-event
+ flag</span> to true (this <span title="delay the load
+ event">delays the load event</span>), and set its <code
+ title="dom-media-networkState">networkState</code> to <code
+ title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
+
</ol>
+ <p>Otherwise, run these substeps:</p>
+
+ <ol>
+
+ <li><p>Set the <span>media element</span>'s
+ <span>delaying-the-load-event flag</span> to true (this <span
+ title="delay the load event">delays the load event</span>), and
+ set its <code title="dom-media-networkState">networkState</code>
+ to <code
+ title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
+
+ <li><p>Run the remainder of the <span
+ title="concept-media-load-algorithm">resource selection
+ algorithm</span> steps asynchronously, allowing the <span
+ title="concept-task">task</span> that invoked this algorithm to
+ continue.</p></li>
+
+ </ol>
+
</li>
- <li><p>Set the element's <span>delaying-the-load-event flag</span>
- to true. This <span title="delay the load event">delays the load
- event</span>.</p></li>
+ <li><p class="note">By this point, the algorithm is running
+ asynchronously.</p></li>
- <li><p>Set the <code
- title="dom-media-networkState">networkState</code> to <code
- title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
-
<li><p><span>Queue a task</span> to <span>fire a progress
event</span> called <code title="event-loadstart">loadstart</code>
at the <span>media element</span>.</p></li>
@@ -21601,10 +21632,12 @@
node other than the end of the list. (This step might wait
forever.)</p></li>
- <li><p>Set the element's <span>delaying-the-load-event
+ <li><p>Before the <span title="concept-task">task</span> that
+ inserted the <code>source</code> element has a chance to
+ complete, set the element's <span>delaying-the-load-event
flag</span> back to true. This <span title="delay the load
- event">delays the load event</span> again, in case it hasn't gone
- been fired yet.</p></li>
+ event">delays the load event</span> again, in case it hasn't been
+ fired yet.</p></li>
<li><p>Jump back to the step labeled <i>search loop</i>.</p></li>
@@ -21997,10 +22030,9 @@
title="dom-media-networkState">networkState</code> has the value
<code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> is <span
title="insert an element into a document">inserted into a
- document</span>, the user agent must asynchronously invoke the
- <span>media element</span>'s <span
- title="concept-media-load-algorithm">resource selection
- algorithm</span>.</p>
+ document</span>, the user agent must invoke the <span>media
+ element</span>'s <span title="concept-media-load-algorithm">resource
+ selection algorithm</span>.</p>
</div>
@@ -22766,8 +22798,8 @@
title="dom-media-networkState">networkState</code> attribute has
the value <code
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
- agent must asynchronously invoke the <span>media element</span>'s
- <span title="concept-media-load-algorithm">resource selection
+ agent must invoke the <span>media element</span>'s <span
+ title="concept-media-load-algorithm">resource selection
algorithm</span>.</p></li>
<li>
@@ -22842,8 +22874,8 @@
title="dom-media-networkState">networkState</code> attribute has
the value <code
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
- agent must asynchronously invoke the <span>media element</span>'s
- <span title="concept-media-load-algorithm">resource selection
+ agent must invoke the <span>media element</span>'s <span
+ title="concept-media-load-algorithm">resource selection
algorithm</span>.</p></li>
<li><p>If the <span>media element</span>'s <code
More information about the Commit-Watchers
mailing list