Re: [XHR2] responseText for text/html before the encoding has stabilized

On Fri, 30 Sep 2011 21:41:39 +0200, Jonas Sicking <jonas@sicking.cc> wrote:
> On Fri, Sep 30, 2011 at 12:11 PM, Anne van Kesteren <annevk@opera.com>  
> wrote:
>> On Fri, 30 Sep 2011 19:26:48 +0200, Jonas Sicking <jonas@sicking.cc>  
>> wrote:
>>> Hmm.. I looked through archives but can't find any such decision.
>>>
>>> It's not how Gecko works, but I haven't tried webkit.
>>
>> http://lists.w3.org/Archives/Public/public-webapps/2010OctDec/0812.html
>
> That email does not seem to mention how to determine encoding at all,
> so I still wouldn't say that that's something "we" decided on as much
> as what "you" decided :-)

It mentions the conclusion from the discussion when we added  
response/responseType that "text" and default would be equivalent for  
responseText and "document" and default would be equivalent for  
responseXML. That obviously includes determining encoding, which was  
decided prior to that (e.g. when XMLHttpRequest Level 1 excited Last Call  
and became Candidate Recommendation).


> But yes, I do now see that the spec draft defines how to do it here:
> http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#text-response-entity-body
> which is great.
>
> I do however think that steps 4 and 5 should only be done when
> .responseType is "" or "document". Especially for HTML it seems like
> it would require hairy HTML parsing, including in workers.

If we change how determining encoding works between default, "text", and  
"document", we should really start throwing for responseText and  
responseXML when responseType is not the default to indicate that is  
different.


> Also, it doesn't seem to work for things like "chunked-text" since it
> could require switching encoding part-way through, which means that
> "text" and "chunked-text" would be decoded differently, which I think
> would be very surprising.

Yeah, maybe.


>> Kind of weird that Gecko does not work this way since this is exactly  
>> what the standard defines. Then again, you often seem to ask questions  
>> already answered in the standard...
>
> Would you rather write specs without implementation feedback? I would
> imagine no.

Implementation feedback is feedback you give while implementing. Given  
that this feature is already in Gecko and you only now appear to have read  
the document... I guess it does not matter much, but I have the feeling  
that if Henri had not said anything I would have had to uncover Gecko not  
implementing the standard by myself.


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

Received on Saturday, 1 October 2011 07:03:46 UTC