Backed out changeset 582ee0d10d0c (bug 1370132) requested by kershaw
authorOana Pop Rus <opoprus@mozilla.com>
Mon, 04 Nov 2019 11:30:56 +0200
changeset 500325 18389b50e525a6a97a3f99f48b016af1cc2082f6
parent 500324 11f08e7b4bcf06e7202e15f0ec3a3be50c906b04
child 500326 3166ca8e8d9cd2fbf143b3266ab85d60630d1d7c
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1370132
milestone72.0a1
backs out582ee0d10d0c876207ef584a631e785993653e46
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
Backed out changeset 582ee0d10d0c (bug 1370132) requested by kershaw
netwerk/protocol/http/HttpBackgroundChannelChild.cpp
netwerk/protocol/http/HttpBackgroundChannelChild.h
netwerk/protocol/http/HttpBackgroundChannelParent.cpp
netwerk/protocol/http/HttpBackgroundChannelParent.h
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelChild.h
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/PHttpBackgroundChannel.ipdl
netwerk/protocol/http/PHttpChannel.ipdl
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/HttpBackgroundChannelChild.cpp
+++ b/netwerk/protocol/http/HttpBackgroundChannelChild.cpp
@@ -179,16 +179,72 @@ IPCResult HttpBackgroundChannelChild::Re
   }
 
   mChannelChild->ProcessOnStopRequest(aChannelStatus, aTiming,
                                       aResponseTrailers);
 
   return IPC_OK();
 }
 
+IPCResult HttpBackgroundChannelChild::RecvOnProgress(
+    const int64_t& aProgress, const int64_t& aProgressMax) {
+  LOG(("HttpBackgroundChannelChild::RecvOnProgress [this=%p progress=%" PRId64
+       " max=%" PRId64 "]\n",
+       this, aProgress, aProgressMax));
+  MOZ_ASSERT(OnSocketThread());
+
+  if (NS_WARN_IF(!mChannelChild)) {
+    return IPC_OK();
+  }
+
+  if (IsWaitingOnStartRequest()) {
+    LOG(("  > pending until OnStartRequest [progress=%" PRId64 " max=%" PRId64
+         "]\n",
+         aProgress, aProgressMax));
+
+    mQueuedRunnables.AppendElement(
+        NewRunnableMethod<const int64_t, const int64_t>(
+            "HttpBackgroundChannelChild::RecvOnProgress", this,
+            &HttpBackgroundChannelChild::RecvOnProgress, aProgress,
+            aProgressMax));
+
+    return IPC_OK();
+  }
+
+  mChannelChild->ProcessOnProgress(aProgress, aProgressMax);
+
+  return IPC_OK();
+}
+
+IPCResult HttpBackgroundChannelChild::RecvOnStatus(const nsresult& aStatus) {
+  LOG(("HttpBackgroundChannelChild::RecvOnStatus [this=%p status=%" PRIx32
+       "]\n",
+       this, static_cast<uint32_t>(aStatus)));
+  MOZ_ASSERT(OnSocketThread());
+
+  if (NS_WARN_IF(!mChannelChild)) {
+    return IPC_OK();
+  }
+
+  if (IsWaitingOnStartRequest()) {
+    LOG(("  > pending until OnStartRequest [status=%" PRIx32 "]\n",
+         static_cast<uint32_t>(aStatus)));
+
+    mQueuedRunnables.AppendElement(NewRunnableMethod<const nsresult>(
+        "HttpBackgroundChannelChild::RecvOnStatus", this,
+        &HttpBackgroundChannelChild::RecvOnStatus, aStatus));
+
+    return IPC_OK();
+  }
+
+  mChannelChild->ProcessOnStatus(aStatus);
+
+  return IPC_OK();
+}
+
 IPCResult HttpBackgroundChannelChild::RecvFlushedForDiversion() {
   LOG(("HttpBackgroundChannelChild::RecvFlushedForDiversion [this=%p]\n",
        this));
   MOZ_ASSERT(OnSocketThread());
 
   if (NS_WARN_IF(!mChannelChild)) {
     return IPC_OK();
   }
--- a/netwerk/protocol/http/HttpBackgroundChannelChild.h
+++ b/netwerk/protocol/http/HttpBackgroundChannelChild.h
@@ -48,16 +48,21 @@ class HttpBackgroundChannelChild final :
                                    const uint32_t& aCount,
                                    const nsCString& aData);
 
   IPCResult RecvOnStopRequest(const nsresult& aChannelStatus,
                               const ResourceTimingStruct& aTiming,
                               const TimeStamp& aLastActiveTabOptHit,
                               const nsHttpHeaderArray& aResponseTrailers);
 
+  IPCResult RecvOnProgress(const int64_t& aProgress,
+                           const int64_t& aProgressMax);
+
+  IPCResult RecvOnStatus(const nsresult& aStatus);
+
   IPCResult RecvFlushedForDiversion();
 
   IPCResult RecvDivertMessages();
 
   IPCResult RecvOnStartRequestSent();
 
   IPCResult RecvNotifyChannelClassifierProtectionDisabled(
       const uint32_t& aAcceptedReason);
--- a/netwerk/protocol/http/HttpBackgroundChannelParent.cpp
+++ b/netwerk/protocol/http/HttpBackgroundChannelParent.cpp
@@ -225,16 +225,68 @@ bool HttpBackgroundChannelParent::OnStop
 
   // See the child code for why we do this.
   TimeStamp lastActTabOpt = nsHttp::GetLastActiveTabLoadOptimizationHit();
 
   return SendOnStopRequest(aChannelStatus, aTiming, lastActTabOpt,
                            aResponseTrailers);
 }
 
+bool HttpBackgroundChannelParent::OnProgress(const int64_t& aProgress,
+                                             const int64_t& aProgressMax) {
+  LOG(("HttpBackgroundChannelParent::OnProgress [this=%p progress=%" PRId64
+       " max=%" PRId64 "]\n",
+       this, aProgress, aProgressMax));
+  AssertIsInMainProcess();
+
+  if (NS_WARN_IF(!mIPCOpened)) {
+    return false;
+  }
+
+  if (!IsOnBackgroundThread()) {
+    MutexAutoLock lock(mBgThreadMutex);
+    nsresult rv = mBackgroundThread->Dispatch(
+        NewRunnableMethod<const int64_t, const int64_t>(
+            "net::HttpBackgroundChannelParent::OnProgress", this,
+            &HttpBackgroundChannelParent::OnProgress, aProgress, aProgressMax),
+        NS_DISPATCH_NORMAL);
+
+    MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
+
+    return NS_SUCCEEDED(rv);
+  }
+
+  return SendOnProgress(aProgress, aProgressMax);
+}
+
+bool HttpBackgroundChannelParent::OnStatus(const nsresult& aStatus) {
+  LOG(("HttpBackgroundChannelParent::OnStatus [this=%p stauts=%" PRIx32 "]\n",
+       this, static_cast<uint32_t>(aStatus)));
+  AssertIsInMainProcess();
+
+  if (NS_WARN_IF(!mIPCOpened)) {
+    return false;
+  }
+
+  if (!IsOnBackgroundThread()) {
+    MutexAutoLock lock(mBgThreadMutex);
+    nsresult rv = mBackgroundThread->Dispatch(
+        NewRunnableMethod<const nsresult>(
+            "net::HttpBackgroundChannelParent::OnStatus", this,
+            &HttpBackgroundChannelParent::OnStatus, aStatus),
+        NS_DISPATCH_NORMAL);
+
+    MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
+
+    return NS_SUCCEEDED(rv);
+  }
+
+  return SendOnStatus(aStatus);
+}
+
 bool HttpBackgroundChannelParent::OnDiversion() {
   LOG(("HttpBackgroundChannelParent::OnDiversion [this=%p]\n", this));
   AssertIsInMainProcess();
 
   if (NS_WARN_IF(!mIPCOpened)) {
     return false;
   }
 
--- a/netwerk/protocol/http/HttpBackgroundChannelParent.h
+++ b/netwerk/protocol/http/HttpBackgroundChannelParent.h
@@ -48,16 +48,22 @@ class HttpBackgroundChannelParent final 
                           const uint64_t& aOffset, const uint32_t& aCount,
                           const nsCString& aData);
 
   // To send OnStopRequest message over background channel.
   bool OnStopRequest(const nsresult& aChannelStatus,
                      const ResourceTimingStruct& aTiming,
                      const nsHttpHeaderArray& aResponseTrailers);
 
+  // To send OnProgress message over background channel.
+  bool OnProgress(const int64_t& aProgress, const int64_t& aProgressMax);
+
+  // To send OnStatus message over background channel.
+  bool OnStatus(const nsresult& aStatus);
+
   // To send FlushedForDiversion and DivertMessages messages
   // over background channel.
   bool OnDiversion();
 
   // To send NotifyChannelClassifierProtectionDisabled message over background
   // channel.
   bool OnNotifyChannelClassifierProtectionDisabled(uint32_t aAcceptedReason);
 
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -927,20 +927,29 @@ void HttpChannelChild::DoOnStatus(nsIReq
   LOG(("HttpChannelChild::DoOnStatus [this=%p]\n", this));
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mCanceled) return;
 
   // cache the progress sink so we don't have to query for it each time.
   if (!mProgressSink) GetCallback(mProgressSink);
 
+  // Temporary fix for bug 1116124
+  // See 1124971 - Child removes LOAD_BACKGROUND flag from channel
+  if (status == NS_OK) return;
+
   // block status/progress after Cancel or OnStopRequest has been called,
   // or if channel has LOAD_BACKGROUND set.
   if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
       !(mLoadFlags & LOAD_BACKGROUND)) {
+    // OnStatus
+    //
+    MOZ_ASSERT(status == NS_NET_STATUS_RECEIVING_FROM ||
+               status == NS_NET_STATUS_READING);
+
     nsAutoCString host;
     mURI->GetHost(host);
     mProgressSink->OnStatus(aRequest, nullptr, status,
                             NS_ConvertUTF8toUTF16(host).get());
   }
 }
 
 void HttpChannelChild::DoOnProgress(nsIRequest* aRequest, int64_t progress,
@@ -950,17 +959,18 @@ void HttpChannelChild::DoOnProgress(nsIR
 
   if (mCanceled) return;
 
   // cache the progress sink so we don't have to query for it each time.
   if (!mProgressSink) GetCallback(mProgressSink);
 
   // block status/progress after Cancel or OnStopRequest has been called,
   // or if channel has LOAD_BACKGROUND set.
-  if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending) {
+  if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
+      !(mLoadFlags & LOAD_BACKGROUND)) {
     // OnProgress
     //
     if (progress > 0) {
       mProgressSink->OnProgress(aRequest, nullptr, progress, progressMax);
     }
   }
 }
 
@@ -1268,51 +1278,91 @@ void HttpChannelChild::DoOnStopRequest(n
 class ProgressEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
  public:
   ProgressEvent(HttpChannelChild* child, const int64_t& progress,
                 const int64_t& progressMax)
       : NeckoTargetChannelEvent<HttpChannelChild>(child),
         mProgress(progress),
         mProgressMax(progressMax) {}
 
-  void Run() override {
-    AutoEventEnqueuer ensureSerialDispatch(mChild->mEventQ);
-    mChild->DoOnProgress(mChild, mProgress, mProgressMax);
-  }
+  void Run() override { mChild->OnProgress(mProgress, mProgressMax); }
 
  private:
   int64_t mProgress, mProgressMax;
 };
 
-mozilla::ipc::IPCResult HttpChannelChild::RecvOnProgress(
-    const int64_t& aProgress, const int64_t& aProgressMax) {
-  LOG(("HttpChannelChild::RecvOnProgress [this=%p]\n", this));
+void HttpChannelChild::ProcessOnProgress(const int64_t& aProgress,
+                                         const int64_t& aProgressMax) {
+  LOG(("HttpChannelChild::ProcessOnProgress [this=%p]\n", this));
+  MOZ_ASSERT(OnSocketThread());
   mEventQ->RunOrEnqueue(new ProgressEvent(this, aProgress, aProgressMax));
-  return IPC_OK();
+}
+
+void HttpChannelChild::OnProgress(const int64_t& progress,
+                                  const int64_t& progressMax) {
+  AUTO_PROFILER_LABEL("HttpChannelChild::OnProgress", NETWORK);
+  LOG(("HttpChannelChild::OnProgress [this=%p progress=%" PRId64 "/%" PRId64
+       "]\n",
+       this, progress, progressMax));
+
+  if (mCanceled) return;
+
+  // cache the progress sink so we don't have to query for it each time.
+  if (!mProgressSink) {
+    GetCallback(mProgressSink);
+  }
+
+  AutoEventEnqueuer ensureSerialDispatch(mEventQ);
+
+  // Block socket status event after Cancel or OnStopRequest has been called.
+  if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending) {
+    if (progress > 0) {
+      mProgressSink->OnProgress(this, nullptr, progress, progressMax);
+    }
+  }
 }
 
 class StatusEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
  public:
   StatusEvent(HttpChannelChild* child, const nsresult& status)
       : NeckoTargetChannelEvent<HttpChannelChild>(child), mStatus(status) {}
 
-  void Run() override {
-    AutoEventEnqueuer ensureSerialDispatch(mChild->mEventQ);
-    mChild->DoOnStatus(mChild, mStatus);
-  }
+  void Run() override { mChild->OnStatus(mStatus); }
 
  private:
   nsresult mStatus;
 };
 
-mozilla::ipc::IPCResult HttpChannelChild::RecvOnStatus(
-    const nsresult& aStatus) {
-  LOG(("HttpChannelChild::RecvOnStatus [this=%p]\n", this));
+void HttpChannelChild::ProcessOnStatus(const nsresult& aStatus) {
+  LOG(("HttpChannelChild::ProcessOnStatus [this=%p]\n", this));
+  MOZ_ASSERT(OnSocketThread());
   mEventQ->RunOrEnqueue(new StatusEvent(this, aStatus));
-  return IPC_OK();
+}
+
+void HttpChannelChild::OnStatus(const nsresult& status) {
+  AUTO_PROFILER_LABEL("HttpChannelChild::OnStatus", NETWORK);
+  LOG(("HttpChannelChild::OnStatus [this=%p status=%" PRIx32 "]\n", this,
+       static_cast<uint32_t>(status)));
+
+  if (mCanceled) return;
+
+  // cache the progress sink so we don't have to query for it each time.
+  if (!mProgressSink) GetCallback(mProgressSink);
+
+  AutoEventEnqueuer ensureSerialDispatch(mEventQ);
+
+  // block socket status event after Cancel or OnStopRequest has been called,
+  // or if channel has LOAD_BACKGROUND set
+  if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending &&
+      !(mLoadFlags & LOAD_BACKGROUND)) {
+    nsAutoCString host;
+    mURI->GetHost(host);
+    mProgressSink->OnStatus(this, nullptr, status,
+                            NS_ConvertUTF8toUTF16(host).get());
+  }
 }
 
 class FailedAsyncOpenEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
  public:
   FailedAsyncOpenEvent(HttpChannelChild* child, const nsresult& status)
       : NeckoTargetChannelEvent<HttpChannelChild>(child), mStatus(status) {}
 
   void Run() override { mChild->FailedAsyncOpen(mStatus); }
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -208,21 +208,16 @@ class HttpChannelChild final : public PH
 
   virtual mozilla::ipc::IPCResult RecvLogMimeTypeMismatch(
       const nsCString& aMessageName, const bool& aWarning, const nsString& aURL,
       const nsString& aContentType) override;
   NS_IMETHOD LogMimeTypeMismatch(const nsACString& aMessageName, bool aWarning,
                                  const nsAString& aURL,
                                  const nsAString& aContentType) override;
 
-  mozilla::ipc::IPCResult RecvOnProgress(const int64_t& aProgress,
-                                         const int64_t& aProgressMax) override;
-
-  mozilla::ipc::IPCResult RecvOnStatus(const nsresult& aStatus) override;
-
  private:
   // We want to handle failure result of AsyncOpen, hence AsyncOpen calls the
   // Internal method
   nsresult AsyncOpenInternal(nsIStreamListener* aListener);
 
   nsresult AsyncCallImpl(void (HttpChannelChild::*funcPtr)(),
                          nsRunnableMethod<HttpChannelChild>** retval);
 
@@ -263,16 +258,18 @@ class HttpChannelChild final : public PH
   void ProcessOnTransportAndData(const nsresult& aChannelStatus,
                                  const nsresult& aStatus,
                                  const uint64_t& aOffset,
                                  const uint32_t& aCount,
                                  const nsCString& aData);
   void ProcessOnStopRequest(const nsresult& aStatusCode,
                             const ResourceTimingStruct& aTiming,
                             const nsHttpHeaderArray& aResponseTrailers);
+  void ProcessOnProgress(const int64_t& aProgress, const int64_t& aProgressMax);
+  void ProcessOnStatus(const nsresult& aStatus);
   void ProcessFlushedForDiversion();
   void ProcessDivertMessages();
   void ProcessNotifyChannelClassifierProtectionDisabled(
       uint32_t aAcceptedReason);
   void ProcessNotifyCookieAllowed();
   void ProcessNotifyCookieBlocked(uint32_t aRejectedReason);
   void ProcessNotifyClassificationFlags(uint32_t aClassificationFlags,
                                         bool aIsThirdParty);
@@ -485,16 +482,18 @@ class HttpChannelChild final : public PH
                          const uint32_t& count);
   void OnTransportAndData(const nsresult& channelStatus, const nsresult& status,
                           const uint64_t& offset, const uint32_t& count,
                           const nsCString& data);
   void OnStopRequest(const nsresult& channelStatus,
                      const ResourceTimingStruct& timing,
                      const nsHttpHeaderArray& aResponseTrailers);
   void MaybeDivertOnStop(const nsresult& aChannelStatus);
+  void OnProgress(const int64_t& progress, const int64_t& progressMax);
+  void OnStatus(const nsresult& status);
   void FailedAsyncOpen(const nsresult& status);
   void HandleAsyncAbort();
   void Redirect1Begin(const uint32_t& registrarId, const URIParams& newUri,
                       const uint32_t& newLoadFlags,
                       const uint32_t& redirectFlags,
                       const ParentLoadInfoForwarderArgs& loadInfoForwarder,
                       const nsHttpResponseHead& responseHead,
                       const nsACString& securityInfoSerialization,
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1804,63 +1804,69 @@ mozilla::ipc::IPCResult HttpChannelParen
 
 NS_IMETHODIMP
 HttpChannelParent::OnProgress(nsIRequest* aRequest, nsISupports* aContext,
                               int64_t aProgress, int64_t aProgressMax) {
   LOG(("HttpChannelParent::OnProgress [this=%p progress=%" PRId64 "max=%" PRId64
        "]\n",
        this, aProgress, aProgressMax));
   MOZ_ASSERT(NS_IsMainThread());
+  // Either IPC channel is closed or background channel
+  // is ready to send OnProgress.
+  MOZ_ASSERT(mIPCClosed || mBgParent);
 
   // If IPC channel is closed, there is nothing we can do. Just return NS_OK.
-  if (mIPCClosed) {
+  if (mIPCClosed || !mBgParent) {
     return NS_OK;
   }
 
   // If it indicates this precedes OnDataAvailable, child can derive the value
   // in ODA.
   if (mIgnoreProgress) {
     mIgnoreProgress = false;
     return NS_OK;
   }
 
   // Send OnProgress events to the child for data upload progress notifications
   // (i.e. status == NS_NET_STATUS_SENDING_TO) or if the channel has
   // LOAD_BACKGROUND set.
-  if (!SendOnProgress(aProgress, aProgressMax)) {
+  if (!mBgParent->OnProgress(aProgress, aProgressMax)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelParent::OnStatus(nsIRequest* aRequest, nsISupports* aContext,
                             nsresult aStatus, const char16_t* aStatusArg) {
   LOG(("HttpChannelParent::OnStatus [this=%p status=%" PRIx32 "]\n", this,
        static_cast<uint32_t>(aStatus)));
   MOZ_ASSERT(NS_IsMainThread());
+  // Either IPC channel is closed or background channel
+  // is ready to send OnStatus.
+  MOZ_ASSERT(mIPCClosed || mBgParent);
 
   // If IPC channel is closed, there is nothing we can do. Just return NS_OK.
-  if (mIPCClosed) {
+  if (mIPCClosed || !mBgParent) {
     return NS_OK;
   }
 
   // If this precedes OnDataAvailable, transportStatus will be derived in ODA.
   if (aStatus == NS_NET_STATUS_RECEIVING_FROM ||
       aStatus == NS_NET_STATUS_READING) {
     // The transport status and progress generated by ODA will be coalesced
     // into one IPC message. Therefore, we can ignore the next OnProgress event
     // since it is generated by ODA as well.
     mIgnoreProgress = true;
     return NS_OK;
   }
 
   // Otherwise, send to child now
-  if (!SendOnStatus(aStatus)) {
+  if (!mBgParent->OnStatus(aStatus)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsIParentChannel
--- a/netwerk/protocol/http/PHttpBackgroundChannel.ipdl
+++ b/netwerk/protocol/http/PHttpBackgroundChannel.ipdl
@@ -38,16 +38,20 @@ child:
                            uint32_t  count,
                            nsCString data);
 
   async OnStopRequest(nsresult channelStatus,
                       ResourceTimingStruct timing,
                       TimeStamp lastActiveTabOptimization,
                       nsHttpHeaderArray responseTrailers);
 
+  async OnProgress(int64_t progress, int64_t progressMax);
+
+  async OnStatus(nsresult status);
+
   // Parent has been suspended for diversion; no more events to be enqueued.
   async FlushedForDiversion();
 
   // Child should resume processing the ChannelEventQueue, i.e. diverting any
   // OnDataAvailable and OnStopRequest messages in the queue back to the parent.
   async DivertMessages();
 
   // Tell the child that channel classifier protection was disabled for this
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -185,20 +185,16 @@ child:
   async CancelDiversion();
 
   async OriginalCacheInputStreamAvailable(IPCStream? stream);
 
   async AltDataCacheInputStreamAvailable(IPCStream? stream);
 
   async OverrideReferrerInfoDuringBeginConnect(nsIReferrerInfo referrerInfo);
 
-  async OnProgress(int64_t progress, int64_t progressMax);
-
-  async OnStatus(nsresult status);
-
 both:
   // After receiving this message, the parent also calls
   // SendFinishInterceptedRedirect, and makes sure not to send any more messages
   // after that. When receiving this message, the child will call
   // Send__delete__() and complete the steps required to finish the redirect.
   async FinishInterceptedRedirect();
 
   async SetPriority(int16_t priority);
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -8663,36 +8663,21 @@ nsHttpChannel::OnTransportStatus(nsITran
 
   // block socket status event after Cancel or OnStopRequest has been called.
   if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending) {
     LOG(("sending progress%s notification [this=%p status=%" PRIx32
          " progress=%" PRId64 "/%" PRId64 "]\n",
          (mLoadFlags & LOAD_BACKGROUND) ? "" : " and status", this,
          static_cast<uint32_t>(status), progress, progressMax));
 
-    nsAutoCString host;
-    mURI->GetHost(host);
     if (!(mLoadFlags & LOAD_BACKGROUND)) {
+      nsAutoCString host;
+      mURI->GetHost(host);
       mProgressSink->OnStatus(this, nullptr, status,
                               NS_ConvertUTF8toUTF16(host).get());
-    } else {
-      nsCOMPtr<nsIParentChannel> parentChannel;
-      NS_QueryNotificationCallbacks(this, parentChannel);
-      RefPtr<HttpChannelParent> httpParent = do_QueryObject(parentChannel);
-      nsCOMPtr<nsIProgressEventSink> eventSink = do_QueryObject(httpParent);
-      // If the event sink is |HttpChannelParent|, we have to send status events
-      // to it even if LOAD_BACKGROUND is set. |HttpChannelParent| needs to be
-      // aware of whether the status is |NS_NET_STATUS_RECEIVING_FROM| or
-      // |NS_NET_STATUS_READING|.
-      // LOAD_BACKGROUND is checked again in |HttpChannelChild|, so the final
-      // consumer won't get this event.
-      if (eventSink) {
-        eventSink->OnStatus(this, nullptr, status,
-                            NS_ConvertUTF8toUTF16(host).get());
-      }
     }
 
     if (progress > 0) {
       if ((progress > progressMax) && (progressMax != -1)) {
         NS_WARNING("unexpected progress values");
       }
 
       // Try to get mProgressSink if it was nulled out during OnStatus.