W3C home > Mailing lists > Public > public-webapi@w3.org > September 2006

Re: XMLHttpRequest state after a send()

From: Anne van Kesteren <annevk@opera.com>
Date: Wed, 20 Sep 2006 11:05:01 -0000
To: "Alexey Proskuryakov" <ap-carbon@rambler.ru>
Cc: "Web APIs WG (public)" <public-webapi@w3.org>
Message-ID: <op.tf5b31a564w2qv@id-c0020.emi.ac.ma>

On Tue, 19 Sep 2006 14:01:41 -0000, Alexey Proskuryakov  
<ap-carbon@rambler.ru> wrote:
> I have tried searching the archives, but couldn't find this already
> discussed.
>   The specification defines states 1 and 2 as:
> 1 Open. The open() method has been successfully called.
> 2 Sent. The UA successfully completed the request, but no data has yet  
> been
> received.
>   For async requests, send() MUST return immediately, i.e. even before
> resolving the hostname. However, it is also specified that the state  
> MUST be
> set to Sent, which apparently violates its definition.
>   In my tests, WinIE 6, Firefox 1.5 and Safari 2 all do not change
> readyState in an async send(). This effectively means that state Open is
> followed by an additional pseudo-state with the same numerical value  
> (e.g.,
> Safari currently ignores subsequent send() requests).

So one way of doing it would be that after the request is completed you go  
to 2, then quickly to 3 and even quicker to 4 dispatching readystatechange  
in the process. Another way of doing it would be to go directly to 4 for  
async requests and dispatch readystatechange when going from 1 to 4.

The people I talked to about this feel that doing the latter makes more  
sense and I tend to agree. It also means you can easily switch between  
async and sync requests.

Anne van Kesteren
Received on Wednesday, 20 September 2006 11:05:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:21 UTC