Bug 1539208 - Propagate the result of mListener in InterceptedHttpChannel::OnStartRequest and ::OnStopRequest r=perry,ttung,kershaw
authorEden Chuang <echuang@mozilla.com>
Wed, 24 Apr 2019 08:49:36 +0000
changeset 470631 c94a6d04f305dee0d8f49cea86ec7d410038ce23
parent 470630 473cfd3b34305a44dccb75fc24b1bf15ab772d20
child 470632 4daded6050788477db51b3ef552a839b545b406b
push id83875
push useraiakab@mozilla.com
push dateWed, 24 Apr 2019 10:32:45 +0000
treeherderautoland@c94a6d04f305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersperry, ttung, kershaw
bugs1539208
milestone68.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 1539208 - Propagate the result of mListener in InterceptedHttpChannel::OnStartRequest and ::OnStopRequest r=perry,ttung,kershaw 1. Propagate the mListener's result in InterceptedHttpChannel::OnStartRequest() and ::OnStopRequest(). 2. remove unnecessary assertion in FetchDriver::OnStartRequest(). Differential Revision: https://phabricator.services.mozilla.com/D28477
dom/fetch/FetchDriver.cpp
netwerk/protocol/http/InterceptedHttpChannel.cpp
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -1041,17 +1041,19 @@ FetchDriver::OnStartRequest(nsIRequest* 
   // interception case.
   mRequest->MaybeIncreaseResponseTainting(loadInfo->GetTainting());
 
   // Resolves fetch() promise which may trigger code running in a worker.  Make
   // sure the Response is fully initialized before calling this.
   mResponse = BeginAndGetFilteredResponse(response, foundOpaqueRedirect);
   if (NS_WARN_IF(!mResponse)) {
     // Fail to generate a paddingInfo for opaque response.
-    MOZ_DIAGNOSTIC_ASSERT(mResponse->Type() == ResponseType::Opaque);
+    MOZ_DIAGNOSTIC_ASSERT(mRequest->GetResponseTainting() ==
+                              LoadTainting::Opaque &&
+                          !foundOpaqueRedirect);
     FailWithNetworkError(NS_ERROR_UNEXPECTED);
     return NS_ERROR_UNEXPECTED;
   }
 
   // From "Main Fetch" step 19: SRI-part1.
   if (ShouldCheckSRI(mRequest, mResponse) && mSRIMetadata.IsEmpty()) {
     nsIConsoleReportCollector* reporter = nullptr;
     if (mObserver) {
--- a/netwerk/protocol/http/InterceptedHttpChannel.cpp
+++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp
@@ -1015,17 +1015,17 @@ InterceptedHttpChannel::OnStartRequest(n
     GetCallback(mProgressSink);
   }
 
   if (mPump && mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) {
     mPump->PeekStream(CallTypeSniffers, static_cast<nsIChannel*>(this));
   }
 
   if (mListener) {
-    mListener->OnStartRequest(this);
+    return mListener->OnStartRequest(this);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 InterceptedHttpChannel::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -1041,25 +1041,26 @@ InterceptedHttpChannel::OnStopRequest(ns
   // to the ReleaseListeners() call below.
   MaybeCallStatusAndProgress();
 
   mIsPending = false;
 
   // Register entry to the PerformanceStorage resource timing
   MaybeReportTimingData();
 
+  nsresult rv = NS_OK;
   if (mListener) {
-    mListener->OnStopRequest(this, mStatus);
+    rv = mListener->OnStopRequest(this, mStatus);
   }
 
   gHttpHandler->OnStopRequest(this);
 
   ReleaseListeners();
 
-  return NS_OK;
+  return rv;
 }
 
 NS_IMETHODIMP
 InterceptedHttpChannel::OnDataAvailable(nsIRequest* aRequest,
                                         nsIInputStream* aInputStream,
                                         uint64_t aOffset, uint32_t aCount) {
   // Any thread if the channel has been retargeted.