[whatwg/xhr] Wrong state after abort() (#88)

The `abort()` method, as in the spec:
> 1. Terminate the request.
> 2. If state is either opened with the send() flag set, headers received, or loading, run the request error steps for event abort.
> 3. If state is done, set state to unsent.

Consider this:
```js
var xhr = new XMLHttpRequest(); // UNSENT
xhr.open('GET', '');            // OPENED with send() flag unset
xhr.abort();                    // UNSENT
```

Following the spec, nothing should happen in steps `2` and `3`, leaving the state `OPENED`. This breaks [web-platform-tests/abort-during-open](https://github.com/w3c/web-platform-tests/blob/master/XMLHttpRequest/abort-during-open.js), which expects `UNSENT`.

>From what I've seen, the abort spec was last changed in the scope of #54.

At this point I have no good suggestion on how to reformulate it to pass [web-platform-tests/abort-during-open](https://github.com/w3c/web-platform-tests/blob/master/XMLHttpRequest/abort-during-open.js) and [web-platform-tests/open-during-abort](https://github.com/w3c/web-platform-tests/blob/master/XMLHttpRequest/open-during-abort.htm), as both get to step `3` with "OPENED with send() flag unset", but the final status is expected to be different.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/issues/88

Received on Saturday, 3 September 2016 01:57:42 UTC