[whatwg] XMLHttpRequest readyState==3

David Flanagan david at davidflanagan.com
Mon Sep 26 21:40:48 PDT 2005


This is a followup to my previous message.

If onreadystatechange is guaranteed to be called only once for 
readyState 3, then I don't see much point in making responseText 
available in this state.  It seems like it will encourage the use of 
window.setTimeout() to poll the responseText property looking for new 

If you think that programmers might be interested looking at partial 
responses, then maybe you should call onreadystatechange each time a new 
chunk of the response becomes available.

Furthermore, the ambiguity of the headers is a little problematic.  If 
you query a header and get null in response, you don't know if it is 
because that header was not in the first packet and is yet to come or if 
  it simply does not exist.  I suppose you could check the length of 
responseText to determine whether all headers have been downloaded yet 
or not.  But I'd say that there ought to be some more explicit way to 
determine whether all headers have been received.  If responseText is 
being parsed out and made available on readyState 3, then it seems to me 
that you ought to just go ahead and say that state 3 means that all 
headers have been received and that the response body is being loaded...

Here's something else to think about: if the server's entire response 
arrives in a single packet, can the UA skip state 3 and jump directly to 
state 4?  Or is there a guarantee that onreadystatechange will be 
invoked for each state?


More information about the whatwg mailing list