- From: Boris Zbarsky <notifications@github.com>
- Date: Fri, 26 Feb 2016 09:40:30 -0800
- To: whatwg/xhr <xhr@noreply.github.com>
Received on Friday, 26 February 2016 17:40:58 UTC
Consider this testcase: var xhr = new XMLHttpRequest(); xhr.open("GET", "data:text/plain,"); console.log(xhr.readyState); xhr.send(); xhr.onreadystatechange = function() { xhr.onreadystatechange = null; xhr.open("GET", "data:text/plain,hello"); xhr.onload = function() { alert(xhr.responseText); } xhr.send(); } xhr.abort(); console.log(xhr.readyState); per the letter of the current spec, this should log 1 then 0. And it should alert "hello". This is the behavior I see in Blink and WebKit. However, this means that after the abort() call the readyState is 0 but there is a load in progress. That's the busted part. Gecko has a guard in abort() step 3 and only reset the state to "unsent" if it's still "done" after the request error steps and all their events have terminated. This leaves state as a correct reflection of the actual state of the object. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/xhr/issues/54
Received on Friday, 26 February 2016 17:40:58 UTC