- From: berniegp <notifications@github.com>
- Date: Fri, 14 Oct 2016 08:58:42 -0700
- To: whatwg/xhr <xhr@noreply.github.com>
- Message-ID: <whatwg/xhr/issues/88/253843151@github.com>
This code snippet from [Chromium's source](https://chromium.googlesource.com/chromium/blink.git/+/refs/heads/master/Source/core/xmlhttprequest/XMLHttpRequest.cpp) spells it out (lines 1002-1038): ``` bool XMLHttpRequest::internalAbort() { m_error = true; if (m_responseDocumentParser && !m_responseDocumentParser->isStopped()) m_responseDocumentParser->stopParsing(); clearVariablesForLoading(); if (m_responseLegacyStream && m_state != DONE) m_responseLegacyStream->abort(); clearResponse(); clearRequest(); if (!m_loader) return true; // Cancelling the ThreadableLoader m_loader may result in calling // window.onload synchronously. If such an onload handler contains open() // call on the same XMLHttpRequest object, reentry happens. // // If, window.onload contains open() and send(), m_loader will be set to // non 0 value. So, we cannot continue the outer open(). In such case, // just abort the outer open() by returning false. RefPtr<ThreadableLoader> loader = m_loader.release(); loader->cancel(); // If abort() called internalAbort() and a nested open() ended up // clearing the error flag, but didn't send(), make sure the error // flag is still set. bool newLoadStarted = m_loader; if (!newLoadStarted) m_error = true; return !newLoadStarted; } ``` If `internalAbort()` returns true (i.e. a nested `open()` was done), `abort()` does not set the state to `UNSENT`. -- 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#issuecomment-253843151
Received on Friday, 14 October 2016 15:59:14 UTC