Not allowing discarding of animated images creates some nasty side effects. A case study is the image attached to bug 1150089. It's an animated image that requires well over 1GB of memory to decode, so we eventually run into the SurfaceCache memory limits and run out of memory while trying to decode it. What's unfortunate is that, even if the image is in a background tab, we keep it locked and in memory, preventing other images from being decoded. Even worse: closing the tab isn't enough, because imgIContainer::RequestDiscard() (which we use to free the memory of images when you close a tab) doesn't do anything if the image is locked. To free the memory, you have to close the tab and then wait for the image to eventually expire from the image cache. Fundamentally, the problem here is that all of the image memory management code is designed around image discarding. When we can't discard an image, especially a *huge* image - which many animated images are - things just don't work smoothly anymore. In this bug, let's (try to) enable discarding of animated images.
Of course, as soon as I give up and file this bug, I find the original one. =) We'll do this work in bug 686905.