[XHR] question about spec text and tests for double open() calls

Small question regarding these tests:
open-send-open.htm
open-sync-open-send.htm

Test topic: how many readystatechange events are sent if a script in one single script thread does xhr.open(...);xhr.send();xhr.open(...)?


Test expectation: one single event, with readyState 1. Both Opera (Presto) and Chrome pass the test, however, I don't see how this can be expected by *reading* the spec. 


Firstly, the test tests a race condition - it is unlikely to cause problems in practice though (the result of the request *might* just come quickly enough that it has changed to for example readyState 2 and fired another readystatechange event before the second open() call, but it's unlikely).


Secondly, by reading the spec I'd expect the second open() call to fire another event. The open() method, steps 15 and 16:

15  Change the state to OPENED. 
16  Fire an event named readystatechange.

Doesn't imply that if the state is already OPENED, no new event is expected to fire. Does any other part of the spec indicate this?

PS: http://xhr.spec.whatwg.org/#event-xhr-readystatechange - is this description still true? It doesn't really give much information and I thought the messy parts were cleaned up anyway.

-- 
Hallvord R. M. Steen
Core tester, Opera Software

Received on Monday, 13 May 2013 18:05:27 UTC