W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: XHR responseArrayBuffer attribute: suggestion to replace "asBlob" with "responseType"

From: Nathan <nathan@webr3.org>
Date: Wed, 27 Oct 2010 01:05:56 +0100
Message-ID: <4CC76CE4.2050304@webr3.org>
To: Chris Marrin <cmarrin@apple.com>
CC: Jeremy Orlow <jorlow@chromium.org>, Boris Zbarsky <bzbarsky@mit.edu>, Chris Rogers <crogers@google.com>, Web Applications Working Group WG <public-webapps@w3.org>, Anne van Kesteren <annevk@opera.com>, Eric Uhrhane <ericu@google.com>, michaeln@google.com, Darin Fisher <darin@google.com>, Alexey Proskuryakov <ap@webkit.org>, Geoffrey Garen <ggaren@apple.com>
Chris Marrin wrote:
> On Oct 25, 2010, at 4:07 PM, Jeremy Orlow wrote:
>> ...3. Get rid of the "asBlob" attribute and add a new "responseType"
>> attribute which could be:
>> "Text" <--- this is the default
>> "XML"
>> "Bytes"
>> ... other types yet to be defined
>> I'm not sure I follow this proposal.
>> The parameter would be added to .open() (after username and password).  This means you'd have to pass in undefined for both in most uses.  And it has the disadvantage you mentioned for #2.
> It could be done in a separate call (setResponseType(in DOMString type)), to avoid that.

This seems like the most extensible and future compatible option, it 
also simplifies the interface.

Out of interest, would there be a way in which a callback could be used 
to set the response type *after* headers have been received, or to pass 
in some structured map of content-type to response-type settings?

The use-case I'm looking at (and would actually benefit from) is that 
often I send accept headers when following links to resources on the 
web, in some cases based on the content type I'd want to set it to Text, 
XML or Bytes, the point though is that there's no way you could define a 
single logic for this, nor I, and I'd need to provide a function to do 
this selection. Also note that the preference change based on context, 
sometimes I want the same media type as Text, other times and XML, other 
times as Bytes - the only way to handle this optimally (that I can see) 
would be by executing a callback, or by passing a map structure 
containing preferences for each content type.


Received on Wednesday, 27 October 2010 00:06:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:13 UTC