From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- image/imgRequest.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'image/imgRequest.cpp') diff --git a/image/imgRequest.cpp b/image/imgRequest.cpp index 9713d2f33e..857d1b75eb 100644 --- a/image/imgRequest.cpp +++ b/image/imgRequest.cpp @@ -711,16 +711,17 @@ imgRequest::OnStartRequest(nsIRequest* aRequest) { nsAutoCString mimeType; nsresult rv = channel->GetContentType(mimeType); if (NS_SUCCEEDED(rv) && !mimeType.EqualsLiteral(IMAGE_SVG_XML)) { + mOffMainThreadData = true; // Retarget OnDataAvailable to the DecodePool's IO thread. nsCOMPtr target = DecodePool::Singleton()->GetIOEventTarget(); rv = retargetable->RetargetDeliveryTo(target); + MOZ_LOG(gImgLog, LogLevel::Warning, + ("[this=%p] imgRequest::OnStartRequest -- " + "RetargetDeliveryTo rv %" PRIu32 "=%s\n", + this, static_cast(rv), + NS_SUCCEEDED(rv) ? "succeeded" : "failed")); } - MOZ_LOG(gImgLog, LogLevel::Warning, - ("[this=%p] imgRequest::OnStartRequest -- " - "RetargetDeliveryTo rv %" PRIu32 "=%s\n", - this, static_cast(rv), - NS_SUCCEEDED(rv) ? "succeeded" : "failed")); } return NS_OK; @@ -834,9 +835,7 @@ static nsresult sniff_mimetype_callback(nsIInputStream* in, void* closure, /** nsThreadRetargetableStreamListener methods **/ NS_IMETHODIMP imgRequest::CheckListenerChain() { - // TODO Might need more checking here. - NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread!"); - return NS_OK; + return mOffMainThreadData ? NS_OK : NS_ERROR_NO_INTERFACE; } NS_IMETHODIMP -- cgit v1.2.3