Skip to content
Permalink
Browse files
[giow] (1) Make sure once you call closed() that EventSource objects …
…stay down.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=14331

git-svn-id: http://svn.whatwg.org/webapps@6772 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 27, 2011
1 parent de26158 commit f4ec649b5bffefbb264e29cb7b423ab4f6112a75
Showing with 212 additions and 93 deletions.
  1. +62 −30 complete.html
  2. +62 −30 index
  3. +88 −33 source
@@ -80195,9 +80195,10 @@ <h4 id=processing-model-5><span class=secno>11.2.3 </span>Processing model</h4>
<a href=#networking-task-source>networking task source</a> places on the <a href=#task-queue>task
queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
for such a resource (with the correct <a href=#mime-type>MIME type</a>) has
completed must <a href=#reestablish-the-connection>reestablish the connection</a>. This applies
whether the connection is closed gracefully or unexpectedly. It
doesn't apply for the error conditions listed below.</p>
completed must cause the user agent to asynchronously
<a href=#reestablish-the-connection>reestablish the connection</a>. This applies whether the
connection is closed gracefully or unexpectedly. It doesn't apply
for the error conditions listed below.</p>

<p>HTTP 200 OK responses that have a <a href=#content-type>Content-Type</a>
specifying an unsupported type (including the
@@ -80238,36 +80239,67 @@ <h4 id=processing-model-5><span class=secno>11.2.3 </span>Processing model</h4>
<p>For non-HTTP protocols, UAs should act in equivalent ways.</p>

<hr><p>When a user agent is to <dfn id=announce-the-connection>announce the connection</dfn>, the
user agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-open>open</code> at
the <code><a href=#eventsource>EventSource</a></code> object.</p>
user agent must <a href=#queue-a-task>queue a task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event title="fire
a simple event">fires a simple event</a> named <code title=event-open>open</code> at the <code><a href=#eventsource>EventSource</a></code>
object.</p>

<p>When a user agent is to <dfn id=reestablish-the-connection>reestablish the connection</dfn>,
the user agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code> and
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object, and then, after a delay equal to the reconnection time of
the event source, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
still set to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, once again do
a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the <a href=#absolute-url>absolute
URL</a> of the event source resource, with the <i>mode</i> being
<a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use
Credentials</a>, and the <i title="">origin</i> being the same as the
<a href=#origin>origin</a> used in the original request triggered by the
<code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code> constructor<!--,
and the <i>default origin behaviour</i> set to <i>fail</i> (though
it has no effect in the "Use Credentials" mode)-->, and process the
resource obtained in this fashion, if any, as described in this
section.</p>
the user agent must run the following steps. These steps are run
asynchronously, not as part of a <a href=#concept-task title=concept-task>task</a>. (The tasks that it queues, of
course, are run like normal tasks and not asynchronously.)</p>

<ol><li>

<p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

<ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, abort
the task.</li>

<li><p>Set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>.</li>

<li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object.</li>

</ol></li>

<li><p>Wait a delay equal to the reconnection time of the event
source.</li>

<li><p>Wait until the aforementioned task has run, if it has not
yet run.</li>

<li>

<p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

<ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
not set to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, abort these
steps.</li>

<li><p>Perform a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of
the <a href=#absolute-url>absolute URL</a> of the event source resource, with
the <i>mode</i> being <a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use Credentials</a>,
and the <i title="">origin</i> being the same as the
<a href=#origin>origin</a> used in the original request triggered by the
<code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code>
constructor<!--, and the <i>default origin behaviour</i> set to
<i>fail</i> (though it has no effect in the "Use Credentials"
mode)-->, and process the resource obtained in this fashion, if
any, as described earlier in this section.</li>

</ol></li>

<p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user
agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-error>error</code> at
the <code><a href=#eventsource>EventSource</a></code> object. <strong>Once the user agent has
<a href=#fail-the-connection title="fail the connection">failed the connection</a>, it
does <em>not</em> attempt to reconnect!</strong></p>
</ol><p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user
agent must <a href=#queue-a-task>queue a task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object. <strong>Once the user agent has <a href=#fail-the-connection title="fail the
connection">failed the connection</a>, it does <em>not</em>
attempt to reconnect!</strong></p>

<hr><p>The <a href=#task-source>task source</a> for any <a href=#concept-task title=concept-task>tasks</a> that are <a href=#queue-a-task title="queue a
task">queued</a> by <code><a href=#eventsource>EventSource</a></code> objects is the
92 index
@@ -80195,9 +80195,10 @@ interface <dfn id=eventsource>EventSource</dfn> : <a href=#eventtarget>EventTarg
<a href=#networking-task-source>networking task source</a> places on the <a href=#task-queue>task
queue</a> once the <a href=#fetch title=fetch>fetching algorithm</a>
for such a resource (with the correct <a href=#mime-type>MIME type</a>) has
completed must <a href=#reestablish-the-connection>reestablish the connection</a>. This applies
whether the connection is closed gracefully or unexpectedly. It
doesn't apply for the error conditions listed below.</p>
completed must cause the user agent to asynchronously
<a href=#reestablish-the-connection>reestablish the connection</a>. This applies whether the
connection is closed gracefully or unexpectedly. It doesn't apply
for the error conditions listed below.</p>

<p>HTTP 200 OK responses that have a <a href=#content-type>Content-Type</a>
specifying an unsupported type (including the
@@ -80238,36 +80239,67 @@ interface <dfn id=eventsource>EventSource</dfn> : <a href=#eventtarget>EventTarg
<p>For non-HTTP protocols, UAs should act in equivalent ways.</p>

<hr><p>When a user agent is to <dfn id=announce-the-connection>announce the connection</dfn>, the
user agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-open>open</code> at
the <code><a href=#eventsource>EventSource</a></code> object.</p>
user agent must <a href=#queue-a-task>queue a task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-OPEN><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event title="fire
a simple event">fires a simple event</a> named <code title=event-open>open</code> at the <code><a href=#eventsource>EventSource</a></code>
object.</p>

<p>When a user agent is to <dfn id=reestablish-the-connection>reestablish the connection</dfn>,
the user agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code> and
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object, and then, after a delay equal to the reconnection time of
the event source, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
still set to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, once again do
a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the <a href=#absolute-url>absolute
URL</a> of the event source resource, with the <i>mode</i> being
<a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use
Credentials</a>, and the <i title="">origin</i> being the same as the
<a href=#origin>origin</a> used in the original request triggered by the
<code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code> constructor<!--,
and the <i>default origin behaviour</i> set to <i>fail</i> (though
it has no effect in the "Use Credentials" mode)-->, and process the
resource obtained in this fashion, if any, as described in this
section.</p>
the user agent must run the following steps. These steps are run
asynchronously, not as part of a <a href=#concept-task title=concept-task>task</a>. (The tasks that it queues, of
course, are run like normal tasks and not asynchronously.)</p>

<ol><li>

<p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

<ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, abort
the task.</li>

<li><p>Set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>.</li>

<li><p><a href=#fire-a-simple-event>Fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object.</li>

</ol></li>

<li><p>Wait a delay equal to the reconnection time of the event
source.</li>

<li><p>Wait until the aforementioned task has run, if it has not
yet run.</li>

<li>

<p><a href=#queue-a-task>Queue a task</a> to run the following steps:</p>

<ol><li><p>If the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
not set to <code title=dom-EventSource-CONNECTING><a href=#dom-eventsource-connecting>CONNECTING</a></code>, abort these
steps.</li>

<li><p>Perform a <a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of
the <a href=#absolute-url>absolute URL</a> of the event source resource, with
the <i>mode</i> being <a href=#attr-crossorigin-use-credentials title=attr-crossorigin-use-credentials>Use Credentials</a>,
and the <i title="">origin</i> being the same as the
<a href=#origin>origin</a> used in the original request triggered by the
<code title=dom-EventSource><a href=#dom-eventsource>EventSource()</a></code>
constructor<!--, and the <i>default origin behaviour</i> set to
<i>fail</i> (though it has no effect in the "Use Credentials"
mode)-->, and process the resource obtained in this fashion, if
any, as described earlier in this section.</li>

</ol></li>

<p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user
agent must <a href=#queue-a-task>queue a task</a> to set the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-error>error</code> at
the <code><a href=#eventsource>EventSource</a></code> object. <strong>Once the user agent has
<a href=#fail-the-connection title="fail the connection">failed the connection</a>, it
does <em>not</em> attempt to reconnect!</strong></p>
</ol><p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user
agent must <a href=#queue-a-task>queue a task</a> which, if the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
set to a value other than <code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code title=dom-EventSource-readyState><a href=#dom-eventsource-readystate>readyState</a></code> attribute to
<code title=dom-EventSource-CLOSED><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a> named <code title=event-error>error</code> at the <code><a href=#eventsource>EventSource</a></code>
object. <strong>Once the user agent has <a href=#fail-the-connection title="fail the
connection">failed the connection</a>, it does <em>not</em>
attempt to reconnect!</strong></p>

<hr><p>The <a href=#task-source>task source</a> for any <a href=#concept-task title=concept-task>tasks</a> that are <a href=#queue-a-task title="queue a
task">queued</a> by <code><a href=#eventsource>EventSource</a></code> objects is the

0 comments on commit f4ec649

Please sign in to comment.