The previous patch wasn't good enough because it only prevented dispatching more setTimeouts after finish. It did nothing to stop already dispatched setTimeouts from calling ok(true,...).
We can have multiple setTimeouts from multiple frame update notifications in flight at the same time. If one of them reaches the finishing conditions the rest will too. So just guard calling finish with a global bool.
We can have multiple setTimeouts from multiple frame update notifications in flight at the same time. If one of them reaches the finishing conditions the rest will too. So just guard calling finish with a global bool.
We draw nothing when the composited frame is invalid, so when we mark it valid we should invalidate. Usually the action that causes the composited frame to be valid will invalidate (ie RequestRefresh).
We draw nothing until the composited frame is valid.
The IsFinished call lower down only considers one frame of the animation, so doesn't do what we want.
Image notifications sent from nsImageLoadingContent happen under a scriptblocker. drawWindow flushes will paint observers, which can dispatch events. Events dispatched while scripts are blocked assert.
If we were doing a first frame only decode we wouldn't fill in this value. The spec says this chunk must come before any image data so it should always be available at the end of any full decode (whether it be truly full or first frame only).
Supports creating a windowless browser on Linux without an X server. Most of the
changes are just adding branches to avoid calls in to GTK which calls
into X. Some of the bigger additions were adding a separate headless widget
which implements just enough to render a page. A headless look and
feel were also added since there are many calls into GTK in the platform
specific one.
Since we drop XP support, it is unnecessary to use SHGetStockIconInfo via LoadLibrary.
MozReview-Commit-ID: 4lvhVObHv5U
--HG--
extra : rebase_source : 04ac6f97e6a3eff7c52e11e3868da0939efd6ffe
The test does nothing if the animated images discarding pref isn't enabled.
--HG--
rename : image/test/crashtests/1249576-1.png => image/test/mochitest/infinite-apng.png
If the SurfaceCache discards our frames on another thread, the runnable that notifies us of that discard could race with a decode complete notification. So we can't rely on any ordering of SetDiscarded and NotifyDecodeComplete. Thus we must derive our state purely from the SurfaceCache (and mAnimationFinished from RasterImage).
We also update the image state in RequestRefresh (the main place where we use the state that is updated).
The other main place we use the state is GetCompositedFrame, but we don't update the state there. It should be fine because the only time this might lag behind reality is if the frames are discarded, and it should be fine to continue drawing the composited frame until the discard notification arrives.
The way that we tell that an animated image has all of its frames complete in the surface cache is less than ideal.
The SurfaceCache can discard on any thread at any time. So we could be in the middle of advancing frames of a fully decoded animated image and then the frames could disappear out from under us.
Making the code deal with that kind of a situation would make the logic very complicated. So instead just look up the frames once and pass them around, that way they never change during while we are advancing the frame.
Do this to allow GetTimeoutForFrame to be called for frames that haven't been decoded yet. Propagate a Maybe result where it makes sense. The remaining callers just bail if they get no return value. Many of them can just assert that they get a return value because they already got the same frame, so the timeout has to be available.
The logic is a little tricky because we have "Forever" timeouts that were sort of treated as error cases.