- From: Jarred Nicholls <jarred@sencha.com>
- Date: Mon, 12 Dec 2011 12:08:08 -0500
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: public-webapps@w3.org
- Message-ID: <CANufG2N3zxBDBuS8uHK2-ehVyQESWvyAz1j1_tyVso-+sBZWQw@mail.gmail.com>
On Mon, Dec 12, 2011 at 9:28 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 12/12/11 8:12 AM, Jarred Nicholls wrote: > >> I started an initiative to bring XHR in WebKit up-to-spec (see >> https://bugs.webkit.org/show_**bug.cgi?id=54162<https://bugs.webkit.org/show_bug.cgi?id=54162>) >> and got a lot of push >> back. >> > > That seems to be about a different issue than responseType, right? > > I just tried the following testcase: > > <script> > var xhr = new XMLHttpRequest(); > xhr.open("GET", window.location, false); > xhr.responseType = "document" > xhr.send(); > try { alert(xhr.responseText); } catch (e) { alert(e); } > try { alert(xhr.responseXML); } catch (e) { alert(e); } > > xhr.open("GET", window.location, false); > xhr.responseType = "text" > xhr.send(); > try { alert(xhr.responseText); } catch (e) { alert(e); } > try { alert(xhr.responseXML); } catch (e) { alert(e); } > </script> > > Gecko behavior seems to be per spec: the attempt to get responseText fails > on the first XHR, and the attempt to get responseXML fails on the second > XHR. > > WebKit (tested Chrome dev channel and Safari 5.1.1 behavior) seems to be > partially per spec: the attempt to get responseText throws for the first > XHR, but the attempt to get the responseXML succeeds for the second XHR. > That sort of makes sense in terms of how I recall WebKit implementing > feeding data to their parser in XHR, if the implementation of responseType > just wasn't very careful. > There's no feeding (re: streaming) of data to a parser, it's buffered until the state is DONE (readyState == 4) and then an XML doc is created upon the first access to responseXML or response. Same will go for the JSON parser in our first iteration of implementing the "json" responseType. > > Given that WebKit already implements the right behavior when responseType > = "document", it sounds like the only bug on their end here is really > responseType = "text" handling, right? It'd definitely be good to just fix > that... Yeah I'm going to clean up all the mess. > > > -Boris > > Thanks! -- ................................................................ *Sencha* Jarred Nicholls, Senior Software Architect @jarrednicholls <http://twitter.com/jarrednicholls>
Received on Monday, 12 December 2011 17:16:47 UTC