Re: [XHR2] XMLHttpRequest and progress events

On Jul 27, 2007, at 9:00 AM, Anne van Kesteren wrote:

>
> 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?

It would need the network layer to tell it.

> 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?

Don't know the answers to these, but I think it would be helpful to  
get a complete set of events for an upload, in other words, the same  
set you'd get for the corresponding download.

Regards,
Maciej

Received on Sunday, 29 July 2007 03:36:18 UTC