[html5] r6191 - [giow] (0) Reintroduce 'error' events for WebSockets.
whatwg at whatwg.org
whatwg at whatwg.org
Mon Jun 6 16:00:24 PDT 2011
Author: ianh
Date: 2011-06-06 16:00:23 -0700 (Mon, 06 Jun 2011)
New Revision: 6191
Modified:
complete.html
source
Log:
[giow] (0) Reintroduce 'error' events for WebSockets.
Modified: complete.html
===================================================================
--- complete.html 2011-06-06 22:28:50 UTC (rev 6190)
+++ complete.html 2011-06-06 23:00:23 UTC (rev 6191)
@@ -79113,8 +79113,8 @@
// networking
attribute <a href=#function>Function</a> <a href=#handler-websocket-onopen title=handler-WebSocket-onopen>onopen</a>;
-<!-- attribute <span>Function</span> <span title="handler-WebSocket-onerror">onerror</span>;
---> attribute <a href=#function>Function</a> <a href=#handler-websocket-onclose title=handler-WebSocket-onclose>onclose</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-websocket-onerror title=handler-WebSocket-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-websocket-onclose title=handler-WebSocket-onclose>onclose</a>;
readonly attribute DOMString <a href=#dom-websocket-extensions title=dom-WebSocket-extensions>extensions</a>;
readonly attribute DOMString <a href=#dom-websocket-protocol title=dom-WebSocket-protocol>protocol</a>;
void <a href=#dom-websocket-close title=dom-WebSocket-close>close</a>(in optional unsigned long code, in optional DOMString reason);
@@ -79496,7 +79496,7 @@
<table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
<tbody><tr><td><dfn id=handler-websocket-onopen title=handler-WebSocket-onopen><code>onopen</code></dfn> <td> <code title=event-open>open</code>
<tr><td><dfn id=handler-websocket-onmessage title=handler-WebSocket-onmessage><code>onmessage</code></dfn> <td> <code title=event-message><a href=#event-message>message</a></code>
-<!-- <tr><td><dfn title="handler-WebSocket-onerror"><code>onerror</code></dfn> <td> <code title="event-error">error</code>-->
+ <tr><td><dfn id=handler-websocket-onerror title=handler-WebSocket-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
<tr><td><dfn id=handler-websocket-onclose title=handler-WebSocket-onclose><code>onclose</code></dfn> <td> <code title=event-close>close</code>
</table><h4 id=feedback-from-the-protocol><span class=secno>11.3.3 </span>Feedback from the protocol</h4>
@@ -79575,16 +79575,7 @@
data back to RAM before running this <a href=#concept-task title=concept-task>task</a> so as to avoid stalling the main
thread while it created the <code>ArrayBuffer</code> object.</p>
- <hr><!--
- <p>When <i>a WebSocket error has been detected</i>, the user agent
- must <span>queue a task</span> to check to see if the <code
- title="dom-WebSocket-readyState">readyState</code> attribute's value
- is <code title="dom-WebSocket-OPEN">OPEN</code> (1) or <code
- title="dom-WebSocket-CLOSING">CLOSING</code> (2), and if so,
- <span>fire a simple event</span> named <code
- title="event-error">error</code> at the <code>WebSocket</code>
- object. <a href="#refsWSP">[WSP]</a></p>
---><p>When <i><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake is started</a></i>, the user
+ <hr><p>When <i><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake is started</a></i>, the user
agent must <a href=#queue-a-task>queue a task</a> to change the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value
to <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2). (If the
<code title=dom-WebSocket-close><a href=#dom-websocket-close>close()</a></code> method was called,
@@ -79594,20 +79585,27 @@
<p id=closeWebSocket>When <i><a href=#the-websocket-connection-is-closed>the WebSocket connection is
closed</a></i>, possibly <i title="">cleanly</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, whose
- <code title=dom-CloseEvent-wasClean><a href=#dom-closeevent-wasclean>wasClean</a></code> attribute is
- set to true if the connection closed <i title="">cleanly</i> and
- false otherwise, whose <code title=dom-CloseEvent-code><a href=#dom-closeevent-code>code</a></code>
- attribute is set to <i><a href=#the-websocket-connection-close-code>the WebSocket connection close code</a></i>, and
- whose <code title=dom-CloseEvent-reason><a href=#dom-closeevent-reason>reason</a></code> attribute is
- set to <i><a href=#the-websocket-connection-close-reason>the WebSocket connection close reason</a></i>; and <a href=#queue-a-task>queue
- a task</a> 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> (3), and then
- dispatch the event at the <code><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></p>
+ <a href=#queue-a-task>queue a task</a> to run the following substeps:</p>
- <p>The <a href=#task-source>task source</a> for all <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a
+ <ol><li><p>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>
+ (3).</li>
+
+ <li><p>If the user agent was required to <i><a href=#fail-the-websocket-connection>fail the websocket
+ connection</a></i>, <a href=#fire-a-simple-event>fire a simple event</a> named <code title="">error</code> at the <code><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></li>
+
+ <li><p>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, whose <code title=dom-CloseEvent-wasClean><a href=#dom-closeevent-wasclean>wasClean</a></code> attribute is set to
+ true if the connection closed <i title="">cleanly</i> and false
+ otherwise, whose <code title=dom-CloseEvent-code><a href=#dom-closeevent-code>code</a></code>
+ attribute is set to <i><a href=#the-websocket-connection-close-code>the WebSocket connection close code</a></i>, and
+ whose <code title=dom-CloseEvent-reason><a href=#dom-closeevent-reason>reason</a></code> attribute
+ is set to <i><a href=#the-websocket-connection-close-reason>the WebSocket connection close reason</a></i>
+ <a href=#decoded-as-utf-8,-with-error-handling>decoded as UTF-8, with error handling</a>, and dispatch
+ the event at the <code><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></li>
+
+ </ol><p>The <a href=#task-source>task source</a> for all <a href=#concept-task title=concept-task>tasks</a> <a href=#queue-a-task title="queue a
task">queued</a> in this section is the <dfn id=websocket-task-source>WebSocket task
source</dfn>.</p>
@@ -79646,14 +79644,12 @@
(0) as of the last time the <a href=#event-loop>event loop</a> started
executing a <a href=#concept-task title=concept-task>task</a> must not be
garbage collected if there are any event listeners registered for
- <code title=event-open>open</code> events, <code title=event-message><a href=#event-message>message</a></code> events<!--, <code
- title="event-error">error</code> events-->, or <code title=event-close>close</code> events.</p>
+ <code title=event-open>open</code> events, <code title=event-message><a href=#event-message>message</a></code> events, <code title=event-error>error</code> events, or <code title=event-close>close</code> events.</p>
<p>A <code><a href=#websocket>WebSocket</a></code> object whose <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value
was set to <code title=dom-WebSocket-OPEN><a href=#dom-websocket-open>OPEN</a></code> (1) or <code title=dom-WebSocket-CLOSING><a href=#dom-websocket-closing>CLOSING</a></code> (2) as of the last time
the <a href=#event-loop>event loop</a> started executing a <a href=#concept-task title=concept-task>task</a> must not be garbage collected if
- there are any event listeners registered for <code title=event-message><a href=#event-message>message</a></code> events<!--, <code
- title="event-error">error</code> events-->, or <code title=event-close>close</code> events.</p>
+ there are any event listeners registered for <code title=event-message><a href=#event-message>message</a></code> events, <code title=event-error>error</code>, or <code title=event-close>close</code> events.</p>
<p>A <code><a href=#websocket>WebSocket</a></code> object with <i title="the WebSocket
connection is established"><a href=#the-websocket-connection-is-established>an established connection</a></i> that has
Modified: source
===================================================================
--- source 2011-06-06 22:28:50 UTC (rev 6190)
+++ source 2011-06-06 23:00:23 UTC (rev 6191)
@@ -89803,8 +89803,8 @@
// networking
attribute <span>Function</span> <span title="handler-WebSocket-onopen">onopen</span>;
-<!-- attribute <span>Function</span> <span title="handler-WebSocket-onerror">onerror</span>;
---> attribute <span>Function</span> <span title="handler-WebSocket-onclose">onclose</span>;
+ attribute <span>Function</span> <span title="handler-WebSocket-onerror">onerror</span>;
+ attribute <span>Function</span> <span title="handler-WebSocket-onclose">onclose</span>;
readonly attribute DOMString <span title="dom-WebSocket-extensions">extensions</span>;
readonly attribute DOMString <span title="dom-WebSocket-protocol">protocol</span>;
void <span title="dom-WebSocket-close">close</span>(in optional unsigned long code, in optional DOMString reason);
@@ -90271,7 +90271,7 @@
<tbody>
<tr><td><dfn title="handler-WebSocket-onopen"><code>onopen</code></dfn> <td> <code title="event-open">open</code>
<tr><td><dfn title="handler-WebSocket-onmessage"><code>onmessage</code></dfn> <td> <code title="event-message">message</code>
-<!-- <tr><td><dfn title="handler-WebSocket-onerror"><code>onerror</code></dfn> <td> <code title="event-error">error</code>-->
+ <tr><td><dfn title="handler-WebSocket-onerror"><code>onerror</code></dfn> <td> <code title="event-error">error</code>
<tr><td><dfn title="handler-WebSocket-onclose"><code>onclose</code></dfn> <td> <code title="event-close">close</code>
</table>
@@ -90392,16 +90392,7 @@
thread while it created the <code>ArrayBuffer</code> object.</p>
<hr>
-<!--
- <p>When <i>a WebSocket error has been detected</i>, the user agent
- must <span>queue a task</span> to check to see if the <code
- title="dom-WebSocket-readyState">readyState</code> attribute's value
- is <code title="dom-WebSocket-OPEN">OPEN</code> (1) or <code
- title="dom-WebSocket-CLOSING">CLOSING</code> (2), and if so,
- <span>fire a simple event</span> named <code
- title="event-error">error</code> at the <code>WebSocket</code>
- object. <a href="#refsWSP">[WSP]</a></p>
--->
+
<p>When <i>the WebSocket closing handshake is started</i>, the user
agent must <span>queue a task</span> to change the <code
title="dom-WebSocket-readyState">readyState</code> attribute's value
@@ -90414,21 +90405,36 @@
<p id="closeWebSocket">When <i>the WebSocket connection is
closed</i>, possibly <i title="">cleanly</i>, the user agent must
- create an event that uses the <code>CloseEvent</code> interface,
- with the event name <code title="event-close">close</code>, which
- does not bubble, is not cancelable, has no default action, whose
- <code title="dom-CloseEvent-wasClean">wasClean</code> attribute is
- set to true if the connection closed <i title="">cleanly</i> and
- false otherwise, whose <code title="dom-CloseEvent-code">code</code>
- attribute is set to <i>the WebSocket connection close code</i>, and
- whose <code title="dom-CloseEvent-reason">reason</code> attribute is
- set to <i>the WebSocket connection close reason</i>; and <span>queue
- a task</span> to first change the <code
- title="dom-WebSocket-readyState">readyState</code> attribute's value
- to <code title="dom-WebSocket-CLOSED">CLOSED</code> (3), and then
- dispatch the event at the <code>WebSocket</code> object. <a
- href="#refsWSP">[WSP]</a></p>
+ <span>queue a task</span> to run the following substeps:</p>
+ <ol>
+
+ <li><p>Change the <code
+ title="dom-WebSocket-readyState">readyState</code> attribute's
+ value to <code title="dom-WebSocket-CLOSED">CLOSED</code>
+ (3).</p></li>
+
+ <li><p>If the user agent was required to <i>fail the websocket
+ connection</i>, <span>fire a simple event</span> named <code
+ title="">error</code> at the <code>WebSocket</code> object. <a
+ href="#refsWSP">[WSP]</a></p></li>
+
+ <li><p>Create an event that uses the <code>CloseEvent</code>
+ interface, with the event name <code
+ title="event-close">close</code>, which does not bubble, is not
+ cancelable, has no default action, whose <code
+ title="dom-CloseEvent-wasClean">wasClean</code> attribute is set to
+ true if the connection closed <i title="">cleanly</i> and false
+ otherwise, whose <code title="dom-CloseEvent-code">code</code>
+ attribute is set to <i>the WebSocket connection close code</i>, and
+ whose <code title="dom-CloseEvent-reason">reason</code> attribute
+ is set to <i>the WebSocket connection close reason</i>
+ <span>decoded as UTF-8, with error handling</span>, and dispatch
+ the event at the <code>WebSocket</code> object. <a
+ href="#refsWSP">[WSP]</a></p></li>
+
+ </ol>
+
<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>WebSocket task
@@ -90475,8 +90481,8 @@
executing a <span title="concept-task">task</span> must not be
garbage collected if there are any event listeners registered for
<code title="event-open">open</code> events, <code
- title="event-message">message</code> events<!--, <code
- title="event-error">error</code> events-->, or <code
+ title="event-message">message</code> events, <code
+ title="event-error">error</code> events, or <code
title="event-close">close</code> events.</p>
<p>A <code>WebSocket</code> object whose <code
@@ -90486,8 +90492,8 @@
the <span>event loop</span> started executing a <span
title="concept-task">task</span> must not be garbage collected if
there are any event listeners registered for <code
- title="event-message">message</code> events<!--, <code
- title="event-error">error</code> events-->, or <code
+ title="event-message">message</code> events, <code
+ title="event-error">error</code>, or <code
title="event-close">close</code> events.</p>
<p>A <code>WebSocket</code> object with <i title="the WebSocket
More information about the Commit-Watchers
mailing list