зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 7e51efbbf1d6 (bug 1170809
) for somehow making ASAN opt builds perma-timeout.
CLOSED TREE
This commit is contained in:
Родитель
deabeb4bb7
Коммит
22d21b961c
|
@ -678,20 +678,13 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
|
|||
&destBufferLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
CheckedInt32 neededCapacity = destBufferLen;
|
||||
neededCapacity += mResponseText.Length();
|
||||
|
||||
if (!neededCapacity.isValid()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!mResponseText.SetCapacity(neededCapacity.value(), fallible)) {
|
||||
if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen, fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
char16_t* destBuffer = mResponseText.BeginWriting() + mResponseText.Length();
|
||||
|
||||
CheckedInt32 totalChars = mResponseText.Length();
|
||||
int32_t totalChars = mResponseText.Length();
|
||||
|
||||
// This code here is basically a copy of a similar thing in
|
||||
// nsScanner::Append(const char* aBuffer, uint32_t aLen).
|
||||
|
@ -704,11 +697,9 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
|
|||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
totalChars += destlen;
|
||||
if (!totalChars.isValid()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mResponseText.SetLength(totalChars.value());
|
||||
mResponseText.SetLength(totalChars);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче