Backed out changeset dfdca3f63b48 (bug 1170809) for causing linux/android crashes on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 10 Jun 2015 16:22:45 +0200
changeset 248058 8f01b41b169e42bc7f5094acef78fa9f8686f493
parent 248057 168cdb48c5ebb33f8067918e67081c92234c7631
child 248059 fc4444e384ba699a67da8c1b1c286b7fdba3d919
push id28888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:29:45 +0000
treeherdermozilla-central@04c057942da4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1170809
milestone41.0a1
backs outdfdca3f63b4872dc87765b89707c9b8ce1f87264
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset dfdca3f63b48 (bug 1170809) for causing linux/android crashes on a CLOSED TREE
dom/base/nsXMLHttpRequest.cpp
--- a/dom/base/nsXMLHttpRequest.cpp
+++ b/dom/base/nsXMLHttpRequest.cpp
@@ -673,47 +673,38 @@ nsXMLHttpRequest::AppendToResponseText(c
 {
   NS_ENSURE_STATE(mDecoder);
 
   int32_t destBufferLen;
   nsresult rv = mDecoder->GetMaxLength(aSrcBuffer, aSrcBufferLen,
                                        &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).
   int32_t srclen = (int32_t)aSrcBufferLen;
   int32_t destlen = (int32_t)destBufferLen;
   rv = mDecoder->Convert(aSrcBuffer,
                          &srclen,
                          destBuffer,
                          &destlen);
   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;
 }
 
 /* readonly attribute AString responseText; */
 NS_IMETHODIMP
 nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
 {
   ErrorResult rv;