[XHR2] XMLHttpRequest and progress events

I've been looking into integrating progress events into XMLHttpRequest. In  
general it is pretty trivial to do for the request non-uploading scenario.  
loadstart is dispatched right after the first readystatechange event is  
dispatched in the send() algorithm and progress is dispatched while  
downloading. (abort, error and load are pretty obvious). I decided to only  
dispatch them for synchronous requests. load, as exception, is also  
dispatched in the synchronous case. (For abort and error the synchronous  
case throws an exception and loadstart and progress are not useful after  
the request has already completed.)

The main problem is probably the XMLHttpRequestUpload object  
(XMLHttpRequest.upload) which we decided to use for data going to the  
server. Can someone explain to me how the user agent knows how much  
content it already has uploaded? Should we dispatch a loadstart event on  
that object as well even though it will be at the same moment it is  
dispatched on the XMLHttpRequest object? When to dispatch the progress  
events and abort, error, etc?


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Friday, 27 July 2007 16:01:06 UTC