While decoding GIFs with no loop count, we treat them as "loop once". But, due to an oversight, when we reach the end and still haven't seen the loop count, we think the loop count is the internally-used value "-2" ("not seen"), which the animation code in BitmapImage.cpp interprets as "don't animate". This means that, after the GIF animates, if script then changes another <img>'s "src" to point at it, it will display the first frame and stop instead of looping once.
Created attachment 69987 [details] patch v1 Simple fix. I haven't had time to create a good layout test. Testing this will be a little tricky; I'll need to create a custom 2-frame GIF with no loop count and write a pixel test based on based on the "index.html" reduction in http://crbug.com/56077 .
Comment on attachment 69987 [details] patch v1 This really should have a test. I don't think the bug fix is so critical that it should land untested.
Created attachment 72361 [details] patch with test Same as the above patch, but this time with a test.
Comment on attachment 72361 [details] patch with test Yay tests.
Comment on attachment 72361 [details] patch with test Clearing flags on attachment: 72361 Committed r71001: <http://trac.webkit.org/changeset/71001>
All reviewed patches have been landed. Closing bug.