Bug 1355680 - set progressMax to -1 when HTTP response head is not available. r?mayhemer draft
authorShih-Chiang Chien <schien@mozilla.com>
Wed, 12 Apr 2017 14:31:57 +0800
changeset 563119 fd9ce4902789be2aaac659a17fab504aef50435a
parent 562432 198effec6e11460e977f13e9cb83050a21a64d27
child 624399 17dfa7351109fe24eb590cffb40e3b9cfbc67267
push id54215
push userbmo:schien@mozilla.com
push dateSat, 15 Apr 2017 02:56:06 +0000
reviewersmayhemer
bugs1355680
milestone55.0a1
Bug 1355680 - set progressMax to -1 when HTTP response head is not available. r?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);