Bug 1410146 - Fix UnknownDecoder. r=mayhemer, a=ritu
authorDragana Damjanovic dd.mozilla@gmail.com
Tue, 24 Oct 2017 14:23:00 -0400
changeset 432781 5f5a87b7958692cc9713194f1d2fea0675dd1926
parent 432780 ce6aa85a6c1167f412ed202df163cd2959cc1fdb
child 432782 8be6ac878d991a2f15b9f44ffa3695f869220f5e
push id8056
push userryanvm@gmail.com
push dateThu, 26 Oct 2017 15:24:01 +0000
treeherdermozilla-beta@5f5a87b79586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, ritu
bugs1410146
milestone57.0
Bug 1410146 - Fix UnknownDecoder. r=mayhemer, a=ritu
netwerk/streamconv/converters/nsUnknownDecoder.cpp
--- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -70,16 +70,20 @@ nsUnknownDecoder::ConvertedStreamListene
                   OnDataAvailable(nsIRequest* request,
                                   nsISupports* context,
                                   nsIInputStream* stream,
                                   uint64_t offset,
                                   uint32_t count)
 {
   uint32_t read;
   nsAutoCString decodedData;
+  {
+    MutexAutoLock lock(mDecoder->mMutex);
+    decodedData = mDecoder->mDecodedData;
+  }
   nsresult rv = stream->ReadSegments(AppendDataToString, &decodedData, count,
                                      &read);
   if (NS_FAILED(rv)) {
     return rv;
   }
   MutexAutoLock lock(mDecoder->mMutex);
   mDecoder->mDecodedData = decodedData;
   return NS_OK;