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/SurfaceCache.cpp | 1 + image/decoders/nsWebPDecoder.cpp | 8 +++++++- image/imgIRequest.idl | 4 ++-- image/imgRequest.cpp | 15 +++++++-------- image/imgRequest.h | 2 ++ image/test/reftest/bmp/bmpsuite/g/reftest.list | 4 ++-- 6 files changed, 21 insertions(+), 13 deletions(-) (limited to 'image') diff --git a/image/SurfaceCache.cpp b/image/SurfaceCache.cpp index 5cfe7c086b..6f05bce6ff 100644 --- a/image/SurfaceCache.cpp +++ b/image/SurfaceCache.cpp @@ -1945,6 +1945,7 @@ void SurfaceCache::ReleaseImageOnMainThread( // Don't try to dispatch the release after shutdown, we'll just leak the // runnable. if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownFinal)) { + Unused << aImage; return; } diff --git a/image/decoders/nsWebPDecoder.cpp b/image/decoders/nsWebPDecoder.cpp index e7467f0066..f394cf3069 100644 --- a/image/decoders/nsWebPDecoder.cpp +++ b/image/decoders/nsWebPDecoder.cpp @@ -219,7 +219,13 @@ nsresult nsWebPDecoder::CreateFrame(const OrientedIntRect& aFrameRect) { PostHasTransparency(); } - WebPInitDecBuffer(&mBuffer); + if (!WebPInitDecBuffer(&mBuffer)) { + MOZ_LOG( + sWebPLog, LogLevel::Error, + ("[this=%p] nsWebPDecoder::CreateFrame -- WebPInitDecBuffer failed\n", + this)); + return NS_ERROR_FAILURE; + } switch (SurfaceFormat::OS_RGBA) { case SurfaceFormat::B8G8R8A8: diff --git a/image/imgIRequest.idl b/image/imgIRequest.idl index 721beb3a5a..9db2a0069e 100644 --- a/image/imgIRequest.idl +++ b/image/imgIRequest.idl @@ -131,12 +131,12 @@ interface imgIRequest : nsIRequest /** * true if the loading of the image required cross-origin redirects. */ - readonly attribute bool hadCrossOriginRedirects; + readonly attribute boolean hadCrossOriginRedirects; /** * Whether the request is multipart (ie, multipart/x-mixed-replace) */ - readonly attribute bool multipart; + readonly attribute boolean multipart; /** * The CORS mode that this image was loaded with (a mozilla::CORSMode). 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 diff --git a/image/imgRequest.h b/image/imgRequest.h index b948869ae8..a28227f9c0 100644 --- a/image/imgRequest.h +++ b/image/imgRequest.h @@ -283,6 +283,8 @@ class imgRequest final : public nsIThreadRetargetableStreamListener, bool mIsCrossSiteNoCORSRequest; bool mShouldReportRenderTimeForLCP; + // SVGs can't be OffMainThread for example + bool mOffMainThreadData = false; mutable mozilla::Mutex mMutex; diff --git a/image/test/reftest/bmp/bmpsuite/g/reftest.list b/image/test/reftest/bmp/bmpsuite/g/reftest.list index a11c4db480..0edeb71236 100644 --- a/image/test/reftest/bmp/bmpsuite/g/reftest.list +++ b/image/test/reftest/bmp/bmpsuite/g/reftest.list @@ -96,11 +96,11 @@ fuzzy(0-1,0-1296) == rgb16bfdef.bmp rgb16.png # bits. This is a standard 16-bit format, even supported by old versions of # Windows that don’t support any other non-default 16-bit formats. The whitest # colors should be displayed as pure white: (255,255,255), not (248,252,248)." -fuzzy(0-1,0-1296) == rgb16.bmp rgb16.png +fuzzy(1-1,1516-1516) == rgb16-565.bmp rgb16-565.png # BMP: bihsize=40, 127 x 64, bpp=16, compression=3, colors=256 # "A 16-bit image with both a BITFIELDS segment and a palette." -fuzzy(0-1,0-1516) == rgb16.bmp rgb16.png +fuzzy(1-1,1516-1516) == rgb16-565pal.bmp rgb16-565.png # BMP: bihsize=40, 127 x 64, bpp=24, compression=0, colors=0 # "A perfectly ordinary 24-bit (truecolor) image." -- cgit v1.2.3