Bug 1398733 - IPCBlobInputStream::Available() should return 0 before any AsyncWait() call, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 22 Sep 2017 08:12:19 +0200
changeset 382380 726caa0c36bac0763e33ffd6b65b306ebb3a676b
parent 382379 90af1cb3c4e3dc475ba446524c94cc45de452a0f
child 382381 5cf7391a9825fda34241f6d7974940f8460804fd
push id95318
push useramarchesini@mozilla.com
push dateFri, 22 Sep 2017 06:12:42 +0000
treeherdermozilla-inbound@726caa0c36ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1398733
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 1398733 - IPCBlobInputStream::Available() should return 0 before any AsyncWait() call, r=smaug
dom/file/ipc/IPCBlobInputStream.cpp
--- a/dom/file/ipc/IPCBlobInputStream.cpp
+++ b/dom/file/ipc/IPCBlobInputStream.cpp
@@ -157,31 +157,23 @@ IPCBlobInputStream::~IPCBlobInputStream(
 
 // nsIInputStream interface
 
 NS_IMETHODIMP
 IPCBlobInputStream::Available(uint64_t* aLength)
 {
   // We don't have a remoteStream yet. Let's return the full known size.
   if (mState == eInit || mState == ePending) {
-    *aLength = mLength;
+    *aLength = 0;
     return NS_OK;
   }
 
   if (mState == eRunning) {
     MOZ_ASSERT(mRemoteStream || mAsyncRemoteStream);
 
-    // This will go away eventually: an async input stream can return 0 in
-    // Available(), but this is not currently fully supported in the rest of
-    // gecko.
-    if (!mAsyncRemoteStream) {
-      *aLength = mLength;
-      return NS_OK;
-    }
-
     nsresult rv = EnsureAsyncRemoteStream();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     MOZ_ASSERT(mAsyncRemoteStream);
     return mAsyncRemoteStream->Available(aLength);
   }