Backed out changeset 7e51efbbf1d6 (bug 1170809) for somehow making ASAN opt builds perma-timeout.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-06-10 15:30:10 -04:00
parent 636a28cadb
commit 02e294ee46

View File

@ -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;
}