[html5] r5111 - [giow] (0) Captions - Stage 11.3: completed the external timed track download pr [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Jun 25 12:22:19 PDT 2010


Author: ianh
Date: 2010-06-25 12:22:18 -0700 (Fri, 25 Jun 2010)
New Revision: 5111

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Captions - Stage 11.3: completed the external timed track download processing model, and did some more work on parsing WebSRT. Also: Update the 'fetch' algorithm to support doing same-origin enforcing, and made various parts of the spec use it; also made parts of the spec that acted like the algorith was sync actually invoke it that way.

Modified: complete.html
===================================================================
--- complete.html	2010-06-24 22:05:12 UTC (rev 5110)
+++ complete.html	2010-06-25 19:22:18 UTC (rev 5111)
@@ -209,7 +209,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Draft Standard — 24 June 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 25 June 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -561,7 +561,7 @@
   timed track cues</a></li>
          <li><a href=#timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</a></li>
          <li><a href=#cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</a></ol></li>
-       <li><a href=#websrt><span class=secno>4.8.10.11 </span>WebSRT</a>
+       <li><a href=#websrt-0><span class=secno>4.8.10.11 </span>WebSRT</a>
         <ol>
          <li><a href=#syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</a></li>
          <li><a href=#parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</a></ol></li>
@@ -6149,17 +6149,24 @@
 
   <p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or
   <a href=#url>URL</a>, optionally from an origin <i title="">origin</i>,
-  and optionally with a <i>synchronous flag</i> and/or a <i>manual
-  redirect flag</i>, the following steps must be run. (When a
-  <em>URL</em> is to be fetched, the URL identifies a resource to be
-  obtained.)</p>
+  and optionally with a <i>synchronous flag</i>, a <i>manual redirect
+  flag</i>, and/or a <i>force same-origin flag</i>, the following
+  steps must be run. (When a <em>URL</em> is to be fetched, the URL
+  identifies a resource to be obtained.)</p>
 
   <!-- if invoked with the synchronous flag, make sure to release the
   storage mutex first -->
 
-  <!-- synchronous flag is only used by sync-XHR, for legacy reasons;
-  don't use it in new features! -->
+  <!-- synchronous flag is only to be used in algorithms that are
+  themselves asynchronous! Only sync-XHR is allowed to make the
+  mistake of screwing that up. :-P -->
 
+  <!-- the force same-origin flag is for use in places where we'll be
+  moving to CORS one day; when used, the algorithm must be invoked
+  with a URL (not something else, like a POST request) whose origin is
+  the same as the /origin/, which must also be present, and the
+  algorithm must not be invoked with the manual redirect flag. -->
+
   <ol><li>
 
     <p>Generate the <i>address of the resource from which Request-URIs
@@ -6255,10 +6262,22 @@
     <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>,
     then:</p>
 
-    <dl class=switch><dt>If the <i>manual redirect flag</i> is set</dt>
+    <dl class=switch><dt>If the <i>force same-origin flag</i> is set and the
+     <a href=#url>URL</a> of the target of the redirect does not have the
+     <a href=#same-origin>same origin</a> as the <a href=#url>URL</a> for which the
+     <a href=#fetch>fetch</a> algorithm was invoked</dt>
 
      <dd>
 
+      <p>Abort these steps and return failure from this algorithm, as
+      if the remote host could not be contacted.</p>
+
+     </dd>
+
+     <dt>If the <i>manual redirect flag</i> is set</dt>
+
+     <dd>
+
       <p>Continue, using the fetched resource (the redirect) as the
       result of the algorithm.</p>
 
@@ -19818,7 +19837,7 @@
   <p>If the image was not fetched (e.g. because the UA's image support
   is disabled, or because the <code title=attr-img-src><a href=#attr-img-src>src</a></code>
   attribute's value is the empty string, or if the conditions in the
-  previous paragraph are not met, then the image is <em>not</em> <i title=img-available><a href=#img-available>available</a></i>.</p>
+  previous paragraph are not met), then the image is <em>not</em> <i title=img-available><a href=#img-available>available</a></i>.</p>
 
   <p>Whether the image is fetched successfully or not (e.g. whether
   the response code was a 2xx code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be
@@ -24514,8 +24533,9 @@
 
     <p>Begin to <a href=#fetch>fetch</a> the <var title="">current media
     resource</var>, from the <a href=#media-element>media element</a>'s
-    <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>.</p> <!-- not
-    http-origin privacy sensitive (looking forward to CORS here) -->
+    <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, with the <i>force
+    same-origin flag</i> set.</p> <!-- not http-origin privacy
+    sensitive (looking forward to CORS here) -->
 
     <p>Every 350ms (±200ms) or for every byte received, whichever
     is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a> to
@@ -26446,31 +26466,37 @@
 
    <li>
 
-    <p><i>Download</i>: <a href=#fetch>Fetch</a> <var title="">URL</var>, if
-    it isn't the empty string.</p><!-- http-origin privacy sensitive
-    --> <!-- XXX this should be _not_ http-origin privacy sensitive,
-    like <video src>, for consistency with that one, so that we can
-    extend it to CORS -->
+    <p><i>Download</i>: If <var title="">URL</var> is not the empty
+    string, and its <a href=#origin>origin</a> is the same as the <a href=#media-element>media
+    element</a>'s <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, then
+    <a href=#fetch>fetch</a> <var title="">URL</var>, from the <a href=#media-element>media
+    element</a>'s <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, with
+    the <i>force same-origin flag</i> set.</p> <!-- not http-origin
+    privacy sensitive (looking forward to CORS here) -->
 
     <p>The <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue
     a task">queued</a> by the <a href=#fetch title=fetch>fetching
     algorithm</a> on the <a href=#networking-task-source>networking task source</a> to
-    process the data as it is being fetched must run the following
-    steps:</p>
+    process the data as it is being fetched must examine the
+    resource's <a href=#content-type title=Content-Type>Content Type
+    metadata</a>, once it is available, if it ever is. If no <a href=#content-type title=Content-Type>Content Type metadata</a> is ever
+    available, or if the type is not recognised as a timed track
+    format, then the resource's format must be assumed to be
+    unsupported (this causes the load to fail, as described below). If
+    a type is obtained, and represents a supported timed track format,
+    then the resource's data must be passed to the appropriate parser
+    as it is received, with the <a href=#timed-track-list-of-cues>timed track list of cues</a>
+    being used for that parser's output.</p>
 
-    <ol><li><p><span class=XXX>...this is where cross-origin checks
-     go...</span></li>
-
-     <li><p class=XXX>determine format...</li>
-
-     <li><p class=XXX>hand off to appropriate parser...</li>
-
-    </ol><p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
-    any reason (network error, the server returns an error code, the
-    cross-origin checks mentioned above fail, etc), or if <var title="">URL</var> is the empty string, then <a href=#queue-a-task>queue a
-    task</a> to first change the <a href=#timed-track-readiness-state>timed track readiness state</a>
-    to <a href=#timed-track-failed-to-load title="timed track failed to load">failed to load</a>
-    and then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
+    <p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
+    any reason (network error, the server returns an error code, a
+    cross-origin check fails, etc), or if <var title="">URL</var> is
+    the empty string or has the wrong <a href=#origin>origin</a> as
+    determined by the condition at the start of this step, or if the
+    fetched resource is not in a supported format, then <a href=#queue-a-task>queue a
+    task</a> to first change the <a href=#timed-track-readiness-state>timed track readiness
+    state</a> to <a href=#timed-track-failed-to-load title="timed track failed to load">failed to
+    load</a> and then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
     element; and then, once that <a href=#concept-task title=concept-task>task</a> is <a href=#queue-a-task title="queue a
     task">queued</a>, move on to the step below labeled
     <i>monitoring</i>.</p>
@@ -26511,8 +26537,11 @@
      <li><p>Jump back to the top of the step labeled
      <i>download</i>.</li>
 
-    </ol></li>
+    </ol><p>Until one of the above circumstances occurs, the user agent
+    must remain on this step.</p>
 
+   </li>
+
    <li><p><i>Monitoring</i>: Wait until the <a href=#track-url>track URL</a> is
    no longer equal to <var title="">URL</var>, at the same time as the
    <a href=#timed-track-mode>timed track mode</a> is set to <a href=#timed-track-hidden title="timed track
@@ -26642,19 +26671,23 @@
 -->
 
 
-  <h5 id=websrt><span class=secno>4.8.10.11 </span>WebSRT</h5>
+  <h5 id=websrt-0><span class=secno>4.8.10.11 </span>WebSRT</h5>
 
-  <p>The WebSRT format (Web Subtitle Resource Tracks) is a format
-  intended for marking up external timed track resources.</p>
+  <p>The <dfn id=websrt>WebSRT</dfn>s format (Web Subtitle Resource Tracks) is a
+  format intended for marking up external timed track resources.</p>
 
 
   <h6 id=syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</h6>
 
   <p>A <dfn id=websrt-file>WebSRT file</dfn> must consist of a <a href=#websrt-file-body>WebSRT file
-  body</a> encoded as UTF-8.</p>
+  body</a> encoded as UTF-8 and labeled with the <a href=#mime-type>MIME
+  type</a> <code><a href=#text/srt>text/srt</a></code>.</p>
 
-  <p>A <dfn id=websrt-file-body>WebSRT file body</dfn> consists of zero or more <a href=#websrt-cue title="WebSRT cue">WebSRT cues</a> separated from each other by
-  two or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line
+  <p>A <dfn id=websrt-file-body>WebSRT file body</dfn> consists of zero or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line terminators</a>,
+  followed by zero or more <a href=#websrt-cue title="WebSRT cue">WebSRT cues</a>
+  separated from each other by two or more <a href=#websrt-line-terminator title="WebSRT line
+  terminator">WebSRT line terminators</a>, followed by zero or more
+  <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line
   terminators</a>.</p>
 
   <p>A <dfn id=websrt-cue>WebSRT cue</dfn> consists of the following components, in
@@ -26666,7 +26699,6 @@
    <li>A <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
    <li>Optionally, a <a href=#websrt-voice-declaration>WebSRT voice declaration</a>.</li>
    <li>One or more <a href=#websrt-cue-text-line title="WebSRT cue text line">WebSRT cue text lines</a>, each separated from the next by a <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
-   <li>Zero or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line terminators</a>.</li>
   </ol><p>A <dfn id=websrt-line-terminator>WebSRT line terminator</dfn> consists of one of the
   following:</p>
 
@@ -26701,9 +26733,14 @@
 
   <ol><li class=XXX>...
 
-  </ol><p class=XXX><dfn id=websrt-voice-declaration>WebSRT voice declaration</dfn>; <dfn id=websrt-cue-text-line>WebSRT cue text line</dfn>; <dfn id=websrt-timestamp>WebSRT timestamp</dfn></p>
+  </ol><p>A <dfn id=websrt-timestamp>WebSRT timestamp</dfn> consists of the following
+  components, in the given order:</p>
 
+  <ol><li class=XXX>...
 
+  </ol><p class=XXX><dfn id=websrt-voice-declaration>WebSRT voice declaration</dfn>; <dfn id=websrt-cue-text-line>WebSRT cue text line</dfn></p>
+
+
   <div class=impl>
 
   <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
@@ -26712,21 +26749,30 @@
   <a href=#timed-track-list-of-cues>timed track list of cues</a> <var title="">output</var>,
   must convert the bytes into a string of Unicode characters by
   interpreting them as UTF-8, and then must parse the resulting string
-  according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. A
-  <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and parsing
-  steps, is typically run asynchronously, with the input byte stream
-  being updated incrementally as the resource is downloaded; this is
-  called an <dfn id=incremental-websrt-parser>incremental WebSRT parser</dfn>.</p>
+  according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This
+  results in <a href=#timed-track-cue title="timed track cue">timed track cues</a>
+  being added to <var title="">output</var>.</p>
 
-  <p>When convering the bytes into Unicode characters, bytes or
+  <p>A <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and
+  parsing steps, is typically run asynchronously, with the input byte
+  stream being updated incrementally as the resource is downloaded;
+  this is called an <dfn id=incremental-websrt-parser>incremental WebSRT parser</dfn>.</p>
+
+  <p>The following <a href=#mime-type title="MIME type">MIME type<!--s--></a> must be
+  recognised as indicating the <a href=#websrt>WebSRT</a> format:</p>
+
+  <ul class=brief><li><code><a href=#text/srt>text/srt</a></code></li>
+  </ul><!--<p class="note">Not all of these MIME types are valid registered
+  types.</p>--><p>When converting the bytes into Unicode characters, bytes or
   sequences of bytes that are not valid UTF-8 sequences must be
   interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
   characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
 
   <p>The <dfn id=websrt-parser-algorithm>WebSRT parser algorithm</dfn> is as follows:</p>
 
-  <ol><li><p>Let <var title="">input</var> be the string being
-   parsed.</li>
+  <ol><li><p>Let <var title="">input</var> be the string being parsed,
+   after conversion to Unicode and after the replacement of U+0000
+   NULL characters described above.</li>
 
    <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
    string. In an <a href=#incremental-websrt-parser>incremental WebSRT parser</a>, when this
@@ -26755,7 +26801,7 @@
    <li><p>If <var title="">line</var> contains the three-character
    substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
    HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then jump to the step
-   labeled <i>timing</i> below.</li>
+   labeled <i>timings</i> below.</li>
 
    <li><p>Let <var title="">id</var> be <var title="">line</var>.<p></li>
 
@@ -26776,13 +26822,65 @@
    <li><p>If <var title="">line</var> is the empty string, then jump
    to the step labeled <i>cue loop</i>.</li>
 
-   <li><p><i>Timings</i>: <span class=XXX>...</span></li>
+   <li><p>If <var title="">line</var> does not contain the
+   three-character substring "<code title="">--></code>" (U+002D
+   HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then
+   jump to the step labeled <i>bad cue</i> below.</li>
 
+   <li><p><i>Timings</i>: <a href=#collect-websrt-cue-timings-and-settings>Collect WebSRT cue timings and
+   settings</a> from <var title="">line</var>. If that fails, jump
+   to the step labeled <i>bad cue</i>. Otherwise, let <var title="">start time</var> be the first collected time, <var title="">end time</var> be the second collected time, and
+   <span class=XXX>...settings...</span>.</li>
+
+   <li><p class=XXX>...voice...</li>
+
+   <li><p class=XXX>...cues...</li>
+
+   <li><p>Let <var title="">cue</var> be a newly created <a href=#timed-track-cue>timed
+   track cue</a>.</li>
+
+   <li><p class=XXX>...fill cue...</li>
+
+   <li><p>Jump to the step labeled <i>cue loop</i>.</li>
+
    <li><p><i>End</i>: The file has ended. Abort these steps. The
    <a href=#websrt-parser>WebSRT parser</a> has finished.</li>
 
-  </ol></div>
+  </ol><p>When the algorithm above requires that the user agent
+  <dfn id=collect-websrt-cue-timings-and-settings>collect WebSRT cue timings and settings</dfn> from a string,
+  the user agent must run the following algorithm. This algorithm
+  either fails, or returns two timestamps and <span class=XXX>...settings...</span>.</p>
 
+  <ol><li><p>Let <var title="">input</var> be the string being
+   parsed.</li>
+
+   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+   string.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p><a href=#collect-a-websrt-timestamp>Collect a WebSRT timestamp</a>. If that algorithm
+   fails, then abort these steps and return failure.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p class=XXX>check that we're at "<--" and fail if we're not</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p><a href=#collect-a-websrt-timestamp>Collect a WebSRT timestamp</a>. If that algorithm
+   fails, then abort these steps and return failure.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p class=XXX>...settings...</li>
+
+   <li><p>Return the two collected timestamps and <span class=XXX>...settings...</span>.</li>
+
+  </ol><p class=XXX><dfn id=collect-a-websrt-timestamp>Collect a WebSRT timestamp</dfn>...</p>
+
+  </div>
+
 <!--TT-->
 
 
@@ -59320,9 +59418,10 @@
    <li>
 
     <p><i>Fetching the manifest</i>: <a href=#fetch>Fetch</a> the resource
-    from <var title="">manifest URL</var>, and let <var title="">manifest</var> be that resource.</p> <!-- http-origin
-    privacy sensitive, though it doesn't matter, since this can never
-    be cross-origin -->
+    from <var title="">manifest URL</var> with the <i>synchronous
+    flag</i> set, and let <var title="">manifest</var> be that
+    resource.</p> <!-- http-origin privacy sensitive, though it
+    doesn't matter, since this can never be cross-origin -->
 
     <p>If the resource is labeled with the <a href=#mime-type>MIME type</a>
     <code><a href=#text/cache-manifest>text/cache-manifest</a></code>, parse <var title="">manifest</var> according to the <a href=#parse-a-manifest title="parse a
@@ -59559,14 +59658,15 @@
      <li>
 
       <p><a href=#fetch>Fetch</a> the resource, from the <a href=#origin>origin</a>
-      of the <a href=#url>URL</a> <var title="">manifest URL</var>. If
-      this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade
-      attempt</a>, then use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
-      cache</a> in <var title="">cache group</var> as an HTTP
-      cache, and honor HTTP caching semantics (such as expiration,
-      ETags, and so forth) with respect to that cache. User agents may
-      also have other caches in place that are also honored.</p> <!--
-      not http-origin privacy sensitive -->
+      of the <a href=#url>URL</a> <var title="">manifest URL</var>, with
+      the <i>synchronous flag</i> set and the <i>manual redirect
+      flag</i> set. If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>, then
+      use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a>
+      <a href=#application-cache>application cache</a> in <var title="">cache
+      group</var> as an HTTP cache, and honor HTTP caching semantics
+      (such as expiration, ETags, and so forth) with respect to that
+      cache. User agents may also have other caches in place that are
+      also honored.</p> <!-- not http-origin privacy sensitive -->
 
       <p class=note>If the resource in question is already being
       downloaded for other reasons then the existing download process
@@ -59742,9 +59842,10 @@
    <li>
 
     <p><a href=#fetch>Fetch</a> the resource from <var title="">manifest
-    URL</var> again, and let <var title="">second manifest</var> be
-    that resource.</p> <!-- http-origin privacy sensitive, though it
-    doesn't matter, since this can never be cross-origin -->
+    URL</var> again, with the <i>synchronous flag</i> set, and let
+    <var title="">second manifest</var> be that resource.</p> <!--
+    http-origin privacy sensitive, though it doesn't matter, since
+    this can never be cross-origin -->
 
    </li>
 
@@ -67871,17 +67972,15 @@
 
    <li>
 
-    <p>Attempt to <a href=#fetch>fetch</a> the resource identified by <var title="">url</var>, from the <var title="">owner origin</var>.</p>
-    <!-- not http-origin privacy sensitive -->
+    <p>Attempt to <a href=#fetch>fetch</a> the resource identified by <var title="">url</var>, from the <var title="">owner origin</var>,
+    with the <i>synchronous flag</i> set and the <i>force same-origin
+    flag</i> set.</p> <!-- not http-origin privacy sensitive (looking
+    forward to CORS) -->
 
-    <p>If the attempt fails, or if the attempt involves any redirects
-    to URIs that do not have the <a href=#same-origin>same origin</a> as <var title="">url</var> (even if the final URI is at the <a href=#same-origin>same
-    origin</a> as the original <var title="">url</var>), then for
-    each <code><a href=#worker>Worker</a></code> or <code><a href=#sharedworker>SharedWorker</a></code> object
-    associated with <var title="">worker global scope</var>,
-    <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
-    named <code title=event-error>error</code> at that
-    object. Abort these steps.</p>
+    <p>If the attempt fails, then for each <code><a href=#worker>Worker</a></code> or
+    <code><a href=#sharedworker>SharedWorker</a></code> object associated with <var title="">worker global scope</var>, <a href=#queue-a-task>queue a task</a> to
+    <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at that object. Abort these
+    steps.</p>
 
     <p>If the attempt succeeds, then convert the script resource to
     Unicode by assuming it was encoded as UTF-8, to obtain its <var title="">source</var>.</p>
@@ -68608,8 +68707,9 @@
 
     <p>Attempt to <a href=#fetch>fetch</a> each resource identified by the
     resulting <a href=#absolute-url title="absolute URL">absolute URLs</a>, from
-    the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a>.</p> <!-- not
-    http-origin privacy sensitive -->
+    the <a href=#entry-script>entry script</a>'s <a href=#origin>origin</a>, with the
+    <i>synchronous flag</i> set.</p> <!-- not http-origin privacy
+    sensitive -->
 
    </li>
 
@@ -68973,12 +69073,18 @@
    <li><p>Return a new <code><a href=#eventsource>EventSource</a></code> object, and continue
    these steps in the background (without blocking scripts).</li>
 
+   <li><p>If the <a href=#origin>origin</a> of the resulting <a href=#absolute-url>absolute
+   URL</a> is not the <a href=#same-origin>same origin</a> as that of the
+   <a href=#entry-script>entry script</a>, then act as if the resource could not be
+   obtained due to a network error and abort these steps.</li>
+
    <li>
 
     <p><a href=#fetch>Fetch</a> the resource identified by the resulting
     <a href=#absolute-url>absolute URL</a>, from the <a href=#entry-script>entry script</a>'s
-    <a href=#origin>origin</a>, and process it as described below.</p> <!--
-    not http-origin privacy sensitive -->
+    <a href=#origin>origin</a>, with the <i>force same-origin flag</i> set,
+    and process it as described below.</p> <!-- not http-origin
+    privacy sensitive (looking forward to CORS) -->
 
     <p class=note>The definition of the <a href=#fetch title=fetch>fetching</a> algorithm is such that if the
     browser is already fetching the resource identified by the given
@@ -69071,15 +69177,6 @@
   sources. User agents should ignore HTTP cache headers in the
   response, never caching event sources.</p>
 
-  <p>User agents must act as if the connection had failed due to a
-  network error if the <a href=#origin>origin</a> of the <a href=#url>URL</a> of
-  the resource to be <a href=#fetch title=fetch>fetched</a> is not the
-  <a href=#same-origin>same origin</a> as that of the <a href=#entry-script>entry script</a>
-  when the <code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code>
-  constructor is invoked.</p>
-
-  <!-- v2: add CORS support -->
-
   <hr><p>As data is received, the <a href=#concept-task title=concept-task>tasks</a>
   queued by the <a href=#networking-task-source>networking task source</a> to handle the data
   must act as follows.</p>

Modified: index
===================================================================
--- index	2010-06-24 22:05:12 UTC (rev 5110)
+++ index	2010-06-25 19:22:18 UTC (rev 5111)
@@ -213,7 +213,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
-    <h2 class="no-num no-toc">Draft Standard — 24 June 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 25 June 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -568,7 +568,7 @@
   timed track cues</a></li>
          <li><a href=#timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</a></li>
          <li><a href=#cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</a></ol></li>
-       <li><a href=#websrt><span class=secno>4.8.10.11 </span>WebSRT</a>
+       <li><a href=#websrt-0><span class=secno>4.8.10.11 </span>WebSRT</a>
         <ol>
          <li><a href=#syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</a></li>
          <li><a href=#parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</a></ol></li>
@@ -1281,7 +1281,7 @@
 
   <ul class=brief><li>The <code><a href=#devices>device</a></code> element.</li>
    <li>The <code title=attr-hyperlink-ping><a href=#ping>ping</a></code> attribute and related <a href=#hyperlink-auditing>hyperlink auditing</a> features.</li>
-   <li>The <a href=#timed-track>timed track</a> model for <a href=#media-element title="media element">media elements</a>, the <span>WebSRT</span> format, and related features.</li>
+   <li>The <a href=#timed-track>timed track</a> model for <a href=#media-element title="media element">media elements</a>, the <a href=#websrt>WebSRT</a> format, and related features.</li>
    <li>Rules for <a href=#atom>converting HTML to Atom</a>.</li>
   </ul><p>Features that are part of HTML (and this specification) but that
   are currently published as separate specifications as well, and are
@@ -6079,17 +6079,24 @@
 
   <p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or
   <a href=#url>URL</a>, optionally from an origin <i title="">origin</i>,
-  and optionally with a <i>synchronous flag</i> and/or a <i>manual
-  redirect flag</i>, the following steps must be run. (When a
-  <em>URL</em> is to be fetched, the URL identifies a resource to be
-  obtained.)</p>
+  and optionally with a <i>synchronous flag</i>, a <i>manual redirect
+  flag</i>, and/or a <i>force same-origin flag</i>, the following
+  steps must be run. (When a <em>URL</em> is to be fetched, the URL
+  identifies a resource to be obtained.)</p>
 
   <!-- if invoked with the synchronous flag, make sure to release the
   storage mutex first -->
 
-  <!-- synchronous flag is only used by sync-XHR, for legacy reasons;
-  don't use it in new features! -->
+  <!-- synchronous flag is only to be used in algorithms that are
+  themselves asynchronous! Only sync-XHR is allowed to make the
+  mistake of screwing that up. :-P -->
 
+  <!-- the force same-origin flag is for use in places where we'll be
+  moving to CORS one day; when used, the algorithm must be invoked
+  with a URL (not something else, like a POST request) whose origin is
+  the same as the /origin/, which must also be present, and the
+  algorithm must not be invoked with the manual redirect flag. -->
+
   <ol><li>
 
     <p>Generate the <i>address of the resource from which Request-URIs
@@ -6185,10 +6192,22 @@
     <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>,
     then:</p>
 
-    <dl class=switch><dt>If the <i>manual redirect flag</i> is set</dt>
+    <dl class=switch><dt>If the <i>force same-origin flag</i> is set and the
+     <a href=#url>URL</a> of the target of the redirect does not have the
+     <a href=#same-origin>same origin</a> as the <a href=#url>URL</a> for which the
+     <a href=#fetch>fetch</a> algorithm was invoked</dt>
 
      <dd>
 
+      <p>Abort these steps and return failure from this algorithm, as
+      if the remote host could not be contacted.</p>
+
+     </dd>
+
+     <dt>If the <i>manual redirect flag</i> is set</dt>
+
+     <dd>
+
       <p>Continue, using the fetched resource (the redirect) as the
       result of the algorithm.</p>
 
@@ -19748,7 +19767,7 @@
   <p>If the image was not fetched (e.g. because the UA's image support
   is disabled, or because the <code title=attr-img-src><a href=#attr-img-src>src</a></code>
   attribute's value is the empty string, or if the conditions in the
-  previous paragraph are not met, then the image is <em>not</em> <i title=img-available><a href=#img-available>available</a></i>.</p>
+  previous paragraph are not met), then the image is <em>not</em> <i title=img-available><a href=#img-available>available</a></i>.</p>
 
   <p>Whether the image is fetched successfully or not (e.g. whether
   the response code was a 2xx code <a href=#concept-http-equivalent-codes title=concept-http-equivalent-codes>or equivalent</a>) must be
@@ -24447,8 +24466,9 @@
 
     <p>Begin to <a href=#fetch>fetch</a> the <var title="">current media
     resource</var>, from the <a href=#media-element>media element</a>'s
-    <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>.</p> <!-- not
-    http-origin privacy sensitive (looking forward to CORS here) -->
+    <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, with the <i>force
+    same-origin flag</i> set.</p> <!-- not http-origin privacy
+    sensitive (looking forward to CORS here) -->
 
     <p>Every 350ms (±200ms) or for every byte received, whichever
     is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a> to
@@ -26379,31 +26399,37 @@
 
    <li>
 
-    <p><i>Download</i>: <a href=#fetch>Fetch</a> <var title="">URL</var>, if
-    it isn't the empty string.</p><!-- http-origin privacy sensitive
-    --> <!-- XXX this should be _not_ http-origin privacy sensitive,
-    like <video src>, for consistency with that one, so that we can
-    extend it to CORS -->
+    <p><i>Download</i>: If <var title="">URL</var> is not the empty
+    string, and its <a href=#origin>origin</a> is the same as the <a href=#media-element>media
+    element</a>'s <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, then
+    <a href=#fetch>fetch</a> <var title="">URL</var>, from the <a href=#media-element>media
+    element</a>'s <code><a href=#document>Document</a></code>'s <a href=#origin>origin</a>, with
+    the <i>force same-origin flag</i> set.</p> <!-- not http-origin
+    privacy sensitive (looking forward to CORS here) -->
 
     <p>The <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue
     a task">queued</a> by the <a href=#fetch title=fetch>fetching
     algorithm</a> on the <a href=#networking-task-source>networking task source</a> to
-    process the data as it is being fetched must run the following
-    steps:</p>
+    process the data as it is being fetched must examine the
+    resource's <a href=#content-type title=Content-Type>Content Type
+    metadata</a>, once it is available, if it ever is. If no <a href=#content-type title=Content-Type>Content Type metadata</a> is ever
+    available, or if the type is not recognised as a timed track
+    format, then the resource's format must be assumed to be
+    unsupported (this causes the load to fail, as described below). If
+    a type is obtained, and represents a supported timed track format,
+    then the resource's data must be passed to the appropriate parser
+    as it is received, with the <a href=#timed-track-list-of-cues>timed track list of cues</a>
+    being used for that parser's output.</p>
 
-    <ol><li><p><span class=XXX>...this is where cross-origin checks
-     go...</span></li>
-
-     <li><p class=XXX>determine format...</li>
-
-     <li><p class=XXX>hand off to appropriate parser...</li>
-
-    </ol><p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
-    any reason (network error, the server returns an error code, the
-    cross-origin checks mentioned above fail, etc), or if <var title="">URL</var> is the empty string, then <a href=#queue-a-task>queue a
-    task</a> to first change the <a href=#timed-track-readiness-state>timed track readiness state</a>
-    to <a href=#timed-track-failed-to-load title="timed track failed to load">failed to load</a>
-    and then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
+    <p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
+    any reason (network error, the server returns an error code, a
+    cross-origin check fails, etc), or if <var title="">URL</var> is
+    the empty string or has the wrong <a href=#origin>origin</a> as
+    determined by the condition at the start of this step, or if the
+    fetched resource is not in a supported format, then <a href=#queue-a-task>queue a
+    task</a> to first change the <a href=#timed-track-readiness-state>timed track readiness
+    state</a> to <a href=#timed-track-failed-to-load title="timed track failed to load">failed to
+    load</a> and then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
     element; and then, once that <a href=#concept-task title=concept-task>task</a> is <a href=#queue-a-task title="queue a
     task">queued</a>, move on to the step below labeled
     <i>monitoring</i>.</p>
@@ -26444,8 +26470,11 @@
      <li><p>Jump back to the top of the step labeled
      <i>download</i>.</li>
 
-    </ol></li>
+    </ol><p>Until one of the above circumstances occurs, the user agent
+    must remain on this step.</p>
 
+   </li>
+
    <li><p><i>Monitoring</i>: Wait until the <a href=#track-url>track URL</a> is
    no longer equal to <var title="">URL</var>, at the same time as the
    <a href=#timed-track-mode>timed track mode</a> is set to <a href=#timed-track-hidden title="timed track
@@ -26575,19 +26604,23 @@
 -->
 
 
-  <h5 id=websrt><span class=secno>4.8.10.11 </span>WebSRT</h5>
+  <h5 id=websrt-0><span class=secno>4.8.10.11 </span>WebSRT</h5>
 
-  <p>The WebSRT format (Web Subtitle Resource Tracks) is a format
-  intended for marking up external timed track resources.</p>
+  <p>The <dfn id=websrt>WebSRT</dfn>s format (Web Subtitle Resource Tracks) is a
+  format intended for marking up external timed track resources.</p>
 
 
   <h6 id=syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</h6>
 
   <p>A <dfn id=websrt-file>WebSRT file</dfn> must consist of a <a href=#websrt-file-body>WebSRT file
-  body</a> encoded as UTF-8.</p>
+  body</a> encoded as UTF-8 and labeled with the <a href=#mime-type>MIME
+  type</a> <code><a href=#text/srt>text/srt</a></code>.</p>
 
-  <p>A <dfn id=websrt-file-body>WebSRT file body</dfn> consists of zero or more <a href=#websrt-cue title="WebSRT cue">WebSRT cues</a> separated from each other by
-  two or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line
+  <p>A <dfn id=websrt-file-body>WebSRT file body</dfn> consists of zero or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line terminators</a>,
+  followed by zero or more <a href=#websrt-cue title="WebSRT cue">WebSRT cues</a>
+  separated from each other by two or more <a href=#websrt-line-terminator title="WebSRT line
+  terminator">WebSRT line terminators</a>, followed by zero or more
+  <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line
   terminators</a>.</p>
 
   <p>A <dfn id=websrt-cue>WebSRT cue</dfn> consists of the following components, in
@@ -26599,7 +26632,6 @@
    <li>A <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
    <li>Optionally, a <a href=#websrt-voice-declaration>WebSRT voice declaration</a>.</li>
    <li>One or more <a href=#websrt-cue-text-line title="WebSRT cue text line">WebSRT cue text lines</a>, each separated from the next by a <a href=#websrt-line-terminator>WebSRT line terminator</a>.</li>
-   <li>Zero or more <a href=#websrt-line-terminator title="WebSRT line terminator">WebSRT line terminators</a>.</li>
   </ol><p>A <dfn id=websrt-line-terminator>WebSRT line terminator</dfn> consists of one of the
   following:</p>
 
@@ -26634,9 +26666,14 @@
 
   <ol><li class=XXX>...
 
-  </ol><p class=XXX><dfn id=websrt-voice-declaration>WebSRT voice declaration</dfn>; <dfn id=websrt-cue-text-line>WebSRT cue text line</dfn>; <dfn id=websrt-timestamp>WebSRT timestamp</dfn></p>
+  </ol><p>A <dfn id=websrt-timestamp>WebSRT timestamp</dfn> consists of the following
+  components, in the given order:</p>
 
+  <ol><li class=XXX>...
 
+  </ol><p class=XXX><dfn id=websrt-voice-declaration>WebSRT voice declaration</dfn>; <dfn id=websrt-cue-text-line>WebSRT cue text line</dfn></p>
+
+
   <div class=impl>
 
   <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
@@ -26645,21 +26682,30 @@
   <a href=#timed-track-list-of-cues>timed track list of cues</a> <var title="">output</var>,
   must convert the bytes into a string of Unicode characters by
   interpreting them as UTF-8, and then must parse the resulting string
-  according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. A
-  <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and parsing
-  steps, is typically run asynchronously, with the input byte stream
-  being updated incrementally as the resource is downloaded; this is
-  called an <dfn id=incremental-websrt-parser>incremental WebSRT parser</dfn>.</p>
+  according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This
+  results in <a href=#timed-track-cue title="timed track cue">timed track cues</a>
+  being added to <var title="">output</var>.</p>
 
-  <p>When convering the bytes into Unicode characters, bytes or
+  <p>A <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and
+  parsing steps, is typically run asynchronously, with the input byte
+  stream being updated incrementally as the resource is downloaded;
+  this is called an <dfn id=incremental-websrt-parser>incremental WebSRT parser</dfn>.</p>
+
+  <p>The following <a href=#mime-type title="MIME type">MIME type<!--s--></a> must be
+  recognised as indicating the <a href=#websrt>WebSRT</a> format:</p>
+
+  <ul class=brief><li><code><a href=#text/srt>text/srt</a></code></li>
+  </ul><!--<p class="note">Not all of these MIME types are valid registered
+  types.</p>--><p>When converting the bytes into Unicode characters, bytes or
   sequences of bytes that are not valid UTF-8 sequences must be
   interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
   characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
 
   <p>The <dfn id=websrt-parser-algorithm>WebSRT parser algorithm</dfn> is as follows:</p>
 
-  <ol><li><p>Let <var title="">input</var> be the string being
-   parsed.</li>
+  <ol><li><p>Let <var title="">input</var> be the string being parsed,
+   after conversion to Unicode and after the replacement of U+0000
+   NULL characters described above.</li>
 
    <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
    string. In an <a href=#incremental-websrt-parser>incremental WebSRT parser</a>, when this
@@ -26688,7 +26734,7 @@
    <li><p>If <var title="">line</var> contains the three-character
    substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
    HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then jump to the step
-   labeled <i>timing</i> below.</li>
+   labeled <i>timings</i> below.</li>
 
    <li><p>Let <var title="">id</var> be <var title="">line</var>.<p></li>
 
@@ -26709,13 +26755,65 @@
    <li><p>If <var title="">line</var> is the empty string, then jump
    to the step labeled <i>cue loop</i>.</li>
 
-   <li><p><i>Timings</i>: <span class=XXX>...</span></li>
+   <li><p>If <var title="">line</var> does not contain the
+   three-character substring "<code title="">--></code>" (U+002D
+   HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then
+   jump to the step labeled <i>bad cue</i> below.</li>
 
+   <li><p><i>Timings</i>: <a href=#collect-websrt-cue-timings-and-settings>Collect WebSRT cue timings and
+   settings</a> from <var title="">line</var>. If that fails, jump
+   to the step labeled <i>bad cue</i>. Otherwise, let <var title="">start time</var> be the first collected time, <var title="">end time</var> be the second collected time, and
+   <span class=XXX>...settings...</span>.</li>
+
+   <li><p class=XXX>...voice...</li>
+
+   <li><p class=XXX>...cues...</li>
+
+   <li><p>Let <var title="">cue</var> be a newly created <a href=#timed-track-cue>timed
+   track cue</a>.</li>
+
+   <li><p class=XXX>...fill cue...</li>
+
+   <li><p>Jump to the step labeled <i>cue loop</i>.</li>
+
    <li><p><i>End</i>: The file has ended. Abort these steps. The
    <a href=#websrt-parser>WebSRT parser</a> has finished.</li>
 
-  </ol></div>
+  </ol><p>When the algorithm above requires that the user agent
+  <dfn id=collect-websrt-cue-timings-and-settings>collect WebSRT cue timings and settings</dfn> from a string,
+  the user agent must run the following algorithm. This algorithm
+  either fails, or returns two timestamps and <span class=XXX>...settings...</span>.</p>
 
+  <ol><li><p>Let <var title="">input</var> be the string being
+   parsed.</li>
+
+   <li><p>Let <var title="">position</var> be a pointer into <var title="">input</var>, initially pointing at the start of the
+   string.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p><a href=#collect-a-websrt-timestamp>Collect a WebSRT timestamp</a>. If that algorithm
+   fails, then abort these steps and return failure.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p class=XXX>check that we're at "<--" and fail if we're not</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p><a href=#collect-a-websrt-timestamp>Collect a WebSRT timestamp</a>. If that algorithm
+   fails, then abort these steps and return failure.</li>
+
+   <li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
+
+   <li><p class=XXX>...settings...</li>
+
+   <li><p>Return the two collected timestamps and <span class=XXX>...settings...</span>.</li>
+
+  </ol><p class=XXX><dfn id=collect-a-websrt-timestamp>Collect a WebSRT timestamp</dfn>...</p>
+
+  </div>
+
 <!--TT-->
 
 
@@ -59262,9 +59360,10 @@
    <li>
 
     <p><i>Fetching the manifest</i>: <a href=#fetch>Fetch</a> the resource
-    from <var title="">manifest URL</var>, and let <var title="">manifest</var> be that resource.</p> <!-- http-origin
-    privacy sensitive, though it doesn't matter, since this can never
-    be cross-origin -->
+    from <var title="">manifest URL</var> with the <i>synchronous
+    flag</i> set, and let <var title="">manifest</var> be that
+    resource.</p> <!-- http-origin privacy sensitive, though it
+    doesn't matter, since this can never be cross-origin -->
 
     <p>If the resource is labeled with the <a href=#mime-type>MIME type</a>
     <code><a href=#text/cache-manifest>text/cache-manifest</a></code>, parse <var title="">manifest</var> according to the <a href=#parse-a-manifest title="parse a
@@ -59501,14 +59600,15 @@
      <li>
 
       <p><a href=#fetch>Fetch</a> the resource, from the <a href=#origin>origin</a>
-      of the <a href=#url>URL</a> <var title="">manifest URL</var>. If
-      this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade
-      attempt</a>, then use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a> <a href=#application-cache>application
-      cache</a> in <var title="">cache group</var> as an HTTP
-      cache, and honor HTTP caching semantics (such as expiration,
-      ETags, and so forth) with respect to that cache. User agents may
-      also have other caches in place that are also honored.</p> <!--
-      not http-origin privacy sensitive -->
+      of the <a href=#url>URL</a> <var title="">manifest URL</var>, with
+      the <i>synchronous flag</i> set and the <i>manual redirect
+      flag</i> set. If this is an <a href=#concept-appcache-upgrade title=concept-appcache-upgrade>upgrade attempt</a>, then
+      use the <a href=#concept-appcache-newer title=concept-appcache-newer>newest</a>
+      <a href=#application-cache>application cache</a> in <var title="">cache
+      group</var> as an HTTP cache, and honor HTTP caching semantics
+      (such as expiration, ETags, and so forth) with respect to that
+      cache. User agents may also have other caches in place that are
+      also honored.</p> <!-- not http-origin privacy sensitive -->
 
       <p class=note>If the resource in question is already being
       downloaded for other reasons then the existing download process
@@ -59684,9 +59784,10 @@
    <li>
 
     <p><a href=#fetch>Fetch</a> the resource from <var title="">manifest
-    URL</var> again, and let <var title="">second manifest</var> be
-    that resource.</p> <!-- http-origin privacy sensitive, though it
-    doesn't matter, since this can never be cross-origin -->
+    URL</var> again, with the <i>synchronous flag</i> set, and let
+    <var title="">second manifest</var> be that resource.</p> <!--
+    http-origin privacy sensitive, though it doesn't matter, since
+    this can never be cross-origin -->
 
    </li>
 

Modified: source
===================================================================
--- source	2010-06-24 22:05:12 UTC (rev 5110)
+++ source	2010-06-25 19:22:18 UTC (rev 5111)
@@ -5727,17 +5727,24 @@
 
   <p>When a user agent is to <dfn>fetch</dfn> a resource or
   <span>URL</span>, optionally from an origin <i title="">origin</i>,
-  and optionally with a <i>synchronous flag</i> and/or a <i>manual
-  redirect flag</i>, the following steps must be run. (When a
-  <em>URL</em> is to be fetched, the URL identifies a resource to be
-  obtained.)</p>
+  and optionally with a <i>synchronous flag</i>, a <i>manual redirect
+  flag</i>, and/or a <i>force same-origin flag</i>, the following
+  steps must be run. (When a <em>URL</em> is to be fetched, the URL
+  identifies a resource to be obtained.)</p>
 
   <!-- if invoked with the synchronous flag, make sure to release the
   storage mutex first -->
 
-  <!-- synchronous flag is only used by sync-XHR, for legacy reasons;
-  don't use it in new features! -->
+  <!-- synchronous flag is only to be used in algorithms that are
+  themselves asynchronous! Only sync-XHR is allowed to make the
+  mistake of screwing that up. :-P -->
 
+  <!-- the force same-origin flag is for use in places where we'll be
+  moving to CORS one day; when used, the algorithm must be invoked
+  with a URL (not something else, like a POST request) whose origin is
+  the same as the /origin/, which must also be present, and the
+  algorithm must not be invoked with the manual redirect flag. -->
+
   <ol>
 
    <li>
@@ -5857,6 +5864,18 @@
 
     <dl class="switch">
 
+     <dt>If the <i>force same-origin flag</i> is set and the
+     <span>URL</span> of the target of the redirect does not have the
+     <span>same origin</span> as the <span>URL</span> for which the
+     <span>fetch</span> algorithm was invoked</dt>
+
+     <dd>
+
+      <p>Abort these steps and return failure from this algorithm, as
+      if the remote host could not be contacted.</p>
+
+     </dd>
+
      <dt>If the <i>manual redirect flag</i> is set</dt>
 
      <dd>
@@ -21062,7 +21081,7 @@
   <p>If the image was not fetched (e.g. because the UA's image support
   is disabled, or because the <code title="attr-img-src">src</code>
   attribute's value is the empty string, or if the conditions in the
-  previous paragraph are not met, then the image is <em>not</em> <i
+  previous paragraph are not met), then the image is <em>not</em> <i
   title="img-available">available</i>.</p>
 
   <p>Whether the image is fetched successfully or not (e.g. whether
@@ -26352,8 +26371,9 @@
 
     <p>Begin to <span>fetch</span> the <var title="">current media
     resource</var>, from the <span>media element</span>'s
-    <code>Document</code>'s <span>origin</span>.</p> <!-- not
-    http-origin privacy sensitive (looking forward to CORS here) -->
+    <code>Document</code>'s <span>origin</span>, with the <i>force
+    same-origin flag</i> set.</p> <!-- not http-origin privacy
+    sensitive (looking forward to CORS here) -->
 
     <p>Every 350ms (&#xB1;200ms) or for every byte received, whichever
     is <em>least</em> frequent, <span>queue a task</span> to
@@ -28632,36 +28652,38 @@
 
    <li>
 
-    <p><i>Download</i>: <span>Fetch</span> <var title="">URL</var>, if
-    it isn't the empty string.</p><!-- http-origin privacy sensitive
-    --> <!-- XXX this should be _not_ http-origin privacy sensitive,
-    like <video src>, for consistency with that one, so that we can
-    extend it to CORS -->
+    <p><i>Download</i>: If <var title="">URL</var> is not the empty
+    string, and its <span>origin</span> is the same as the <span>media
+    element</span>'s <code>Document</code>'s <span>origin</span>, then
+    <span>fetch</span> <var title="">URL</var>, from the <span>media
+    element</span>'s <code>Document</code>'s <span>origin</span>, with
+    the <i>force same-origin flag</i> set.</p> <!-- not http-origin
+    privacy sensitive (looking forward to CORS here) -->
 
     <p>The <span title="concept-task">tasks</span> <span title="queue
     a task">queued</span> by the <span title="fetch">fetching
     algorithm</span> on the <span>networking task source</span> to
-    process the data as it is being fetched must run the following
-    steps:</p>
+    process the data as it is being fetched must examine the
+    resource's <span title="Content-Type">Content Type
+    metadata</span>, once it is available, if it ever is. If no <span
+    title="Content-Type">Content Type metadata</span> is ever
+    available, or if the type is not recognised as a timed track
+    format, then the resource's format must be assumed to be
+    unsupported (this causes the load to fail, as described below). If
+    a type is obtained, and represents a supported timed track format,
+    then the resource's data must be passed to the appropriate parser
+    as it is received, with the <span>timed track list of cues</span>
+    being used for that parser's output.</p>
 
-    <ol>
-
-     <li><p><span class="XXX">...this is where cross-origin checks
-     go...</span></p></li>
-
-     <li><p class="XXX">determine format...</p></li>
-
-     <li><p class="XXX">hand off to appropriate parser...</p></li>
-
-    </ol>
-
     <p>If the <span title="fetch">fetching algorithm</span> fails for
-    any reason (network error, the server returns an error code, the
-    cross-origin checks mentioned above fail, etc), or if <var
-    title="">URL</var> is the empty string, then <span>queue a
-    task</span> to first change the <span>timed track readiness state</span>
-    to <span title="timed track failed to load">failed to load</span>
-    and then <span>fire a simple event</span> named <code
+    any reason (network error, the server returns an error code, a
+    cross-origin check fails, etc), or if <var title="">URL</var> is
+    the empty string or has the wrong <span>origin</span> as
+    determined by the condition at the start of this step, or if the
+    fetched resource is not in a supported format, then <span>queue a
+    task</span> to first change the <span>timed track readiness
+    state</span> to <span title="timed track failed to load">failed to
+    load</span> and then <span>fire a simple event</span> named <code
     title="event-error">error</code> at the <code>track</code>
     element; and then, once that <span
     title="concept-task">task</span> is <span title="queue a
@@ -28715,6 +28737,9 @@
 
     </ol>
 
+    <p>Until one of the above circumstances occurs, the user agent
+    must remain on this step.</p>
+
    </li>
 
    <li><p><i>Monitoring</i>: Wait until the <span>track URL</span> is
@@ -28850,18 +28875,22 @@
 
   <h5>WebSRT</h5>
 
-  <p>The WebSRT format (Web Subtitle Resource Tracks) is a format
-  intended for marking up external timed track resources.</p>
+  <p>The <dfn>WebSRT</dfn>s format (Web Subtitle Resource Tracks) is a
+  format intended for marking up external timed track resources.</p>
 
 
   <h6>Syntax</h6>
 
   <p>A <dfn>WebSRT file</dfn> must consist of a <span>WebSRT file
-  body</span> encoded as UTF-8.</p>
+  body</span> encoded as UTF-8 and labeled with the <span>MIME
+  type</span> <code>text/srt</code>.</p>
 
   <p>A <dfn>WebSRT file body</dfn> consists of zero or more <span
-  title="WebSRT cue">WebSRT cues</span> separated from each other by
-  two or more <span title="WebSRT line terminator">WebSRT line
+  title="WebSRT line terminator">WebSRT line terminators</span>,
+  followed by zero or more <span title="WebSRT cue">WebSRT cues</span>
+  separated from each other by two or more <span title="WebSRT line
+  terminator">WebSRT line terminators</span>, followed by zero or more
+  <span title="WebSRT line terminator">WebSRT line
   terminators</span>.</p>
 
   <p>A <dfn>WebSRT cue</dfn> consists of the following components, in
@@ -28874,7 +28903,6 @@
    <li>A <span>WebSRT line terminator</span>.</li>
    <li>Optionally, a <span>WebSRT voice declaration</span>.</li>
    <li>One or more <span title="WebSRT cue text line">WebSRT cue text lines</span>, each separated from the next by a <span>WebSRT line terminator</span>.</li>
-   <li>Zero or more <span title="WebSRT line terminator">WebSRT line terminators</span>.</li>
   </ol>
 
   <p>A <dfn>WebSRT line terminator</dfn> consists of one of the
@@ -28922,9 +28950,18 @@
 
   </ol>
 
-  <p class="XXX"><dfn>WebSRT voice declaration</dfn>; <dfn>WebSRT cue text line</dfn>; <dfn>WebSRT timestamp</dfn></p>
+  <p>A <dfn>WebSRT timestamp</dfn> consists of the following
+  components, in the given order:</p>
 
+  <ol>
 
+   <li class="XXX">...
+
+  </ol>
+
+  <p class="XXX"><dfn>WebSRT voice declaration</dfn>; <dfn>WebSRT cue text line</dfn></p>
+
+
   <div class="impl">
 
   <h6>Parsing</h6>
@@ -28933,13 +28970,26 @@
   <span>timed track list of cues</span> <var title="">output</var>,
   must convert the bytes into a string of Unicode characters by
   interpreting them as UTF-8, and then must parse the resulting string
-  according to the <span>WebSRT parser algorithm</span> below. A
-  <span>WebSRT parser</span>, specifically its conversion and parsing
-  steps, is typically run asynchronously, with the input byte stream
-  being updated incrementally as the resource is downloaded; this is
-  called an <dfn>incremental WebSRT parser</dfn>.</p>
+  according to the <span>WebSRT parser algorithm</span> below. This
+  results in <span title="timed track cue">timed track cues</span>
+  being added to <var title="">output</var>.</p>
 
-  <p>When convering the bytes into Unicode characters, bytes or
+  <p>A <span>WebSRT parser</span>, specifically its conversion and
+  parsing steps, is typically run asynchronously, with the input byte
+  stream being updated incrementally as the resource is downloaded;
+  this is called an <dfn>incremental WebSRT parser</dfn>.</p>
+
+  <p>The following <span title="MIME type">MIME type<!--s--></span> must be
+  recognised as indicating the <span>WebSRT</span> format:</p>
+
+  <ul class="brief">
+   <li><code>text/srt</code></li>
+  </ul>
+
+  <!--<p class="note">Not all of these MIME types are valid registered
+  types.</p>-->
+
+  <p>When converting the bytes into Unicode characters, bytes or
   sequences of bytes that are not valid UTF-8 sequences must be
   interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
   characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
@@ -28948,8 +28998,9 @@
 
   <ol>
 
-   <li><p>Let <var title="">input</var> be the string being
-   parsed.</p></li>
+   <li><p>Let <var title="">input</var> be the string being parsed,
+   after conversion to Unicode and after the replacement of U+0000
+   NULL characters described above.</p></li>
 
    <li><p>Let <var title="">position</var> be a pointer into <var
    title="">input</var>, initially pointing at the start of the
@@ -28982,7 +29033,7 @@
    <li><p>If <var title="">line</var> contains the three-character
    substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
    HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then jump to the step
-   labeled <i>timing</i> below.</p></li>
+   labeled <i>timings</i> below.</p></li>
 
    <li><p>Let <var title="">id</var> be <var
    title="">line</var>.<p></li>
@@ -29009,13 +29060,72 @@
    <li><p>If <var title="">line</var> is the empty string, then jump
    to the step labeled <i>cue loop</i>.</p></li>
 
-   <li><p><i>Timings</i>: <span class="XXX">...</span></p></li>
+   <li><p>If <var title="">line</var> does not contain the
+   three-character substring "<code title="">--></code>" (U+002D
+   HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then
+   jump to the step labeled <i>bad cue</i> below.</p></li>
 
+   <li><p><i>Timings</i>: <span>Collect WebSRT cue timings and
+   settings</span> from <var title="">line</var>. If that fails, jump
+   to the step labeled <i>bad cue</i>. Otherwise, let <var
+   title="">start time</var> be the first collected time, <var
+   title="">end time</var> be the second collected time, and
+   <span class="XXX">...settings...</span>.</p></li>
+
+   <li><p class="XXX">...voice...</p></li>
+
+   <li><p class="XXX">...cues...</p></li>
+
+   <li><p>Let <var title="">cue</var> be a newly created <span>timed
+   track cue</span>.</p></li>
+
+   <li><p class="XXX">...fill cue...</p></li>
+
+   <li><p>Jump to the step labeled <i>cue loop</i>.</p></li>
+
    <li><p><i>End</i>: The file has ended. Abort these steps. The
    <span>WebSRT parser</span> has finished.</p></li>
 
   </ol>
 
+  <p>When the algorithm above requires that the user agent
+  <dfn>collect WebSRT cue timings and settings</dfn> from a string,
+  the user agent must run the following algorithm. This algorithm
+  either fails, or returns two timestamps and <span class="XXX">...settings...</span>.</p>
+
+  <ol>
+
+   <li><p>Let <var title="">input</var> be the string being
+   parsed.</p></li>
+
+   <li><p>Let <var title="">position</var> be a pointer into <var
+   title="">input</var>, initially pointing at the start of the
+   string.</p></li>
+
+   <li><p><span>Skip whitespace</span>.</p></li>
+
+   <li><p><span>Collect a WebSRT timestamp</span>. If that algorithm
+   fails, then abort these steps and return failure.</p></li>
+
+   <li><p><span>Skip whitespace</span>.</p></li>
+
+   <li><p class="XXX">check that we're at "<--" and fail if we're not</p></li>
+
+   <li><p><span>Skip whitespace</span>.</p></li>
+
+   <li><p><span>Collect a WebSRT timestamp</span>. If that algorithm
+   fails, then abort these steps and return failure.</p></li>
+
+   <li><p><span>Skip whitespace</span>.</p></li>
+
+   <li><p class="XXX">...settings...</p></li>
+
+   <li><p>Return the two collected timestamps and <span class="XXX">...settings...</span>.</p></li>
+
+  </ol>
+
+  <p class="XXX"><dfn>Collect a WebSRT timestamp</dfn>...</p>
+
   </div>
 
 <!--START w3c-html--><!--TT-->
@@ -66901,10 +67011,10 @@
    <li>
 
     <p><i>Fetching the manifest</i>: <span>Fetch</span> the resource
-    from <var title="">manifest URL</var>, and let <var
-    title="">manifest</var> be that resource.</p> <!-- http-origin
-    privacy sensitive, though it doesn't matter, since this can never
-    be cross-origin -->
+    from <var title="">manifest URL</var> with the <i>synchronous
+    flag</i> set, and let <var title="">manifest</var> be that
+    resource.</p> <!-- http-origin privacy sensitive, though it
+    doesn't matter, since this can never be cross-origin -->
 
     <p>If the resource is labeled with the <span>MIME type</span>
     <code>text/cache-manifest</code>, parse <var
@@ -67191,15 +67301,16 @@
      <li>
 
       <p><span>Fetch</span> the resource, from the <span>origin</span>
-      of the <span>URL</span> <var title="">manifest URL</var>. If
-      this is an <span title="concept-appcache-upgrade">upgrade
-      attempt</span>, then use the <span
-      title="concept-appcache-newer">newest</span> <span>application
-      cache</span> in <var title="">cache group</var> as an HTTP
-      cache, and honor HTTP caching semantics (such as expiration,
-      ETags, and so forth) with respect to that cache. User agents may
-      also have other caches in place that are also honored.</p> <!--
-      not http-origin privacy sensitive -->
+      of the <span>URL</span> <var title="">manifest URL</var>, with
+      the <i>synchronous flag</i> set and the <i>manual redirect
+      flag</i> set. If this is an <span
+      title="concept-appcache-upgrade">upgrade attempt</span>, then
+      use the <span title="concept-appcache-newer">newest</span>
+      <span>application cache</span> in <var title="">cache
+      group</var> as an HTTP cache, and honor HTTP caching semantics
+      (such as expiration, ETags, and so forth) with respect to that
+      cache. User agents may also have other caches in place that are
+      also honored.</p> <!-- not http-origin privacy sensitive -->
 
       <p class="note">If the resource in question is already being
       downloaded for other reasons then the existing download process
@@ -67406,9 +67517,10 @@
    <li>
 
     <p><span>Fetch</span> the resource from <var title="">manifest
-    URL</var> again, and let <var title="">second manifest</var> be
-    that resource.</p> <!-- http-origin privacy sensitive, though it
-    doesn't matter, since this can never be cross-origin -->
+    URL</var> again, with the <i>synchronous flag</i> set, and let
+    <var title="">second manifest</var> be that resource.</p> <!--
+    http-origin privacy sensitive, though it doesn't matter, since
+    this can never be cross-origin -->
 
    </li>
 
@@ -76130,18 +76242,17 @@
    <li>
 
     <p>Attempt to <span>fetch</span> the resource identified by <var
-    title="">url</var>, from the <var title="">owner origin</var>.</p>
-    <!-- not http-origin privacy sensitive -->
+    title="">url</var>, from the <var title="">owner origin</var>,
+    with the <i>synchronous flag</i> set and the <i>force same-origin
+    flag</i> set.</p> <!-- not http-origin privacy sensitive (looking
+    forward to CORS) -->
 
-    <p>If the attempt fails, or if the attempt involves any redirects
-    to URIs that do not have the <span>same origin</span> as <var
-    title="">url</var> (even if the final URI is at the <span>same
-    origin</span> as the original <var title="">url</var>), then for
-    each <code>Worker</code> or <code>SharedWorker</code> object
-    associated with <var title="">worker global scope</var>,
-    <span>queue a task</span> to <span>fire a simple event</span>
-    named <code title="event-error">error</code> at that
-    object. Abort these steps.</p>
+    <p>If the attempt fails, then for each <code>Worker</code> or
+    <code>SharedWorker</code> object associated with <var
+    title="">worker global scope</var>, <span>queue a task</span> to
+    <span>fire a simple event</span> named <code
+    title="event-error">error</code> at that object. Abort these
+    steps.</p>
 
     <p>If the attempt succeeds, then convert the script resource to
     Unicode by assuming it was encoded as UTF-8, to obtain its <var
@@ -76994,8 +77105,9 @@
 
     <p>Attempt to <span>fetch</span> each resource identified by the
     resulting <span title="absolute URL">absolute URLs</span>, from
-    the <span>entry script</span>'s <span>origin</span>.</p> <!-- not
-    http-origin privacy sensitive -->
+    the <span>entry script</span>'s <span>origin</span>, with the
+    <i>synchronous flag</i> set.</p> <!-- not http-origin privacy
+    sensitive -->
 
    </li>
 
@@ -77418,12 +77530,18 @@
    <li><p>Return a new <code>EventSource</code> object, and continue
    these steps in the background (without blocking scripts).</p></li>
 
+   <li><p>If the <span>origin</span> of the resulting <span>absolute
+   URL</span> is not the <span>same origin</span> as that of the
+   <span>entry script</span>, then act as if the resource could not be
+   obtained due to a network error and abort these steps.</p></li>
+
    <li>
 
     <p><span>Fetch</span> the resource identified by the resulting
     <span>absolute URL</span>, from the <span>entry script</span>'s
-    <span>origin</span>, and process it as described below.</p> <!--
-    not http-origin privacy sensitive -->
+    <span>origin</span>, with the <i>force same-origin flag</i> set,
+    and process it as described below.</p> <!-- not http-origin
+    privacy sensitive (looking forward to CORS) -->
 
     <p class="note">The definition of the <span
     title="fetch">fetching</span> algorithm is such that if the
@@ -77543,15 +77661,6 @@
   sources. User agents should ignore HTTP cache headers in the
   response, never caching event sources.</p>
 
-  <p>User agents must act as if the connection had failed due to a
-  network error if the <span>origin</span> of the <span>URL</span> of
-  the resource to be <span title="fetch">fetched</span> is not the
-  <span>same origin</span> as that of the <span>entry script</span>
-  when the <code title="dom-EventSource">EventSource()</code>
-  constructor is invoked.</p>
-
-  <!-- v2: add CORS support -->
-
   <hr>
 
   <p>As data is received, the <span title="concept-task">tasks</span>




More information about the Commit-Watchers mailing list