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

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

From: Geoffrey Garen <ggaren@apple.com>
Date: Wed, 27 Oct 2010 11:56:34 -0700
Cc: Darin Fisher <darin@chromium.org>, 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, Alexey Proskuryakov <ap@webkit.org>, Chris Marrin <cmarrin@apple.com>, jorlow@google.com, jamesr@chromium.org
Message-Id: <1FFCB1D1-2955-4FB3-A13D-0208A2195606@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Hi Boris.

> As long as the same object provides both views and the views are mutually exclusive, it's really easy for the dispatcher to change what they ask for and subtly break other consumers he doesn't even know about.

To the contrary, I think eliminating subtlety is the main benefit of explicitly selecting a response type and throwing exception on incorrect access.

Quietly providing multiple copies of data creates a subtle memory use problem.

Explicitly throwing an exception at the site that tries to access the data in the wrong way obviously and immediately points a finger at the problem.

The potential downside to an exception is not subtlety -- it's limited functionality: clients are no longer allowed to ask XHR to be more than one kind of data at once. The question is, can library authors make their code compatible with this limitation?

I don't think it's possible to answer that question until someone fleshes out your assumption that libraries routinely intercept XHRs in transit and read their data. Which libraries do this, when, and why?

> This make it impossible to decide whether to look at the text or the bytes based on the content-type of the response (unless you allow setting the attribute in some early-enough onStateChange callback _and_ libraries expose XHRs in that early a state to consumers); having that ability seems like a desirable feature.

I'm not convinced that clients loading resources from their own domains somehow won't know the types of those resources.

But, if we believe this is a real concern, it seems fine to me to allow responseType to be set some time after open, or even set implicitly by the first access to a certain view of the response. That way, clients wanting to delay the responseType decision can, while clients wanting maximum clarity and control can set responseType early.

Thanks,
Geoff
Received on Wednesday, 27 October 2010 18:57:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:41 GMT