Bug 1355680 - set progressMax to -1 when HTTP response head is not available. r=dragana,mayhemer
authorShih-Chiang Chien <schien@mozilla.com>
Wed, 12 Apr 2017 14:31:57 +0800
changeset 563305 5908d5fd0aa30ca993c699c1ee1c6b3dde0ecb2d
parent 563304 26a0e8b9f27895eb55e21f53e3f086bbf809472a
child 563306 059d96b87f6d0f65d062c4a2589454f197184c6d
push id54258
push usercpeterson@mozilla.com
push dateSun, 16 Apr 2017 05:52:14 +0000
reviewersdragana, mayhemer
bugs1355680
milestone55.0a1
Bug 1355680 - set progressMax to -1 when HTTP response head is not available. r=dragana,mayhemer MozReview-Commit-ID: 6xJsYFlCptC
netwerk/protocol/http/HttpChannelChild.cpp
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -751,17 +751,21 @@ HttpChannelChild::OnTransportAndData(con
     mUnknownDecoderEventQ.AppendElement(
       MakeUnique<MaybeDivertOnDataHttpEvent>(this, data, offset, count));
   }
 
   // Hold queue lock throughout all three calls, else we might process a later
   // necko msg in between them.
   AutoEventEnqueuer ensureSerialDispatch(mEventQ);
 
-  const int64_t progressMax = mResponseHead->ContentLength();
+  int64_t progressMax;
+  if (NS_FAILED(GetContentLength(&progressMax))) {
+    progressMax = -1;
+  }
+
   const int64_t progress = offset + count;
 
   // OnTransportAndData will be run on retargeted thread if applicable, however
   // OnStatus/OnProgress event can only be fired on main thread. We need to
   // dispatch the status/progress event handling back to main thread with the
   // appropriate event target for networking.
   if (NS_IsMainThread()) {
     DoOnStatus(this, transportStatus);