зеркало из https://github.com/mozilla/gecko-dev.git
Bug 697689 - Fix XHR brokenness, the optimization violated a nsIStreamLisetner contract; r=jonas
This commit is contained in:
Родитель
5d674678fa
Коммит
8f9e7ff037
|
@ -1738,13 +1738,11 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
|
|||
|
||||
mProgressSinceLastProgressEvent = true;
|
||||
|
||||
bool cancelable = false;
|
||||
if (mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB && !mResponseBlob) {
|
||||
if (CreateResponseBlob(request)) {
|
||||
// We don't have to read from the local file for the blob response
|
||||
mResponseBlob->GetSize(&mLoadTransferred);
|
||||
ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
return request->Cancel(NS_OK);
|
||||
}
|
||||
cancelable = CreateResponseBlob(request);
|
||||
// The nsIStreamListener contract mandates us
|
||||
// to read from the stream before returning.
|
||||
}
|
||||
|
||||
PRUint32 totalRead;
|
||||
|
@ -1752,6 +1750,13 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
|
|||
(void*)this, count, &totalRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (cancelable) {
|
||||
// We don't have to read from the local file for the blob response
|
||||
mResponseBlob->GetSize(&mLoadTransferred);
|
||||
ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
return request->Cancel(NS_OK);
|
||||
}
|
||||
|
||||
mLoadTransferred += totalRead;
|
||||
|
||||
ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
|
|
Загрузка…
Ссылка в новой задаче