Backed out changeset b5d9c8b42014 (bug 1917901) for causing crashes. ( Bug 1924737 ) a=backout

This commit is contained in:
Alexandru Marc
2024-10-15 16:56:37 +03:00
parent cf9ce078fd
commit 5532798fcc
5 changed files with 4 additions and 15 deletions

View File

@@ -741,7 +741,7 @@ imgRequest::OnStopRequest(nsIRequest* aRequest, nsresult status) {
newPartPending = mNewPartPending; newPartPending = mNewPartPending;
} }
if (isMultipart && newPartPending) { 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. // Get this after OnDataAvailable because that might have created the image.

View File

@@ -32,7 +32,7 @@ interface nsIStreamListener : nsIRequestObserver
* An exception thrown from onDataAvailable has the side-effect of * An exception thrown from onDataAvailable has the side-effect of
* causing the request to be canceled. * causing the request to be canceled.
*/ */
[must_use] void onDataAvailable(in nsIRequest aRequest, void onDataAvailable(in nsIRequest aRequest,
in nsIInputStream aInputStream, in nsIInputStream aInputStream,
in unsigned long long aOffset, in unsigned long long aOffset,
in unsigned long aCount); in unsigned long aCount);

View File

@@ -810,8 +810,6 @@ void HttpChannelChild::DoOnDataAvailable(nsIRequest* aRequest,
LOG(("HttpChannelChild::DoOnDataAvailable [this=%p]\n", this)); LOG(("HttpChannelChild::DoOnDataAvailable [this=%p]\n", this));
if (mCanceled) return; if (mCanceled) return;
mGotDataAvailable = true;
if (mListener) { if (mListener) {
nsCOMPtr<nsIStreamListener> listener(mListener); nsCOMPtr<nsIStreamListener> listener(mListener);
nsresult rv = listener->OnDataAvailable(aRequest, aStream, aOffset, aCount); nsresult rv = listener->OnDataAvailable(aRequest, aStream, aOffset, aCount);
@@ -3057,15 +3055,7 @@ HttpChannelChild::RetargetDeliveryTo(nsISerialEventTarget* aNewTarget) {
MOZ_ASSERT(mOnDataAvailableStartTime.IsNull()); MOZ_ASSERT(mOnDataAvailableStartTime.IsNull());
{ {
MutexAutoLock lock(mEventTargetMutex); MutexAutoLock lock(mEventTargetMutex);
// Don't assert if the target hasn't changed, or if we haven't gotten RetargetDeliveryToImpl(aNewTarget, lock);
// OnDataAvailable
MOZ_DIAGNOSTIC_ASSERT(!mODATarget || (mODATarget == aNewTarget) ||
!mGotDataAvailable);
if (!mODATarget || (mODATarget == aNewTarget) || !mGotDataAvailable) {
RetargetDeliveryToImpl(aNewTarget, lock);
} else {
return NS_ERROR_FAILURE;
}
} }
return NS_OK; return NS_OK;

View File

@@ -317,7 +317,6 @@ class HttpChannelChild final : public PHttpChannelChild,
// Target thread for delivering ODA. // Target thread for delivering ODA.
nsCOMPtr<nsISerialEventTarget> mODATarget MOZ_GUARDED_BY(mEventTargetMutex); nsCOMPtr<nsISerialEventTarget> mODATarget MOZ_GUARDED_BY(mEventTargetMutex);
Atomic<bool, mozilla::Relaxed> mGotDataAvailable{false};
// Used to ensure atomicity of mNeckoTarget / mODATarget; // Used to ensure atomicity of mNeckoTarget / mODATarget;
Mutex mEventTargetMutex{"HttpChannelChild::EventTargetMutex"}; Mutex mEventTargetMutex{"HttpChannelChild::EventTargetMutex"};

View File

@@ -662,7 +662,7 @@ void OpaqueResponseBlocker::ResolveAndProcessData(
// When this line reaches, the state is either State::Allowed or // When this line reaches, the state is either State::Allowed or
// State::Blocked. The OnDataAvailable call will either call // State::Blocked. The OnDataAvailable call will either call
// the next listener or reject the request. // the next listener or reject the request.
Unused << OnDataAvailable(aChannel, input, 0, mem.Size<char>()); OnDataAvailable(aChannel, input, 0, mem.Size<char>());
MaybeRunOnStopRequest(aChannel); MaybeRunOnStopRequest(aChannel);
} }