I think part of the issue is that, when you return a fallback icon (the B icon in this case), you serve it with an HTTP 404 status.
In Firefox (and possibly other browsers), the browser will not attempt to render images returned with a 404 status. Changing it to return a 200 status should work.
In Firefox (and possibly other browsers), the browser will not attempt to render images returned with a 404 status. Changing it to return a 200 status should work.