HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6624

SVNBugCommentTime (UTC)
662413812[Gecko] [Internet Explorer] [Opera] [Webkit] Rephrase how EventSource is protected from garbage collection to make more sense. Note that EventSource objects are allowed to survive the bfcache (unlike, say, WebSocket connections).2011-10-04 19:55
Index: source
===================================================================
--- source	(revision 6623)
+++ source	(revision 6624)
@@ -74673,6 +74673,13 @@
 
    <li><p>If the <code>Document</code>'s <var
    title="concept-document-salvageable">salvageable</var> state is
+   false, <span title="concept-EventSource-forcibly-close">forcibly
+   close</span> any <code>EventSource</code> objects that whose
+   constructor was invoked from the <code>Document</code>'s
+   <code>Window</code> object.</p></li>
+
+   <li><p>If the <code>Document</code>'s <var
+   title="concept-document-salvageable">salvageable</var> state is
    false, empty the <code>Document</code>'s <code>Window</code>'s
    <span>list of active timeouts</span> and its <span>list of active
    intervals</span>.</p></li>
@@ -90225,11 +90232,10 @@
   changes.</p>
 
   <p>The <dfn title="dom-EventSource-close"><code>close()</code></dfn>
-  method must close the connection, if any; must abort any instances
-  of the <span>fetch</span> algorithm started for this
-  <code>EventSource</code> object; and must set the <code
-  title="dom-EventSource-readyState">readyState</code> attribute to
-  <code title="dom-EventSource-CLOSED">CLOSED</code>.</p>
+  method must abort any instances of the <span>fetch</span> algorithm
+  started for this <code>EventSource</code> object, and must set the
+  <code title="dom-EventSource-readyState">readyState</code> attribute
+  to <code title="dom-EventSource-CLOSED">CLOSED</code>.</p>
 
   <p>The following are the <span>event handlers</span> (and their
   corresponding <span title="event handler event type">event handler
@@ -90362,21 +90368,20 @@
   <hr>
 
   <p>When a user agent is to <dfn>announce the connection</dfn>, the
-  user agent must set the <code
+  user agent must <span>queue a task</span> to set the <code
   title="dom-EventSource-readyState">readyState</code> attribute to
-  <code title="dom-EventSource-OPEN">OPEN</code> and <span>queue a
-  task</span> to <span>fire a simple event</span> named <code
-  title="event-open">open</code> at the
-  <code>EventSource</code> object.</p>
+  <code title="dom-EventSource-OPEN">OPEN</code> and <span>fire a
+  simple event</span> named <code title="event-open">open</code> at
+  the <code>EventSource</code> object.</p>
 
   <p>When a user agent is to <dfn>reestablish the connection</dfn>,
-  the user agent must set the <code
+  the user agent must <span>queue a task</span> to set the <code
   title="dom-EventSource-readyState">readyState</code> attribute to
-  <code title="dom-EventSource-CONNECTING">CONNECTING</code>,
-  <span>queue a task</span> to <span>fire a simple event</span> named
-  <code title="event-error">error</code> at the
-  <code>EventSource</code> object, and then, after a delay equal to
-  the reconnection time of the event source, if the <code
+  <code title="dom-EventSource-CONNECTING">CONNECTING</code> and
+  <span>fire a simple event</span> named <code
+  title="event-error">error</code> at the <code>EventSource</code>
+  object, and then, after a delay equal to the reconnection time of
+  the event source, if the <code
   title="dom-EventSource-readyState">readyState</code> attribute is
   still set to <code
   title="dom-EventSource-CONNECTING">CONNECTING</code>, once again do
@@ -90392,14 +90397,13 @@
   section.</p>
 
   <p>When a user agent is to <dfn>fail the connection</dfn>, the user
-  agent must set the <code
+  agent must <span>queue a task</span> to set the <code
   title="dom-EventSource-readyState">readyState</code> attribute to
-  <code title="dom-EventSource-CLOSED">CLOSED</code> and <span>queue a
-  task</span> to <span>fire a simple event</span> named <code
-  title="event-error">error</code> at the <code>EventSource</code>
-  object. <strong>Once the user agent has <span title="fail the
-  connection">failed the connection</span>, it does <em>not</em>
-  attempt to reconnect!</strong></p>
+  <code title="dom-EventSource-CLOSED">CLOSED</code> and <span>fire a
+  simple event</span> named <code title="event-error">error</code> at
+  the <code>EventSource</code> object. <strong>Once the user agent has
+  <span title="fail the connection">failed the connection</span>, it
+  does <em>not</em> attempt to reconnect!</strong></p>
 
   <hr>
 
@@ -90850,26 +90854,54 @@
   <h4>Garbage collection</h4>
 
   <p>While an <code>EventSource</code> object's <code
-  title="dom-EventSource-readyState">readyState</code> is not <code
-  title="dom-EventSource-CLOSED">CLOSED</code>, and the object has one
-  or more event listeners registered for <code
-  title="event-message">message</code> events, there must be a strong
+  title="dom-EventSource-readyState">readyState</code> is <code
+  title="dom-EventSource-CONNECTING">CONNECTING</code>, and the object
+  has one or more event listeners registered for <code
+  title="event-open">open</code>, <code
+  title="event-message">message</code> or <code
+  title="event-error">error</code> events, there must be a strong
   reference from the <code>Window</code> or <code>WorkerUtils</code>
   object that the <code>EventSource</code> object's constructor was
   invoked from to the <code>EventSource</code> object itself.</p>
 
+  <p>While an <code>EventSource</code> object's <code
+  title="dom-EventSource-readyState">readyState</code> is <code
+  title="dom-EventSource-OPEN">OPEN</code>, and the object has one or
+  more event listeners registered for <code
+  title="event-message">message</code> or <code
+  title="event-error">error</code> events, there must be a strong
+  reference from the <code>Window</code> or <code>WorkerUtils</code>
+  object that the <code>EventSource</code> object's constructor was
+  invoked from to the <code>EventSource</code> object itself.</p>
+
+  <p>While there is a task queued by an <code>EventSource</code>
+  object on the <span>remote event task source</span>, there must be a
+  strong reference from the <code>Window</code> or
+  <code>WorkerUtils</code> object that the <code>EventSource</code>
+  object's constructor was invoked from to that
+  <code>EventSource</code> object.</p>
+
+  <p>If a user agent is to <dfn
+  title="concept-EventSource-forcibly-close">forcibly close</dfn> an
+  <code>EventSource</code> object (this happens when a
+  <code>Document</code> object goes away permanently), the user agent
+  must abort any instances of the <span>fetch</span> algorithm started
+  for this <code>EventSource</code> object, and must set the <code
+  title="dom-EventSource-readyState">readyState</code> attribute to
+  <code title="dom-EventSource-CLOSED">CLOSED</code>.</p> <!-- same as
+  calling close() -->
+
   <p>If an <code>EventSource</code> object is garbage collected while
-  its connection is still open, the user agent must cancel any
-  instance of the <span title="fetch">fetch</span> algorithm opened by
-  this <code>EventSource</code>, discarding any <span
-  title="concept-task">tasks</span> <span title="queue a
-  task">queued</span> for them, and discarding any further data
-  received from the network for them.</p>
+  its connection is still open, the user agent must abort any instance
+  of the <span title="fetch">fetch</span> algorithm opened by this
+  <code>EventSource</code>.</p> <!-- no need to throw tasks away or
+  anything; for it to get garbage collected, there can't be anything
+  that would be able to receive those events -->
 
   <p class="note">It's possible for one active network connection to
   be shared by multiple <code>EventSource</code> objects and their
   <span>fetch</span> algorithms, which is why the above is phrased in
-  terms of canceling the <span>fetch</span> algorithm and not the
+  terms of aborting the <span>fetch</span> algorithm and not the
   actual underlying download.</p>
 
 

|