Don't throw when status is gotten after a server timeout or some such. Bug

304980, r=darin, sr=jst


git-svn-id: svn://10.0.0.236/trunk@194939 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-04-20 03:39:50 +00:00
parent 3e2f3a77d1
commit 354da864fe

View File

@@ -630,7 +630,21 @@ nsXMLHttpRequest::GetStatus(PRUint32 *aStatus)
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
if (httpChannel) {
return httpChannel->GetResponseStatus(aStatus);
nsresult rv = httpChannel->GetResponseStatus(aStatus);
if (rv == NS_ERROR_NOT_AVAILABLE) {
// Someone's calling this before we got a response... Check our
// ReadyState. If we're at 3 or 4, then this means the connection
// errored before we got any data; return a somewhat sensible error code
// in that case.
PRInt32 readyState;
GetReadyState(&readyState);
if (readyState >= 3) {
*aStatus = NS_ERROR_NOT_AVAILABLE;
return NS_OK;
}
}
return rv;
}
*aStatus = 0;