Permalink
Browse files

Integrate the Streams API

Also fix the case where the response entity body is null for the JSON
response entity body.
  • Loading branch information...
1 parent ac6d9b6 commit 4b56e0f353362d50b87539ff906519892ee13652 @annevk annevk committed Oct 11, 2012
Showing with 106 additions and 29 deletions.
  1. +55 −15 Overview.html
  2. +51 −14 Overview.src.html
View
@@ -231,7 +231,7 @@ <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
<p>This specification heavily borrows terminology, from
Cross-Origin Resource Sharing, DOM, DOM Parsing and Serialization, Encoding,
-File API, HTML, HTTP, Typed Array, Web IDL, and XML.
+File API, HTML, HTTP, Streams API, Typed Array, Web IDL, and XML.
<a href="#refsCORS">[CORS]</a>
<a href="#refsDOM">[DOM]</a>
@@ -240,6 +240,7 @@ <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
<a href="#refsFILEAPI">[FILEAPI]</a>
<a href="#refsHTML">[HTML]</a>
<a href="#refsHTTP">[HTTP]</a>
+<a href="#refsSTREAMS">[STREAMS]</a>
<a href="#refsTYPEDARRAY">[TYPEDARRAY]</a>
<a href="#refsWEBIDL">[WEBIDL]</a>
<a href="#refsXML">[XML]</a> <a href="#refsXMLNS">[XMLNS]</a>
@@ -267,7 +268,6 @@ <h2 id="interface-xmlhttprequest"><span class="secno">4 </span>Interface <code t
};
interface <dfn id="xmlhttprequestupload">XMLHttpRequestUpload</dfn> : <a href="#xmlhttprequesteventtarget">XMLHttpRequestEventTarget</a> {
-
};
enum <dfn id="xmlhttprequestresponsetype">XMLHttpRequestResponseType</dfn> {
@@ -276,6 +276,7 @@ <h2 id="interface-xmlhttprequest"><span class="secno">4 </span>Interface <code t
"blob",
"document",
"json",
+ "stream",
"text"
};
@@ -302,7 +303,7 @@ <h2 id="interface-xmlhttprequest"><span class="secno">4 </span>Interface <code t
attribute unsigned long <a href="#dom-xmlhttprequest-timeout" title="dom-XMLHttpRequest-timeout">timeout</a>;
attribute boolean <a href="#dom-xmlhttprequest-withcredentials" title="dom-XMLHttpRequest-withCredentials">withCredentials</a>;
readonly attribute <a href="#xmlhttprequestupload">XMLHttpRequestUpload</a> <a href="#dom-xmlhttprequest-upload" title="dom-XMLHttpRequest-upload">upload</a>;
- void <a href="#dom-xmlhttprequest-send" title="dom-XMLHttpRequest-send">send</a>(optional (<a class="external" href="http://www.khronos.org/registry/typedarray/specs/latest/#6">ArrayBufferView</a> or <a class="external" href="http://dev.w3.org/2006/webapi/FileAPI/#blob">Blob</a> or <a class="external" href="http://dom.spec.whatwg.org/#document">Document</a> or DOMString or <a href="#formdata">FormData</a>)? <var>data</var> = null);
+ void <a href="#dom-xmlhttprequest-send" title="dom-XMLHttpRequest-send">send</a>(optional (<a class="external" href="http://www.khronos.org/registry/typedarray/specs/latest/#6">ArrayBufferView</a> or <a class="external" href="http://dev.w3.org/2006/webapi/FileAPI/#blob">Blob</a> or <a class="external" href="http://dom.spec.whatwg.org/#document">Document</a> or DOMString or <a href="#formdata">FormData</a> or <a class="external" href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a>)? <var>data</var> = null);
void <a href="#dom-xmlhttprequest-abort" title="dom-XMLHttpRequest-abort">abort</a>();
// <a href="#response">response</a>
@@ -1133,14 +1134,18 @@ <h4 id="the-send()-method"><span class="secno">4.7.6 </span>The <code title="">s
represented by <var title="">data</var>.</dd>
<dt><code class="external"><a href="http://dev.w3.org/2006/webapi/FileAPI/#blob">Blob</a></code>
+ <dt><code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a></code>
<dd>
- <p>If the object's
+ <p>If the object's <code title="">type</code> attribute value is not
+ the empty string, let <var>mime type</var> be its value.
+
+ <p class="note">See also <code class="external"><a href="http://dev.w3.org/2006/webapi/FileAPI/#blob">Blob</a></code>'s
<code class="external" title="dom-Blob-type"><a href="http://dev.w3.org/2006/webapi/FileAPI/#dfn-type">type</a></code>
- attribute is not the empty string let <var>mime type</var> be its
- value.</p>
+ attribute and <code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a></code>'s
+ <code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#widl-Stream-type">type</a></code> attribute.
<p>Let the <a href="#request-entity-body">request entity body</a> be the raw data
- represented by <var>data</var>.</p>
+ represented by <var>data</var>.
</dd>
@@ -1206,8 +1211,6 @@ <h4 id="the-send()-method"><span class="secno">4.7.6 </span>The <code title="">s
<a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#multipart/form-data-boundary-string"><code>multipart/form-data</code> boundary string</a>
generated by the
<a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#multipart/form-data-encoding-algorithm"><code>multipart/form-data</code> encoding algorithm</a>.
- </dd>
-
</dl>
<p>If a <code>Content-Type</code> header is in
@@ -2213,6 +2216,8 @@ <h4 id="response-entity-body-0"><span class="secno">4.8.5 </span>Response entity
algorithm:</p>
<ol>
+ <li><p>If the <a href="#response-entity-body">response entity body</a> is null, return null.
+
<li><p>Let <var title="">JSON text</var> be the result of running
<a class="external" href="http://encoding.spec.whatwg.org/#utf-8-decode">utf-8 decode</a> on byte stream
<a href="#response-entity-body">response entity body</a>.
@@ -2224,6 +2229,21 @@ <h4 id="response-entity-body-0"><span class="secno">4.8.5 </span>Response entity
</ol>
+<p>The <dfn id="stream-response-entity-body">stream response entity body</dfn> is
+<code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a></code> object representing the
+<a href="#response-entity-body">response entity body</a>. The
+<a href="#stream-response-entity-body">stream response entity body</a> is the return value of the
+following algorithm:
+
+<ol>
+ <li><p>If the <a href="#response-entity-body">response entity body</a> is null, return an empty
+ <code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a></code> object.
+
+ <li><p>Return a <code class="external"><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a></code> object \
+ representing the <a href="#response-entity-body">response entity body</a>.
+</ol>
+
+
<p>The <dfn id="text-response-entity-body">text response entity body</dfn>
is a string representing the <a href="#response-entity-body">response entity body</a>. The
<a href="#text-response-entity-body">text response entity body</a> is the return value of the
@@ -2323,8 +2343,9 @@ <h4 id="the-responsetype-attribute"><span class="secno">4.8.7 </span>The <code t
"<code title="">arraybuffer</code>",
"<code title="">blob</code>",
"<code title="">document</code>",
- "<code title="">json</code>", and
- "<code title="">text</code>".</p>
+ "<code title="">json</code>",
+ "<code title="">stream</code>", and
+ "<code title="">text</code>".
<p>When set: throws an
"<code class="external"><a href="http://dom.spec.whatwg.org/#invalidstateerror">InvalidStateError</a></code>" exception if the
state is <a href="#dom-xmlhttprequest-loading" title="dom-XMLHttpRequest-LOADING">LOADING</a> or
@@ -2395,7 +2416,22 @@ <h4 id="the-response-attribute"><span class="secno">4.8.8 </span>The <code title
<li><p>Return the <a href="#text-response-entity-body">text response entity body</a>.</li>
</ol>
- </dd>
+
+ <dt>If <code title="dom-XMLHttpRequest-responseType"><a href="#dom-xmlhttprequest-responsetype">responseType</a></code>
+ is "<code title="">stream</code>"
+ <dd>
+ <ol>
+ <li><p>If the state is not
+ <a href="#dom-xmlhttprequest-loading" title="dom-XMLHttpRequest-LOADING">LOADING</a> or
+ <a href="#dom-xmlhttprequest-done" title="dom-XMLHttpRequest-DONE">DONE</a>, return null and
+ terminate these steps.
+
+ <li><p>If the <a href="#error-flag">error flag</a> is set, return null and terminate
+ these steps.
+
+ <li><p>Return the <a href="#stream-response-entity-body">stream response entity body</a>.
+ </ol>
+
<dt>Otherwise</dt>
<dd>
<ol>
@@ -2432,9 +2468,7 @@ <h4 id="the-response-attribute"><span class="secno">4.8.8 </span>The <code title
<dd><p>Return the
<a href="#json-response-entity-body">JSON response entity body</a>.</dd>
</dl>
- </li>
</ol>
- </dd>
</dl>
@@ -2891,7 +2925,7 @@ <h2 class="no-num" id="references">References</h2>
<dd><cite><a href="http://dom.spec.whatwg.org/">DOM</a></cite>, Anne van Kesteren, Aryeh Gregor and Ms2ger. WHATWG.
<dt id="refsDOMPS">[DOMPS]
-<dd><cite><a href="http://html5.org/specs/dom-parsing.html">DOM Parsing and Serialization</a></cite>, Ms2ger. WHATWG.
+<dd><cite><a href="http://domparsing.spec.whatwg.org/">DOM Parsing and Serialization</a></cite>, Ms2ger. WHATWG.
<dt id="refsECMASCRIPT">[ECMASCRIPT]
<dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript Language Specification</a></cite>. ECMA.
@@ -2921,6 +2955,9 @@ <h2 class="no-num" id="references">References</h2>
<dt id="refsRFC2119">[RFC2119]
<dd><cite><a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a></cite>, Scott Bradner. IETF.
+<dt id="refsSTREAMS">[STREAMS]
+<dd><cite><a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm">Streams API</a></cite>, Feras Moussa. W3C.
+
<dt id="refsTYPEDARRAY">[TYPEDARRAY]
<dd><cite><a href="http://www.khronos.org/registry/typedarray/specs/latest/">Typed Array</a></cite>, David Herman and Kenneth Russell. Khronos.
@@ -2942,6 +2979,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
<p>The editor would like to thank
Addison Phillips,
+ Adrian Bateman,
Ahmed Kamel,
Alex Hopmann,
Alex Vincent,
@@ -2967,6 +3005,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
Eric Lawrence,
Eric Uhrhane,
Erik Dahlström,
+ Feras Moussa,
Geoffrey Sneddon,
Gideon Cohn,
Glenn Adams,
@@ -3015,6 +3054,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
Sunava Dutta,
Thomas Roessler,
Tom Magliery,
+ Travis Leithead,
Yehuda Katz, and
Zhenbin Xu
View
@@ -179,7 +179,7 @@ <h2 id="terminology">Terminology</h2>
<p>This specification heavily borrows terminology, from
Cross-Origin Resource Sharing, DOM, DOM Parsing and Serialization, Encoding,
-File API, HTML, HTTP, Typed Array, Web IDL, and XML.
+File API, HTML, HTTP, Streams API, Typed Array, Web IDL, and XML.
<span data-anolis-ref>CORS</span>
<span data-anolis-ref>DOM</span>
@@ -188,6 +188,7 @@ <h2 id="terminology">Terminology</h2>
<span data-anolis-ref>FILEAPI</span>
<span data-anolis-ref>HTML</span>
<span data-anolis-ref>HTTP</span>
+<span data-anolis-ref>STREAMS</span>
<span data-anolis-ref>TYPEDARRAY</span>
<span data-anolis-ref>WEBIDL</span>
<span data-anolis-ref>XML</span> <span data-anolis-ref>XMLNS</span>
@@ -215,7 +216,6 @@ <h2 id="terminology">Terminology</h2>
};
interface <dfn id="xmlhttprequestupload">XMLHttpRequestUpload</dfn> : <span>XMLHttpRequestEventTarget</span> {
-
};
enum <dfn>XMLHttpRequestResponseType</dfn> {
@@ -224,6 +224,7 @@ <h2 id="terminology">Terminology</h2>
"blob",
"document",
"json",
+ "stream",
"text"
};
@@ -250,7 +251,7 @@ <h2 id="terminology">Terminology</h2>
attribute unsigned long <span title="dom-XMLHttpRequest-timeout">timeout</span>;
attribute boolean <span title="dom-XMLHttpRequest-withCredentials">withCredentials</span>;
readonly attribute <span>XMLHttpRequestUpload</span> <span title="dom-XMLHttpRequest-upload">upload</span>;
- void <span title="dom-XMLHttpRequest-send">send</span>(optional (<span data-anolis-spec=typedarray>ArrayBufferView</span> or <span data-anolis-spec=fileapi>Blob</span> or <span data-anolis-spec=dom>Document</span> or DOMString or <span>FormData</span>)? <var>data</var> = null);
+ void <span title="dom-XMLHttpRequest-send">send</span>(optional (<span data-anolis-spec=typedarray>ArrayBufferView</span> or <span data-anolis-spec=fileapi>Blob</span> or <span data-anolis-spec=dom>Document</span> or DOMString or <span>FormData</span> or <span data-anolis-spec=streams>Stream</span>)? <var>data</var> = null);
void <span title="dom-XMLHttpRequest-abort">abort</span>();
// <a href="#response">response</a>
@@ -1081,14 +1082,18 @@ <h3 id="request">Request</h3>
represented by <var title>data</var>.</p></dd>
<dt><code data-anolis-spec=fileapi>Blob</code>
+ <dt><code data-anolis-spec=streams>Stream</code>
<dd>
- <p>If the object's
+ <p>If the object's <code title>type</code> attribute value is not
+ the empty string, let <var>mime type</var> be its value.
+
+ <p class=note>See also <code data-anolis-spec=fileapi>Blob</code>'s
<code data-anolis-spec=fileapi title=dom-Blob-type>type</code>
- attribute is not the empty string let <var>mime type</var> be its
- value.</p>
+ attribute and <code data-anolis-spec=streams>Stream</code>'s
+ <code data-anolis-spec=streams>type</code> attribute.
<p>Let the <span>request entity body</span> be the raw data
- represented by <var>data</var>.</p>
+ represented by <var>data</var>.
</dd>
@@ -1154,8 +1159,6 @@ <h3 id="request">Request</h3>
<span data-anolis-spec=html><code>multipart/form-data</code> boundary string</span>
generated by the
<span data-anolis-spec=html><code>multipart/form-data</code> encoding algorithm</span>.
- </dd>
-
</dl>
<p>If a <code>Content-Type</code> header is in
@@ -2161,6 +2164,8 @@ <h3 id="response">Response</h3>
algorithm:</p>
<ol>
+ <li><p>If the <span>response entity body</span> is null, return null.
+
<li><p>Let <var title>JSON text</var> be the result of running
<span data-anolis-spec=encoding>utf-8 decode</span> on byte stream
<span>response entity body</span>.
@@ -2172,6 +2177,21 @@ <h3 id="response">Response</h3>
</ol>
+<p>The <dfn>stream response entity body</dfn> is
+<code data-anolis-spec=streams>Stream</code> object representing the
+<span>response entity body</span>. The
+<span>stream response entity body</span> is the return value of the
+following algorithm:
+
+<ol>
+ <li><p>If the <span>response entity body</span> is null, return an empty
+ <code data-anolis-spec=streams>Stream</code> object.
+
+ <li><p>Return a <code data-anolis-spec=streams>Stream</code> object \
+ representing the <span>response entity body</span>.
+</ol>
+
+
<p>The <dfn id="text-response-entity-body">text response entity body</dfn>
is a string representing the <span>response entity body</span>. The
<span>text response entity body</span> is the return value of the
@@ -2271,8 +2291,9 @@ <h3 id="response">Response</h3>
"<code title>arraybuffer</code>",
"<code title>blob</code>",
"<code title>document</code>",
- "<code title>json</code>", and
- "<code title>text</code>".</p>
+ "<code title>json</code>",
+ "<code title>stream</code>", and
+ "<code title>text</code>".
<p>When set: throws an
"<code data-anolis-spec=dom>InvalidStateError</code>" exception if the
state is <span title="dom-XMLHttpRequest-LOADING">LOADING</span> or
@@ -2343,7 +2364,22 @@ <h3 id="response">Response</h3>
<li><p>Return the <span>text response entity body</span>.</p></li>
</ol>
- </dd>
+
+ <dt>If <code title="dom-XMLHttpRequest-responseType">responseType</code>
+ is "<code title>stream</code>"
+ <dd>
+ <ol>
+ <li><p>If the state is not
+ <span title="dom-XMLHttpRequest-LOADING">LOADING</span> or
+ <span title="dom-XMLHttpRequest-DONE">DONE</span>, return null and
+ terminate these steps.
+
+ <li><p>If the <span>error flag</span> is set, return null and terminate
+ these steps.
+
+ <li><p>Return the <span>stream response entity body</span>.
+ </ol>
+
<dt>Otherwise</dt>
<dd>
<ol>
@@ -2380,9 +2416,7 @@ <h3 id="response">Response</h3>
<dd><p>Return the
<span>JSON response entity body</span>.</p></dd>
</dl>
- </li>
</ol>
- </dd>
</dl>
@@ -2838,6 +2872,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
<p>The editor would like to thank
Addison Phillips,
+ Adrian Bateman,
Ahmed Kamel,
Alex Hopmann,
Alex Vincent,
@@ -2863,6 +2898,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
Eric Lawrence,
Eric Uhrhane,
Erik Dahlstr&ouml;m,
+ Feras Moussa,
Geoffrey Sneddon,
Gideon Cohn,
Glenn Adams,
@@ -2911,6 +2947,7 @@ <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
Sunava Dutta,
Thomas Roessler,
Tom Magliery,
+ Travis Leithead,
Yehuda Katz, and
Zhenbin Xu

0 comments on commit 4b56e0f

Please sign in to comment.