Bug 1249739 - Improve performance in XHR in workers - part 4 - Correct cleaning cache for XHR.responseText, r=me
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 12 Sep 2016 10:59:10 +0200
changeset 354801 d95f98dcd8a4514d24be5618362e8e4a7b2a49af
parent 354800 2fc46e5f15dc4492d25c516a12cea1f4af89df97
child 354802 d85736dec5d0d1c605d471b53decef714b3b4074
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1249739
milestone51.0a1
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
Bug 1249739 - Improve performance in XHR in workers - part 4 - Correct cleaning cache for XHR.responseText, r=me
dom/xhr/XMLHttpRequestMainThread.cpp
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -553,17 +553,16 @@ XMLHttpRequestMainThread::AppendToRespon
   int32_t destlen = (int32_t)destBufferLen;
   rv = mDecoder->Convert(aSrcBuffer,
                          &srclen,
                          helper.EndOfExistingData(),
                          &destlen);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   MOZ_ASSERT(destlen <= destBufferLen);
 
-  XMLHttpRequestBinding::ClearCachedResponseTextValue(this);
   helper.AddLength(destlen);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XMLHttpRequestMainThread::GetResponseText(nsAString& aResponseText)
 {
   ErrorResult rv;
@@ -1694,16 +1693,17 @@ XMLHttpRequestMainThread::OnDataAvailabl
                                           uint64_t sourceOffset,
                                           uint32_t count)
 {
   NS_ENSURE_ARG_POINTER(inStr);
 
   MOZ_ASSERT(mContext.get() == ctxt,"start context different from OnDataAvailable context");
 
   mProgressSinceLastProgressEvent = true;
+  XMLHttpRequestBinding::ClearCachedResponseTextValue(this);
 
   bool cancelable = false;
   if ((mResponseType == XMLHttpRequestResponseType::Blob ||
        mResponseType == XMLHttpRequestResponseType::Moz_blob) && !mDOMBlob) {
     cancelable = CreateDOMBlob(request);
     // The nsIStreamListener contract mandates us
     // to read from the stream before returning.
   }