The generic "image could not be displayed because it contains errors" message is not always suitable, and may be downright incorrect. Thus, the decoder should be able to pass a string with the actual problem so the user can see what's wrong (i.e. feature not supported). See bug 204520 comment 75.
The error message is generated before Mozilla loads the a image file. If you load a image Url, Mozilla generates a hidden html file with a IMG SRC link and the error message as ALT text. (you can see that if you load a image URL and open the image properties) I think the current error message is ok for Joe User and that we don't need more informations.
looks like the statusArg argument of imgIDecoderObserver::OnStopDecode is meant for this: http://lxr.mozilla.org/seamonkey/source/modules/libpr0n/public/imgIDecoderObserver.idl#77 now nsImageDocument.cpp http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsImageDocument.cpp#424 must only be changed to make use of that parameter, e.g. change the alt text, and the decoders must pass the error message to onstopdecode.
Matti: the way that that HTML file is generated already has a bug filed against it (the ALT text for the image shows that same error message). While we might not need more information now, we will as soon as MNG-VLC goes in.
The real problem I see with current implementation is that we tell the user "the image has errors" even if just our processing of the image showed up errors or we don't support some feature the image is using or some subformat it is using. If the decoders knows about an error other than a corrupted/malformed image, and let us know about it, I believe we should also tell the user. The message could be changed to: "image could not be displayed. <reason>"
Whats wrong about this generic warning is that it doesn't convey wether - the image contains an error - Firefox (imagelib) doesn't support the format, Bug 44781 Support CMYK, YCCK JPEGs - Firefox (imagelib) is broken I had to download the image, check locally using irfanview to see the bug is in Mozilla, then had to search imagelib for its 167 open bugs to find Bug 44871
Indeed we should try to do a better job here.