On Mon, Jul 1, 2013 at 11:31 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Mon, Jul 1, 2013 at 9:03 AM, Takeshi Yoshino <tyoshino@google.com>
> wrote:> When size is not given, we need to mark it "fully read" by using
> something
> > else. I changed to use read position == -1.
>
> I'm not sure I follow. Isn't the maxSize argument optional so you can
> read all the data queued up thus far?
What I have in my mind is like this:
if (this.readyState == this.LOADING) {
stream = xhr.response;
// XHR has already written some data x0 to stream
stream.read().progress(progressHandler);
}
...loop...
// XHR writes data x1 to stream
// XHR writes data x2 to stream
// XHR finishes writing to stream
progressHandler continues receiving data till EOF. For this read() call
without maxSize, all of x0, x1 and x2 will be passed to progressHandler.
> It seems that should just work
> and not prevent more data queued in the future to be read from the
>
read position = -1 just prevents another read() from being issued on this
stream.
> > You mean that something similar to XHR's responseType is preferred?
>
> Do we even need that? It seems just passing ArrayBuffer in and out
> could be sufficient for now?
>
As one of read()'s arguments?
> What's "pending read resolvers"?
>
When any error occurs the stream needs to pending promises. So, I prepared
that list but I haven't written any text for error handling yet.