Re: [XHR2] responseBody (byte array)

On Jul 27, 2007, at 8:49 AM, Anne van Kesteren wrote:

>
> Internet Explorer 7 supposedly introduced a new responseBody member  
> for XMLHttpRequest that returns an array of unsigned integers.  
> Likewise, send() now accepts such an argument. However, I've been  
> unable to make it work.  I'm planning to specify it as an Array of  
> unsigned integers. Hopefully this will be compatible with whatever  
> ES4 introduces for byte arrays.

I don't think it will be - a ByteArray is not an Array, in the current  
proposal. I think it would be better to either steal the ES4 ByteArray  
definition (it's not really tied to the rest of the language) or make  
up a custom interface for an octet sequence. An Array of unsigned  
integers is a very inefficient way to encode binary data, it will blow  
out the memory requirements by at least 4x.

> My plan for send() is that if it's passed an Array which contains  
> non-unsigned integers that those are converted to 0 and that  
> unsigned integers larger than 255 are converted to 255.

Here again I think a real ByteArray type would work better, though I  
think allowing an Array in this case is also ok.

See http://developer.mozilla.org/es4/proposals/bytearray.html for  
details on the proposal.

Regards,
Maciej

Received on Sunday, 29 July 2007 03:36:18 UTC