From 5532798fcce8a1ab5ef258b51e550dc661b6f2b6 Mon Sep 17 00:00:00 2001 From: Alexandru Marc Date: Tue, 15 Oct 2024 16:56:37 +0300 Subject: [PATCH] Backed out changeset b5d9c8b42014 (bug 1917901) for causing crashes. ( Bug 1924737 ) a=backout --- image/imgRequest.cpp | 2 +- netwerk/base/nsIStreamListener.idl | 2 +- netwerk/protocol/http/HttpChannelChild.cpp | 12 +----------- netwerk/protocol/http/HttpChannelChild.h | 1 - netwerk/protocol/http/OpaqueResponseUtils.cpp | 2 +- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/image/imgRequest.cpp b/image/imgRequest.cpp index b8d72c767d4a..fb53693e689b 100644 --- a/image/imgRequest.cpp +++ b/image/imgRequest.cpp @@ -741,7 +741,7 @@ imgRequest::OnStopRequest(nsIRequest* aRequest, nsresult status) { newPartPending = mNewPartPending; } if (isMultipart && newPartPending) { - Unused << OnDataAvailable(aRequest, nullptr, 0, 0); + OnDataAvailable(aRequest, nullptr, 0, 0); } // Get this after OnDataAvailable because that might have created the image. diff --git a/netwerk/base/nsIStreamListener.idl b/netwerk/base/nsIStreamListener.idl index a3854b573041..b7bc6c212169 100644 --- a/netwerk/base/nsIStreamListener.idl +++ b/netwerk/base/nsIStreamListener.idl @@ -32,7 +32,7 @@ interface nsIStreamListener : nsIRequestObserver * An exception thrown from onDataAvailable has the side-effect of * causing the request to be canceled. */ - [must_use] void onDataAvailable(in nsIRequest aRequest, + void onDataAvailable(in nsIRequest aRequest, in nsIInputStream aInputStream, in unsigned long long aOffset, in unsigned long aCount); diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 23cba801597c..371ea9034bd1 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -810,8 +810,6 @@ void HttpChannelChild::DoOnDataAvailable(nsIRequest* aRequest, LOG(("HttpChannelChild::DoOnDataAvailable [this=%p]\n", this)); if (mCanceled) return; - mGotDataAvailable = true; - if (mListener) { nsCOMPtr listener(mListener); nsresult rv = listener->OnDataAvailable(aRequest, aStream, aOffset, aCount); @@ -3057,15 +3055,7 @@ HttpChannelChild::RetargetDeliveryTo(nsISerialEventTarget* aNewTarget) { MOZ_ASSERT(mOnDataAvailableStartTime.IsNull()); { MutexAutoLock lock(mEventTargetMutex); - // Don't assert if the target hasn't changed, or if we haven't gotten - // OnDataAvailable - MOZ_DIAGNOSTIC_ASSERT(!mODATarget || (mODATarget == aNewTarget) || - !mGotDataAvailable); - if (!mODATarget || (mODATarget == aNewTarget) || !mGotDataAvailable) { - RetargetDeliveryToImpl(aNewTarget, lock); - } else { - return NS_ERROR_FAILURE; - } + RetargetDeliveryToImpl(aNewTarget, lock); } return NS_OK; diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index 04e35995942e..ac061358ee6e 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -317,7 +317,6 @@ class HttpChannelChild final : public PHttpChannelChild, // Target thread for delivering ODA. nsCOMPtr mODATarget MOZ_GUARDED_BY(mEventTargetMutex); - Atomic mGotDataAvailable{false}; // Used to ensure atomicity of mNeckoTarget / mODATarget; Mutex mEventTargetMutex{"HttpChannelChild::EventTargetMutex"}; diff --git a/netwerk/protocol/http/OpaqueResponseUtils.cpp b/netwerk/protocol/http/OpaqueResponseUtils.cpp index a3b206de9126..e787740e46e6 100644 --- a/netwerk/protocol/http/OpaqueResponseUtils.cpp +++ b/netwerk/protocol/http/OpaqueResponseUtils.cpp @@ -662,7 +662,7 @@ void OpaqueResponseBlocker::ResolveAndProcessData( // When this line reaches, the state is either State::Allowed or // State::Blocked. The OnDataAvailable call will either call // the next listener or reject the request. - Unused << OnDataAvailable(aChannel, input, 0, mem.Size()); + OnDataAvailable(aChannel, input, 0, mem.Size()); MaybeRunOnStopRequest(aChannel); }