Bug 1415081 - part 8 - Fix the use of NS_ReadInputStreamToString in DataTransferItem, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 09 Nov 2017 11:18:09 +0100
changeset 444210 79b9b464a9eb41ade2b197be4c91cec62198118c
parent 444209 161a4957d9b585511e1587f86a2c8ec92a2667fc
child 444211 82622938a7c9cc0444f52a5cb8a8ee8ae51fd1fc
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1415081
milestone58.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 1415081 - part 8 - Fix the use of NS_ReadInputStreamToString in DataTransferItem, r=smaug
dom/events/DataTransferItem.cpp
--- a/dom/events/DataTransferItem.cpp
+++ b/dom/events/DataTransferItem.cpp
@@ -392,23 +392,18 @@ DataTransferItem::CreateFileFromInputStr
   nsAutoString fileName;
   nsresult rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                    key, fileName);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
   uint64_t available;
-  rv = aStream->Available(&available);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return nullptr;
-  }
-
   void* data = nullptr;
-  rv = NS_ReadInputStreamToBuffer(aStream, &data, available);
+  rv = NS_ReadInputStreamToBuffer(aStream, &data, -1, &available);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
   return File::CreateMemoryFile(mDataTransfer, data, available, fileName,
                                 mType, PR_Now());
 }