On Tue, 14 Sep 2010 18:00:21 +0200, Sergiu Dumitriu
<[email protected]> wrote:
Indeed, this will have weird results:
1. open()
2. Add listeners
3. send()
4. abort()
5. In the readystatechange listener, call open() and send()
6. abort continues, and sends the next events: abort, loadend, but now
the object's state is wrong: the state is not DONE, there might be
network activity, the error flag is not set.
7. The abort algorithm sets the state to UNSENT, although a request is
in progress.
One option would be to change the open() algorithm, so that step 15
aborts both the send() and abort() algorithms, and also the "request
error" algorithm. But this means that listeners won't get all the events
(this is also true if the open method is called when a request is
already in progress).
abort() can now be terminated too (by open()).
Allowing open() to be called at all times makes it almost impossible to
fix this error, so another option is to not allow open to be called when
some other algorithms are in progress.
That seems a more dangerous way to fix this so I have not done that.
--
Anne van Kesteren
http://annevankesteren.nl/