Backed out changeset 9e946e79283a (bug 1413256) in order to update the commit message
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 27 Nov 2017 14:34:39 +0100
changeset 438257 6fe5938f3d590567eefb1b811620bcde4bf80018
parent 438256 9e946e79283a2e7182699d09ec9f876b4da2f575
child 438258 ba2f695d60759bedca820d19da3b965806e5ecaf
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
bugs1413256
milestone59.0a1
backs out9e946e79283a2e7182699d09ec9f876b4da2f575
Backed out changeset 9e946e79283a (bug 1413256) in order to update the commit message
dom/media/CloneableWithRangeMediaResource.cpp
--- a/dom/media/CloneableWithRangeMediaResource.cpp
+++ b/dom/media/CloneableWithRangeMediaResource.cpp
@@ -39,20 +39,17 @@ public:
 
   nsresult
   Read(char* aBuffer, uint32_t aSize, uint32_t* aRead)
   {
     uint32_t done = 0;
     do {
       uint32_t read;
       nsresult rv = SyncRead(aBuffer + done, aSize - done, &read);
-      if (NS_SUCCEEDED(rv) && read == 0) {
-        break;
-      }
-      if (NS_WARN_IF(NS_FAILED(rv))) {
+      if (NS_WARN_IF(NS_FAILED(rv)) || read == 0) {
         return rv;
       }
       done += read;
     } while(done != aSize);
 
     *aRead = done;
     return NS_OK;
   }
@@ -77,17 +74,17 @@ private:
 
   nsresult
   SyncRead(char* aBuffer, uint32_t aSize, uint32_t* aRead)
   {
     while (1) {
       nsresult rv = mStream->Read(aBuffer, aSize, aRead);
       // All good.
       if (rv == NS_BASE_STREAM_CLOSED || NS_SUCCEEDED(rv)) {
-        return NS_OK;
+        return rv;
       }
 
       // An error.
       if (NS_FAILED(rv) && rv != NS_BASE_STREAM_WOULD_BLOCK) {
         return rv;
       }
 
       // We need to proceed async.