commit f0f9dd8b09757cd9c5c51573d05adfb389e169dc
parent 4472f565485ca34d1955563b0f02b509625cc2b3
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Sat, 4 Oct 2025 00:39:54 +0000
Bug 1990391. If a metadata decode fails to decode a size we should send out a FRAME_UPDATE notification so consumers get some sort of notification of the failure. r=gfx-reviewers,nical
If a consumer has an imgIContainer it's possible that they could call RequestDecodeWithResult before a metadata decode has completed, so it returns DECODE_REQUESTED, but then the metadata decode fails and we'll call RasterImage::DoError
https://searchfox.org/firefox-main/rev/ad97131360471d36dfd9cf85695dde35914843bc/image/RasterImage.cpp#1549
and we'll call NotifyProgress(NoProgress, dirtyRect) where dirtyRect is mSize, and mSize is empty, so that will send no notifications out (the rect being non-empty is the condition to send a FRAME_UPDATE notification). So the consumer will get no notification and it will still be waiting for the decode it was told was requested.
Differential Revision: https://phabricator.services.mozilla.com/D265919
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp
@@ -1547,6 +1547,11 @@ void RasterImage::DoError() {
// Invalidate to get rid of any partially-drawn image content.
auto dirtyRect = OrientedIntRect({0, 0}, mSize);
+ // Make sure to provide a non-empty rect so a FRAME_UPDATE notification goes
+ // out otherwise consumers might not get any kind of update whatsoever.
+ if (dirtyRect.IsEmpty()) {
+ dirtyRect.width = dirtyRect.height = 1;
+ }
NotifyProgress(NoProgress, dirtyRect);
MOZ_LOG(gImgLog, LogLevel::Error,