Re: Streams and Blobs

On Fri, Mar 15, 2013 at 7:23 PM, Jonas Sicking <jonas@sicking.cc> wrote:

> > Specifically, I'd recommend that when readyState isn't UNSENT, setting
> > responseType to "stream" should fail, and if readyState is set to
> "stream"
> > then setting it to something else should fail.  That is, once the
> request is
> > started it's too late to change into or out of stream mode.
>
> That would mean not supporting the ability to choose to handle a
> response as a Stream based on metadata in the response. That was the
> reason we decided to support setting .responseType in the
> HEADERS_RECEIVED state to other values. I don't see why the same
> reasons doesn't apply here.
>

Change "readyState != UNSENT" above to "readyState > HEADERS_RECEIVED".
That means you have a last chance to change to or from stream mode during
the HEADERS_RECEIVED onreadystatechange event, after headers are available
and before any of the body is read, but once you're in LOADING or DONE,
stream mode is locked in (or out).  (This should apply to both of the XHR
models we've been discussing.)

-- 
Glenn Maynard

Received on Saturday, 16 March 2013 00:44:11 UTC