websocket; hixie: Prepare the spec for exposing failed closes. (whatwg r4817)

websocket; hixie: Prepare the spec for exposing failed closes. (whatwg
r4817)

http://dev.w3.org/cvsweb/html5/websockets/Overview.html?r1=1.159&r2=1.160&f=h
http://html5.org/tools/web-apps-tracker?from=4816&to=4817

===================================================================
RCS file: /sources/public/html5/websockets/Overview.html,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- Overview.html 2 Mar 2010 10:42:20 -0000 1.159
+++ Overview.html 2 Mar 2010 10:56:17 -0000 1.160
@@ -282,7 +282,8 @@
  <li><a href="#the-websocket-interface"><span class="secno">4 </span>The <code>WebSocket</code> interface</a></li>
  <li><a href="#feedback-from-the-protocol"><span class="secno">5 </span>Feedback from the protocol</a>
   <ol>
-   <li><a href="#garbage-collection"><span class="secno">5.1 </span>Garbage collection</a></ol></li>
+   <li><a href="#event-definitions"><span class="secno">5.1 </span>Event definitions</a></li>
+   <li><a href="#garbage-collection"><span class="secno">5.2 </span>Garbage collection</a></ol></li>
  <li><a class="no-num" href="#references">References</a></ol>
 <!--end-toc--><hr><h2 id="network-intro"><span class="secno">1 </span>Introduction</h2><p><i>This section is non-normative.</i><p>To enable Web applications to maintain bidirectional
   communications with server-side processes, this specification
@@ -505,19 +506,29 @@
   is <code title="dom-WebSocket-OPEN"><a href="#dom-websocket-open">OPEN</a></code> (1), and if so,
   <span>fire a simple event</span> named <code title="event-messageerror">messageerror</code> at the <code><a href="#websocket">WebSocket</a></code>
   object.<p id="closeWebSocket">When the <i>WebSocket connection is
-  closed</i>, the user agent must <span>queue a task</span> to first
-  change the <code title="dom-WebSocket-readyState"><a href="#dom-websocket-readystate">readyState</a></code>
-  attribute's value to <code title="dom-WebSocket-CLOSED"><a href="#dom-websocket-closed">CLOSED</a></code> (2), and then <span>fire
-  a simple event</span> named <code title="event-close">close</code>
-  at the <code><a href="#websocket">WebSocket</a></code> object. (If the <code title="dom-WebSocket-close"><a href="#dom-websocket-close">close()</a></code> method was called, the
-  <code title="dom-WebSocket-readyState"><a href="#dom-websocket-readystate">readyState</a></code> attribute's
-  value will already be set to <code title="dom-WebSocket-CLOSED"><a href="#dom-websocket-closed">CLOSED</a></code> (2) when this task
+  closed</i>, the user agent must create an event that uses the
+  <code><a href="#closeevent">CloseEvent</a></code> interface, with the event name <code title="event-close">close</code>, which does not bubble, is not
+  cancelable, has no default action, and whose <code title="dom-CloseEvent-wasClean"><a href="#dom-closeevent-wasclean">wasClean</a></code> attribute is set to
+  false, and <span>queue a task</span> to first change the <code title="dom-WebSocket-readyState"><a href="#dom-websocket-readystate">readyState</a></code> attribute's value
+  to <code title="dom-WebSocket-CLOSED"><a href="#dom-websocket-closed">CLOSED</a></code> (2), and then
+  dispatch the event at the <code><a href="#websocket">WebSocket</a></code> object. (If the
+  <code title="dom-WebSocket-close"><a href="#dom-websocket-close">close()</a></code> method was called,
+  the <code title="dom-WebSocket-readyState"><a href="#dom-websocket-readystate">readyState</a></code>
+  attribute's value will already be set to <code title="dom-WebSocket-CLOSED"><a href="#dom-websocket-closed">CLOSED</a></code> (2) when this task
   runs.)<p>The <span>task source</span> for all <span title="concept-task">tasks</span> <span title="queue a
   task">queued</span> in this section is the <dfn id="websocket-task-source">WebSocket task
-  source</dfn>.<h3 id="garbage-collection"><span class="secno">5.1 </span>Garbage collection</h3><p>A <code><a href="#websocket">WebSocket</a></code> object with an open connection must not
+  source</dfn>.<h3 id="event-definitions"><span class="secno">5.1 </span>Event definitions</h3><pre class="idl">interface <dfn id="closeevent">CloseEvent</dfn> : <span>Event</span> {
+  readonly attribute boolean <a href="#dom-closeevent-wasclean" title="dom-CloseEvent-wasClean">wasClean</a>;
+  void <a href="#dom-closeevent-initcloseevent" title="dom-CloseEvent-initCloseEvent">initCloseEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in boolean wasCleanArg);
+};</pre><p>The <dfn id="dom-closeevent-initcloseevent" title="dom-CloseEvent-initCloseEvent"><code>initCloseEvent()</code></dfn>
+  method must initialize the event in a manner analogous to the
+  similarly-named method in the DOM Events interfaces. <a href="#refsDOMEVENTS">[DOMEVENTS]</a><p>The <dfn id="dom-closeevent-wasclean" title="dom-CloseEvent-wasClean"><code>wasClean</code></dfn>
+  attribute represents whether the connection closed cleanly or
+  not.<h3 id="garbage-collection"><span class="secno">5.2 </span>Garbage collection</h3><p>A <code><a href="#websocket">WebSocket</a></code> object with an open connection must not
   be garbage collected if there are any event listeners registered for
   <code title="event-message">message</code> events.<p>If a <code><a href="#websocket">WebSocket</a></code> object is garbage collected while its
-  connection is still open, the user agent must <span>close the WebSocket connection</span>.<h2 class="no-num" id="references">References</h2><!--REFS--><p>All references are normative unless marked "Non-normative".</p><!-- Dates are only included for standards older than the Web,
+  connection is still open, the user agent must <span>close the
+  WebSocket connection</span>.<h2 class="no-num" id="references">References</h2><!--REFS--><p>All references are normative unless marked "Non-normative".</p><!-- Dates are only included for standards older than the Web,
   because the newer ones keep changing. --><dl><dt id="refsDOMCORE">[DOMCORE]</dt>
    <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core/">Document
    Object Model (DOM) Level 3 Core Specification</a></cite>, A. Le
@@ -528,6 +539,17 @@
    DOM Core</a></cite>, S. Pieters. W3C.</dd>
    -->
 
+   <dt id="refsDOMEVENTS">[DOMEVENTS]</dt>
+   <!--
+   <dd><cite><a
+   href="http://www.w3.org/TR/DOM-Level-3-Events/">Document Object
+   Model (DOM) Level 3 Events Specification</a></cite>,
+   B. H&ouml;hrmann, P. Le Hegaret, T. Pixley. W3C.</dd>
+   -->
+   <dd><cite><a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html">Document
+   Object Model (DOM) Level 3 Events Specification</a></cite>,
+   D. Schepers. W3C.</dd>
+
    <dt id="refsHTML">[HTML]</dt>
    <dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML</a></cite>,
    I. Hickson. WHATWG.</dd>

Received on Tuesday, 2 March 2010 10:57:56 UTC