Re: [XHR2] responseType and response properties

On Sat, 21 May 2011 09:36:51 +0200, Jonas Sicking <jonas@sicking.cc> wrote:
> First, should it return a new ArrayBuffer every time the property is
> accessed (This is how the mozResponseArrayBuffer property in FF4
> behaves), or should it return the same buffer every time? Since
> arraybuffers are mutable, there's a risk that one consumer will modify
> the response such that all other consumers see a modified result. On
> the other hand creating a new buffer every time can be quite expensive
> (at least without complex/slow copy-on-write implementations). It also
> would result in the surprising property that xhr.response !=
> xhr.response.

Per the specification you always get the same ArrayBuffer/Blob/Document.


> Second, what should .response return before the download finishes? It
> would be nice if you could access partial results. However
> ArrayBuffers are fixed size and we won't know the total size until the
> whole download is finished. We could return a copy on each access, but
> again that would be somewhat expensive.
>
> For now we're going to return null during loading in FF6 when
> .responseType is set to "arraybuffer".

That is what the specification requires...


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 21 June 2011 15:52:22 UTC