Open Bug 1805432 Opened 3 years ago Updated 2 years ago

Setting img src attribute using js resets gif to first frame

Categories

(Core :: Graphics: ImageLib, defect)

Firefox 107
defect

Tracking

()

UNCONFIRMED

People

(Reporter: gomes.cristiano, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0

Steps to reproduce:

Set img src parameter using javascript.

Actual results:

The created gif and all preceeding gifs with the same URL get reset to the first frame.

The weird thing is that the gif doesn't get reset when using srcset

I created a small example site:
https://gloomyfrown.github.io/imgtest/

Clicking the "Create img element using src" repeatedly resets the gif, while
"Create img element using srcset" doesn't.

Expected results:

The created gif should start at the same frame as the proceeding gifs with the same URL.

Component: Untriaged → Graphics: ImageLib
Product: Firefox → Core
See Also: → 629119
See Also: → 284511

We have code to reset the animation in nsImageLoadingContent, so it doesn't seem like an accident that we are doing this. I'll have to check the history to see why we are doing this. Safari and Chrome do not reset the animation on src setting.

Severity: -- → S3

There seem to be some more inconsistencies, if i create an img tag and set the src attribute first and the srcset attribute after, all gifs reset and show the image of the src attribute. If i do it the other way around, set srcset first and then src, the gifs don't reset but still show the src image.

Should the order of setting the src and srcset attributes matter in this case?

Example:
https://gloomyfrown.github.io/attribute-order-test/

May I ask what is the use case that caused you to notice this? Having an idea of where this is important might be helpful.

This issue occurs when the same animated emotes get repeatedly posted in a twitch.tv chat, the gifs keep reseting.
These emotes are nothing special, just an img element with a src and srcset attribute.

Firefox example
Chrome example

The way chrome handles it seems more reasonable.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: