[html5] r7084 - [giow] (1) Make WebSocket silently convert isolated surrogated to U+FFFD rather [...]
whatwg at whatwg.org
whatwg at whatwg.org
Wed May 2 13:06:25 PDT 2012
Author: ianh
Date: 2012-05-02 13:06:23 -0700 (Wed, 02 May 2012)
New Revision: 7084
Modified:
complete.html
index
source
Log:
[giow] (1) Make WebSocket silently convert isolated surrogated to U+FFFD rather than throwing an exception. This will result in data corruption when a user types in astral-plane characters that get truncated by naiive script half-way through, rather than crashing the application.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=16157
Affected topics: DOM APIs, WebSocket API
Modified: complete.html
===================================================================
--- complete.html 2012-05-02 19:50:57 UTC (rev 7083)
+++ complete.html 2012-05-02 20:06:23 UTC (rev 7084)
@@ -3988,7 +3988,10 @@
property</dfn>, <dfn id=support-named-properties>support named properties</dfn>,
<dfn id=supported-property-names>supported property names</dfn>, <dfn id=determine-the-value-of-a-named-property>determine the value of a
named property</dfn>, <dfn id=platform-array-objects>platform array objects</dfn>, and <dfn id=dfn-read-only-array title=dfn-read-only-array>read only</dfn> (when applied to
- arrays) are used as defined in the Web IDL specification.</p>
+ arrays) are used as defined in the Web IDL specification. The
+ algorithm to <dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>convert a DOMString to a sequence of Unicode
+ characters</dfn> is similarly that defined in the Web IDL
+ specification.</p>
<p id=float-nan>Except where otherwise specified, if an IDL
attribute that is a floating point number type (<code title="">double</code>) is assigned an Infinity or Not-a-Number
@@ -81320,15 +81323,28 @@
<code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
steps.</li>
- <li><p>If the method's second argument has any isolated surrogates,
- then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
- steps. <a href=#refsUNICODE>[UNICODE]</a></li>
+ <li>
- <li><p>If the method's second argument is present, then let <var title="">reason</var> be the result of encoding that argument as
- UTF-8. If <var title="">reason</var> is longer than 123 bytes, then
- throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.
- <a href=#refsRFC3629>[RFC3629]</a></li>
+ <p>If the method's second argument is present, then run these
+ substeps:</p>
+ <ol><li><p>Let <var title="">raw reason</var> be the method's second
+ argument.</li>
+
+ <li><p>Let <var title="">Unicode reason</var> be the result of
+ <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString to a sequence of Unicode
+ characters">converting <var title="">raw reason</var> to a
+ sequence of Unicode characters</a>.</li>
+
+ <li><p>Let <var title="">reason</var> be the result of encoding
+ <var title="">Unicode reason</var> as UTF-8.</li>
+
+ <li><p>If <var title="">reason</var> is longer than 123 bytes,
+ then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
+ steps. <a href=#refsRFC3629>[RFC3629]</a></li>
+
+ </ol></li>
+
<li><p>Run the first matching steps from the following list:</p>
<dl class=switch><dt>If the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code>
@@ -81475,10 +81491,10 @@
<dd>
- <p>If the <var title="">data</var> argument has any isolated
- surrogates, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception. If
- <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, and the string has
- no isolated surrogates, and <i title="the WebSocket closing
+ <p>Let <var title="">data</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString to a sequence of Unicode
+ characters">converting the <var title="">data</var> argument to a
+ sequence of Unicode characters</a>. If <i><a href=#the-websocket-connection-is-established>the WebSocket
+ connection is established</a></i> and <i title="the WebSocket closing
handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet
started</a></i>, then the user agent must <i>send a WebSocket
Message</i> comprised of <var title="">data</var> using a text
Modified: index
===================================================================
--- index 2012-05-02 19:50:57 UTC (rev 7083)
+++ index 2012-05-02 20:06:23 UTC (rev 7084)
@@ -3988,7 +3988,10 @@
property</dfn>, <dfn id=support-named-properties>support named properties</dfn>,
<dfn id=supported-property-names>supported property names</dfn>, <dfn id=determine-the-value-of-a-named-property>determine the value of a
named property</dfn>, <dfn id=platform-array-objects>platform array objects</dfn>, and <dfn id=dfn-read-only-array title=dfn-read-only-array>read only</dfn> (when applied to
- arrays) are used as defined in the Web IDL specification.</p>
+ arrays) are used as defined in the Web IDL specification. The
+ algorithm to <dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>convert a DOMString to a sequence of Unicode
+ characters</dfn> is similarly that defined in the Web IDL
+ specification.</p>
<p id=float-nan>Except where otherwise specified, if an IDL
attribute that is a floating point number type (<code title="">double</code>) is assigned an Infinity or Not-a-Number
@@ -81320,15 +81323,28 @@
<code><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
steps.</li>
- <li><p>If the method's second argument has any isolated surrogates,
- then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
- steps. <a href=#refsUNICODE>[UNICODE]</a></li>
+ <li>
- <li><p>If the method's second argument is present, then let <var title="">reason</var> be the result of encoding that argument as
- UTF-8. If <var title="">reason</var> is longer than 123 bytes, then
- throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.
- <a href=#refsRFC3629>[RFC3629]</a></li>
+ <p>If the method's second argument is present, then run these
+ substeps:</p>
+ <ol><li><p>Let <var title="">raw reason</var> be the method's second
+ argument.</li>
+
+ <li><p>Let <var title="">Unicode reason</var> be the result of
+ <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString to a sequence of Unicode
+ characters">converting <var title="">raw reason</var> to a
+ sequence of Unicode characters</a>.</li>
+
+ <li><p>Let <var title="">reason</var> be the result of encoding
+ <var title="">Unicode reason</var> as UTF-8.</li>
+
+ <li><p>If <var title="">reason</var> is longer than 123 bytes,
+ then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
+ steps. <a href=#refsRFC3629>[RFC3629]</a></li>
+
+ </ol></li>
+
<li><p>Run the first matching steps from the following list:</p>
<dl class=switch><dt>If the <code title=dom-WebSocket-readyState><a href=#dom-websocket-readystate>readyState</a></code>
@@ -81475,10 +81491,10 @@
<dd>
- <p>If the <var title="">data</var> argument has any isolated
- surrogates, then throw a <code><a href=#syntaxerror>SyntaxError</a></code> exception. If
- <i><a href=#the-websocket-connection-is-established>the WebSocket connection is established</a></i>, and the string has
- no isolated surrogates, and <i title="the WebSocket closing
+ <p>Let <var title="">data</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters title="convert a DOMString to a sequence of Unicode
+ characters">converting the <var title="">data</var> argument to a
+ sequence of Unicode characters</a>. If <i><a href=#the-websocket-connection-is-established>the WebSocket
+ connection is established</a></i> and <i title="the WebSocket closing
handshake is started"><a href=#the-websocket-closing-handshake-is-started>the WebSocket closing handshake has not yet
started</a></i>, then the user agent must <i>send a WebSocket
Message</i> comprised of <var title="">data</var> using a text
Modified: source
===================================================================
--- source 2012-05-02 19:50:57 UTC (rev 7083)
+++ source 2012-05-02 20:06:23 UTC (rev 7084)
@@ -2945,7 +2945,10 @@
<dfn>supported property names</dfn>, <dfn>determine the value of a
named property</dfn>, <dfn>platform array objects</dfn>, and <dfn
title="dfn-read-only-array">read only</dfn> (when applied to
- arrays) are used as defined in the Web IDL specification.</p>
+ arrays) are used as defined in the Web IDL specification. The
+ algorithm to <dfn>convert a DOMString to a sequence of Unicode
+ characters</dfn> is similarly that defined in the Web IDL
+ specification.</p>
<p id="float-nan">Except where otherwise specified, if an IDL
attribute that is a floating point number type (<code
@@ -94491,16 +94494,32 @@
<code>InvalidAccessError</code> exception and abort these
steps.</p></li>
- <li><p>If the method's second argument has any isolated surrogates,
- then throw a <code>SyntaxError</code> exception and abort these
- steps. <a href="#refsUNICODE">[UNICODE]</a></p></li>
+ <li>
- <li><p>If the method's second argument is present, then let <var
- title="">reason</var> be the result of encoding that argument as
- UTF-8. If <var title="">reason</var> is longer than 123 bytes, then
- throw a <code>SyntaxError</code> exception and abort these steps.
- <a href="#refsRFC3629">[RFC3629]</a></p></li>
+ <p>If the method's second argument is present, then run these
+ substeps:</p>
+ <ol>
+
+ <li><p>Let <var title="">raw reason</var> be the method's second
+ argument.</p></li>
+
+ <li><p>Let <var title="">Unicode reason</var> be the result of
+ <span title="convert a DOMString to a sequence of Unicode
+ characters">converting <var title="">raw reason</var> to a
+ sequence of Unicode characters</span>.</p></li>
+
+ <li><p>Let <var title="">reason</var> be the result of encoding
+ <var title="">Unicode reason</var> as UTF-8.</p></li>
+
+ <li><p>If <var title="">reason</var> is longer than 123 bytes,
+ then throw a <code>SyntaxError</code> exception and abort these
+ steps. <a href="#refsRFC3629">[RFC3629]</a></p></li>
+
+ </ol>
+
+ </li>
+
<li><p>Run the first matching steps from the following list:</p>
<dl class="switch">
@@ -94687,10 +94706,11 @@
<dd>
- <p>If the <var title="">data</var> argument has any isolated
- surrogates, then throw a <code>SyntaxError</code> exception. If
- <i>the WebSocket connection is established</i>, and the string has
- no isolated surrogates, and <i title="the WebSocket closing
+ <p>Let <var title="">data</var> be the result of <span
+ title="convert a DOMString to a sequence of Unicode
+ characters">converting the <var title="">data</var> argument to a
+ sequence of Unicode characters</span>. If <i>the WebSocket
+ connection is established</i> and <i title="the WebSocket closing
handshake is started">the WebSocket closing handshake has not yet
started</i>, then the user agent must <i>send a WebSocket
Message</i> comprised of <var title="">data</var> using a text
More information about the Commit-Watchers
mailing list