Bug 1011748 - Added logic to GetStatusText to ensure the statusText is available after all redirects (if any) have been followed. r=bz

This commit is contained in:
Michael A. Milazzo 2014-06-09 23:14:53 -07:00
parent fa785309a3
commit 141256b4cf

View File

@ -1169,7 +1169,17 @@ nsXMLHttpRequest::GetStatusText(nsCString& aStatusText)
return;
}
httpChannel->GetResponseStatusText(aStatusText);
// Check the current XHR state to see if it is valid to obtain the statusText
// value. This check is to prevent the status text for redirects from being
// available before all the redirects have been followed and HTTP headers have
// been received.
uint16_t readyState;
GetReadyState(&readyState);
if (readyState != OPENED && readyState != UNSENT) {
httpChannel->GetResponseStatusText(aStatusText);
}
}