mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Don't crash if AsyncOpen fails and the OnReadyStateChange handler restarts us.
Bug 366467, r+sr=sicking
This commit is contained in:
parent
bc0bc2fe1a
commit
f993c1bc3e
@ -1686,7 +1686,6 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
||||
mChannel->SetContentType(NS_LITERAL_CSTRING("application/xml"));
|
||||
|
||||
// Start reading from the channel
|
||||
ChangeState(XML_HTTP_REQUEST_SENT);
|
||||
rv = mChannel->AsyncOpen(listener, nsnull);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -1695,6 +1694,12 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Now that we've successfully opened the channel, we can change state. Note
|
||||
// that this needs to come after the AsyncOpen() and rv check, because this
|
||||
// can run script that would try to restart this request, and that could end
|
||||
// up doing our AsyncOpen on a null channel if the reentered AsyncOpen fails.
|
||||
ChangeState(XML_HTTP_REQUEST_SENT);
|
||||
|
||||
// If we're synchronous, spin an event loop here and wait
|
||||
if (!(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
nsIThread *thread = NS_GetCurrentThread();
|
||||
|
Loading…
Reference in New Issue
Block a user