W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2005

[whatwg] XMLHttpRequest readyState==3

From: David Flanagan <david@davidflanagan.com>
Date: Mon, 26 Sep 2005 21:40:48 -0700
Message-ID: <4338CD50.8030608@davidflanagan.com>
Ian,

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 
stuff...

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?

	David
Received on Monday, 26 September 2005 21:40:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:24 UTC