Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Geoffrey Garen
Hi Chris. I like the efficiency of this approach. And I agree with your premise that a developer will probably only want one type of data (raw, text, or XML) per request, and not more than one. My biggest concern with this idea is that there's nothing obvious about the API pattern of three

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Darin Fisher
The solution for .responseBlob was to add an .asBlob attribute that would need to be set to true before calling .send(). We could do the same for .responseArrayBuffer. -Darin On Mon, Oct 25, 2010 at 12:17 PM, Geoffrey Garen gga...@apple.com wrote: Hi Chris. I like the efficiency of this

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Chris Marrin
On Oct 25, 2010, at 12:22 PM, Darin Fisher wrote: The solution for .responseBlob was to add an .asBlob attribute that would need to be set to true before calling .send(). We could do the same for .responseArrayBuffer. -Darin On Mon, Oct 25, 2010 at 12:17 PM, Geoffrey Garen

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Darin Fisher
On Mon, Oct 25, 2010 at 12:34 PM, Chris Marrin cmar...@apple.com wrote: On Oct 25, 2010, at 12:22 PM, Darin Fisher wrote: The solution for .responseBlob was to add an .asBlob attribute that would need to be set to true before calling .send(). We could do the same for .responseArrayBuffer.

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Chris Rogers
passing undefined as the 4th and 5th arguments seems pretty clunky to me. Since, we already have an asBlob attribute, then asArrayBuffer like Darin suggests seems like it might be better. However, then we can get into cases where both asBlob and asArrayBuffer are set, and this problem would get

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Darin Fisher
How do you address the discoverability issue that I raised? asBlob and asArrayBuffer have the benefit of being detectable at runtime. but, a settable responseType does not support detection of supported values. -Darin On Mon, Oct 25, 2010 at 2:54 PM, Chris Rogers crog...@google.com wrote:

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Chris Rogers
True, it's not as simple as checking for the existence of an attribute, but it could throw an exception. It seems like having both asBlob and asArrayBuffer also creates the possibility of bad combinations of settings which could get confusing, especially if more types are added in the future.

Re: [webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-25 Thread Geoffrey Garen
You could aid discoverability -- and programming -- by providing a set of enumerated constants on the XHR constructor, much like the Node constructor provides for NodeTypes. Another option would be to throw an exception when setting responseType to an unsupported value. Geoff On Oct 25,

[webkit-dev] XHR responseArrayBuffer attribute: possible implementation

2010-10-22 Thread Chris Rogers
A few weeks ago I brought up the idea of implementing the responseArrayBuffer attribute for XHR: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#the-responsearraybuffer-attribute One of the concerns was that it might require double the memory usage since the raw bytes would have to be accumulated

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-30 Thread Chris Marrin
On Sep 29, 2010, at 6:34 PM, Maciej Stachowiak wrote: ...The idea is that when an ArrayBuffer is sent via postMessage, it is atomically closed on this side; its publicly visible length goes to 0, as do the lengths of any views referring to it. On the other side, a new ArrayBuffer wrapper

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-30 Thread Kenneth Russell
On Thu, Sep 30, 2010 at 7:09 AM, Chris Marrin cmar...@apple.com wrote: On Sep 29, 2010, at 6:34 PM, Maciej Stachowiak wrote: ...The idea is that when an ArrayBuffer is sent via postMessage, it is atomically closed on this side; its publicly visible length goes to 0, as do the lengths of

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-30 Thread Chris Marrin
On Sep 30, 2010, at 10:46 AM, Kenneth Russell wrote: ... Sure, transfer semantics avoid shared mutable state, though it would be inconsistent with most other pure data types. But what if you have some data that doesn't need mutating but you'd like to share with multiple other Workers? Now

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-30 Thread Kenneth Russell
On Thu, Sep 30, 2010 at 11:51 AM, Chris Marrin cmar...@apple.com wrote: On Sep 30, 2010, at 10:46 AM, Kenneth Russell wrote: ... Sure, transfer semantics avoid shared mutable state, though it would be inconsistent with most other pure data types. But what if you have some data that doesn't

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-29 Thread Kenneth Russell
On Tue, Sep 28, 2010 at 11:26 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 11:05 AM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 9:45 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 7:15 AM, Chris Marrin wrote: On Sep 27, 2010, at 6:37 PM, Maciej

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-29 Thread Maciej Stachowiak
On Sep 29, 2010, at 2:02 PM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 11:26 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 11:05 AM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 9:45 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 7:15 AM, Chris

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-29 Thread Eric Uhrhane
On Wed, Sep 29, 2010 at 6:34 PM, Maciej Stachowiak m...@apple.com wrote: On Sep 29, 2010, at 2:02 PM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 11:26 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 11:05 AM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 9:45 AM,

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Chris Marrin
On Sep 27, 2010, at 6:37 PM, Maciej Stachowiak wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. We could keep the raw data around, which hopefully is directly usable as

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Chris Marrin
On Sep 27, 2010, at 6:40 PM, James Robinson wrote: On Mon, Sep 27, 2010 at 6:37 PM, Maciej Stachowiak m...@apple.com wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. We

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Maciej Stachowiak
On Sep 28, 2010, at 7:15 AM, Chris Marrin wrote: On Sep 27, 2010, at 6:37 PM, Maciej Stachowiak wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. We could keep the

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Chris Marrin
On Sep 28, 2010, at 9:45 AM, Maciej Stachowiak wrote: On Sep 28, 2010, at 7:15 AM, Chris Marrin wrote: On Sep 27, 2010, at 6:37 PM, Maciej Stachowiak wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Kenneth Russell
On Tue, Sep 28, 2010 at 9:45 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 7:15 AM, Chris Marrin wrote: On Sep 27, 2010, at 6:37 PM, Maciej Stachowiak wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-28 Thread Maciej Stachowiak
On Sep 28, 2010, at 11:05 AM, Kenneth Russell wrote: On Tue, Sep 28, 2010 at 9:45 AM, Maciej Stachowiak m...@apple.com wrote: On Sep 28, 2010, at 7:15 AM, Chris Marrin wrote: On Sep 27, 2010, at 6:37 PM, Maciej Stachowiak wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote:

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread Michael Nordman
Yes, if we go with telling xhr up front for the array buffer case, I guess an enum would be slightly better. On Fri, Sep 24, 2010 at 8:39 PM, Chris Rogers crog...@google.com wrote: If we added xhr.asArrayBuffer, what would happen if xhr.asBlob was also set? Don't we really want something like

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread Anne van Kesteren
(I'm subscribed to webkit-dev with a different address.) On Mon, Sep 27, 2010 at 8:31 PM, Michael Nordman micha...@google.com wrote: Yes, if we go with telling xhr up front for the array buffer case, I guess an enum would be slightly better. I do not think this should be told up front. You

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread Michael Nordman
Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. On Mon, Sep 27, 2010 at 2:40 PM, Anne van Kesteren annevankeste...@gmail.com wrote: (I'm subscribed to webkit-dev with a different address.) On Mon, Sep 27, 2010 at 8:31 PM, Michael

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread Maciej Stachowiak
On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. We could keep the raw data around, which hopefully is directly usable as an ArrayBuffer backing store, and only translate it to text

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread James Robinson
On Mon, Sep 27, 2010 at 2:40 PM, Anne van Kesteren annevankeste...@gmail.com wrote: (I'm subscribed to webkit-dev with a different address.) On Mon, Sep 27, 2010 at 8:31 PM, Michael Nordman micha...@google.com wrote: Yes, if we go with telling xhr up front for the array buffer case, I

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-27 Thread James Robinson
On Mon, Sep 27, 2010 at 6:37 PM, Maciej Stachowiak m...@apple.com wrote: On Sep 27, 2010, at 3:19 PM, Michael Nordman wrote: Webkit's XHR currently does not keep two copies of the data that I can see. I think we should avoid that. We could keep the raw data around, which hopefully is

[webkit-dev] XHR responseArrayBuffer attribute

2010-09-24 Thread Chris Rogers
I've noticed that the responseArrayBuffer attribute has recently been added to the XMLHttpRequest-2 specification: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#the-responsearraybuffer-attribute I was interested to know if anybody was planning on implementing that attribute soon. If not, I

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-24 Thread Alexey Proskuryakov
24.09.2010, в 16:37, Chris Rogers написал(а): I was interested to know if anybody was planning on implementing that attribute soon. If not, I would like to add this myself. The key problem to solve is how to not double the memory use of the XMLHttpRequest object, while not making

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-24 Thread Eric Uhrhane
On Fri, Sep 24, 2010 at 5:09 PM, Alexey Proskuryakov a...@webkit.org wrote: 24.09.2010, в 16:37, Chris Rogers написал(а): I was interested to know if anybody was planning on implementing that attribute soon.  If not, I would like to add this myself. The key problem to solve is how to not

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-24 Thread Michael Nordman
With xhr.responseBlob we chose to have the caller decide up front and tell the xhr object how it would like the response by setting the xhr.asBlob attribute prior to calling send(). We could do the same with xhr.asArrayBuffer. On Fri, Sep 24, 2010 at 5:09 PM, Alexey Proskuryakov a...@webkit.org

Re: [webkit-dev] XHR responseArrayBuffer attribute

2010-09-24 Thread Chris Rogers
If we added xhr.asArrayBuffer, what would happen if xhr.asBlob was also set? Don't we really want something like xhr.loadAsType with different enum values for text, blob, array buffer, etc.? On Fri, Sep 24, 2010 at 5:19 PM, Michael Nordman micha...@google.comwrote: With xhr.responseBlob we