W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: [XHR2] timeout

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Tue, 15 Mar 2011 15:54:28 +0200
Message-ID: <4D7F6F94.4020405@helsinki.fi>
To: Anne van Kesteren <annevk@opera.com>
CC: Jonas Sicking <jonas@sicking.cc>, WebApps WG <public-webapps@w3.org>
On 11/12/2009 05:24 PM, Anne van Kesteren wrote:
> On Wed, 11 Nov 2009 00:03:07 +0100, Jonas Sicking <jonas@sicking.cc> wrote:
>> On Tue, Nov 10, 2009 at 10:17 AM, Anne van Kesteren <annevk@opera.com>
>> wrote:
>>> Anyway, do you have opinions on the synchronous case? Do you agree we
>>> should use TIMEOUT_ERR there? What do the people from Microsoft think?
>> That makes sense to me.
> I've now defined the timeout feature:
> http://dev.w3.org/2006/webapi/XMLHttpRequest-2/
> Please review it! (Same for FormData and really all other parts of the
> specification.)

I think timeout is a bit too limiting. Especially the step
2. "If the send() flag is true raise an INVALID_STATE_ERR exception and 
terminate these steps. "

What if dns resolving (or something else) takes just a bit too long and
then the timeout fires while something is being downloaded.
Whoever is using the API may have already read part of the data and may 
want to get rest of it.
So, could we allow increasing timeout value also after send().
Setting timeout to 0 to clear it should also be possible.

This way one could increase the timeout if needed.
var xhr = new XMLHttpRequest();
xhr.timeout = 10000; //10s
xhr.onprogress = function(evt) {
   // Ok, some progress is happening, increase the timeout so
   // that only very slowly loading XHR is cancelled.
   if (xhr.timeout == 10000) {
     xhr.timeout *= 2;

Received on Tuesday, 15 March 2011 13:55:19 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:30 UTC