[html5] r4816 - [giow] (0) Add WebSocket.onmessageerror to report unexpected frames.
whatwg at whatwg.org
whatwg at whatwg.org
Tue Mar 2 02:42:17 PST 2010
Author: ianh
Date: 2010-03-02 02:42:16 -0800 (Tue, 02 Mar 2010)
New Revision: 4816
Modified:
complete.html
source
Log:
[giow] (0) Add WebSocket.onmessageerror to report unexpected frames.
Modified: complete.html
===================================================================
--- complete.html 2010-03-02 10:20:03 UTC (rev 4815)
+++ complete.html 2010-03-02 10:42:16 UTC (rev 4816)
@@ -66940,6 +66940,7 @@
// networking
attribute <a href=#function>Function</a> <a href=#handler-websocket-onopen title=handler-WebSocket-onopen>onopen</a>;
attribute <a href=#function>Function</a> <a href=#handler-websocket-onmessage title=handler-WebSocket-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-websocket-onmessageerror title=handler-WebSocket-onmessageerror>onmessageerror</a>;
attribute <a href=#function>Function</a> <a href=#handler-websocket-onclose title=handler-WebSocket-onclose>onclose</a>;
boolean <a href=#dom-websocket-send title=dom-WebSocket-send>send</a>(in DOMString data);
void <a href=#dom-websocket-close title=dom-WebSocket-close>close</a>();
@@ -67093,6 +67094,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 id=handler-websocket-onmessageerror title=handler-WebSocket-onmessageerror><code>onmessageerror</code></dfn> <td> <code title=event-messageerror>messageerror</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>10.3.3 </span>Feedback from the protocol</h4>
@@ -67110,6 +67112,13 @@
(1), and if so, dispatch the event at the <code><a href=#websocket>WebSocket</a></code>
object.</p>
+ <p>When <i><a href=#a-websocket-error-has-been-detected>a WebSocket error has been detected</a></i>, the user agent
+ must <a href=#queue-a-task>queue a task</a> to set to <var title="">data</var>,
+ and <a href=#queue-a-task>queue a task</a> to check to see if the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code> attribute's value
+ is <code title=dom-WebSocket-OPEN><a href=#dom-websocket-open>OPEN</a></code> (1), and if so,
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-messageerror>messageerror</code> at the <code><a href=#websocket>WebSocket</a></code>
+ object.</p>
+
<p id=closeWebSocket>When the <i><a href=#websocket-connection-is-closed>WebSocket connection is
closed</a></i>, the user agent must <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>
@@ -68526,18 +68535,23 @@
</ol><h6 id=data-framing><span class=secno>10.3.4.3.2 </span>Data framing</h6>
- <p>Once a <a href=#websocket-connection-is-established>WebSocket connection is established</a>, the
- user agent must run through the following state machine for the
- bytes sent by the server.</p>
+ <p>Once a <a href=#websocket-connection-is-established>WebSocket connection is established</a>, the user
+ agent must run through the following state machine for the bytes
+ sent by the server. If at any point during these steps a read is
+ attempted but fails because the <a href=#websocket-connection-is-closed>WebSocket connection is
+ closed</a>, then abort.</p>
<ol><li>
<p>Try to read a byte from the server. Let <var title="">frame
type</var> be that byte.</p>
- <p>If no byte could be read because the <a href=#websocket-connection-is-closed>WebSocket
- connection is closed</a>, then abort.</p>
+ </li>
+ <li>
+
+ <p>Let <var title="">error</var> be false.</p>
+
</li>
<li>
@@ -68549,9 +68563,7 @@
<dd>
- <p>Run these steps. If at any point during these steps a read is
- attempted but fails because the <a href=#websocket-connection-is-closed>WebSocket connection is
- closed</a>, then abort.</p>
+ <p>Run these steps:</p>
<ol><li><p>Let <var title="">length</var> be zero.</li>
@@ -68573,6 +68585,8 @@
<li><p>Discard the read bytes.</li>
+ <li><p>Let <var title="">error</var> be true.</li>
+
</ol></dd>
<dt>If the high-order bit of the <var title="">frame type</var>
@@ -68581,9 +68595,7 @@
<dd>
- <p>Run these steps. If at any point during these steps a read is
- attempted but fails because the <a href=#websocket-connection-is-closed>WebSocket connection is
- closed</a>, then abort.</p>
+ <p>Run these steps:</p>
<ol><li><p>Let <var title="">raw data</var> be an empty byte array.</li>
@@ -68596,12 +68608,19 @@
string, and store that string in <var title="">data</var>.</p>
<li><p>If <var title="">frame type</var> is 0x00, then <dfn id=a-websocket-message-has-been-received>a
- WebSocket message has been received</dfn> with text <var title="">data</var>. Otherwise, discard the data.</li>
+ WebSocket message has been received</dfn> with text <var title="">data</var>. Otherwise, discard the data and let <var title="">error</var> be true.</li>
</ol></dd>
</dl></li>
+ <li>
+
+ <p>If <var title="">error</var> is true, then <dfn id=a-websocket-error-has-been-detected>a WebSocket
+ error has been detected</dfn>.</li>
+
+
+
<li><p>Return to the first step to read the next byte.</li>
</ol><p>If the user agent is faced with content that is too large to be
Modified: source
===================================================================
--- source 2010-03-02 10:20:03 UTC (rev 4815)
+++ source 2010-03-02 10:42:16 UTC (rev 4816)
@@ -75239,6 +75239,7 @@
// networking
attribute <span>Function</span> <span title="handler-WebSocket-onopen">onopen</span>;
attribute <span>Function</span> <span title="handler-WebSocket-onmessage">onmessage</span>;
+ attribute <span>Function</span> <span title="handler-WebSocket-onmessageerror">onmessageerror</span>;
attribute <span>Function</span> <span title="handler-WebSocket-onclose">onclose</span>;
boolean <span title="dom-WebSocket-send">send</span>(in DOMString data);
void <span title="dom-WebSocket-close">close</span>();
@@ -75430,6 +75431,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-onmessageerror"><code>onmessageerror</code></dfn> <td> <code title="event-messageerror">messageerror</code>
<tr><td><dfn title="handler-WebSocket-onclose"><code>onclose</code></dfn> <td> <code title="event-close">close</code>
</table>
@@ -75457,6 +75459,15 @@
(1), and if so, dispatch the event at the <code>WebSocket</code>
object.</p>
+ <p>When <i>a WebSocket error has been detected</i>, the user agent
+ must <span>queue a task</span> to set to <var title="">data</var>,
+ and <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), and if so,
+ <span>fire a simple event</span> named <code
+ title="event-messageerror">messageerror</code> at the <code>WebSocket</code>
+ object.</p>
+
<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">readyState</code>
@@ -77061,9 +77072,11 @@
<h6>Data framing</h6>
- <p>Once a <span>WebSocket connection is established</span>, the
- user agent must run through the following state machine for the
- bytes sent by the server.</p>
+ <p>Once a <span>WebSocket connection is established</span>, the user
+ agent must run through the following state machine for the bytes
+ sent by the server. If at any point during these steps a read is
+ attempted but fails because the <span>WebSocket connection is
+ closed</span>, then abort.</p>
<ol>
@@ -77072,9 +77085,12 @@
<p>Try to read a byte from the server. Let <var title="">frame
type</var> be that byte.</p>
- <p>If no byte could be read because the <span>WebSocket
- connection is closed</span>, then abort.</p>
+ </li>
+ <li>
+
+ <p>Let <var title="">error</var> be false.</p>
+
</li>
<li>
@@ -77089,9 +77105,7 @@
<dd>
- <p>Run these steps. If at any point during these steps a read is
- attempted but fails because the <span>WebSocket connection is
- closed</span>, then abort.</p>
+ <p>Run these steps:</p>
<ol>
@@ -77118,6 +77132,8 @@
<li><p>Discard the read bytes.</p></li>
+ <li><p>Let <var title="">error</var> be true.</p></li>
+
</ol>
</dd>
@@ -77128,9 +77144,7 @@
<dd>
- <p>Run these steps. If at any point during these steps a read is
- attempted but fails because the <span>WebSocket connection is
- closed</span>, then abort.</p>
+ <p>Run these steps:</p>
<ol>
@@ -77149,7 +77163,8 @@
<li><p>If <var title="">frame type</var> is 0x00, then <dfn>a
WebSocket message has been received</dfn> with text <var
- title="">data</var>. Otherwise, discard the data.</p></li>
+ title="">data</var>. Otherwise, discard the data and let <var
+ title="">error</var> be true.</p></li>
</ol>
@@ -77159,6 +77174,13 @@
</li>
+ <li>
+
+ <p>If <var title="">error</var> is true, then <dfn>a WebSocket
+ error has been detected</dfn>.</p></li>
+
+ </li>
+
<li><p>Return to the first step to read the next byte.</p></li>
</ol>
More information about the Commit-Watchers
mailing list