Closed Bug 58880 Opened 24 years ago Closed 14 years ago

Incomplete image data gives me no image at all

Categories

(Core :: Graphics: ImageLib, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: bugzilla, Unassigned)

References

()

Details

Attachments

(2 files)

This bug is a bit hard to reproduce, but I can explain it.
If you start viewing a large picture on the webmail Mozilla start showing the
image before it's fully downloaded. But if there is some kind of timeout fx or
data loss on the net Mozilla stops and says "unable to contact..." but the
Mozilla removes the images and just shows the link instead of just showing the
partial downloaded image.
It's damn annoying...

Build 2000110120 on Win2k
->gordon
Assignee: gagan → gordon
Component: Networking → Networking: Cache
added keyword qawanted.
Keywords: qawanted
Sorry about the *very* pour explanation. Here we go again:
I excountered this problem when viewing a webpage that contained a huge image 
and banner ad. Somehow after loading 30% of the huge image the http request for 
the banner ad either timeout and refused to connect. This caused a javascript 
alert saying "unable to contact ....". This again caused the huge image to 
dropped what it loaded already and displaying the "ALT" tag for the image.
So here I'd just like the huge image to display whatever it loaded already.

Hope this is a better explanation of the problem.
Summary: Imcomplete image data gives me no image at all → Incomplete image data gives me no image at all
Pam, this doesn't sound like a cache bug; it sounds like different layout/imglib 

behavour is requested.  Any idea who should get this bug?

Assignee: gordon → pnunn
I'll take it.
I'll have to track down who, on error,
triggers a repaint in gfx.

-pn
Status: NEW → ASSIGNED
Changing component to ImgLib.
Component: Networking: Cache → ImageLib
Target Milestone: --- → Future
All pnunn bugs reassigned to Pav, who is taking over
the imglib.
Assignee: pnunn → pavlov
Status: ASSIGNED → NEW
I am unable to reproduce this, any suggestions?
images that are "broken" will get converted into their alt text, so this is
more-or-less fixed/invalid 
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
found a way to reproduce:

1) go to: http://gemal.dk/test/test.png
2) before the image has loaded 100% press the Back button
3) now instead of just showing whatever that was loaded of the test.png we clear 
the screen and show the alt text before going back.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
-> default owners
Status: REOPENED → NEW
QA Contact: tever → tpreston
I tried the suggestion from comment #10, and the image wouldn't load up on
Netscape 4.79 or my version of Mozilla. Does it have to be a particular image
type or can it just be a big one?

Are there any other pictures that could show this bug? I just went to google.com
and looked for some images under the images setting. I typed in flowers, and
with each image, it seemed to work alright. Everytime I reloaded a large image,
and pressed Stop, whatever was loaded worked okay for me. In other words, if I
pressed Stop before the loading was completed, I would see whatever had already
been loaded--30% or 50% or whatever.

A good image to use would be a big one, over 100k. Here's an example:
http://www.panopticum.com/Plugins/Photoshop/Alpha_Strip/Images/Flowers.jpg
Just a reminder that it worked for me. I don't see what/where the problem is.

I used Mozilla 0.9.6 Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.6)
Gecko/20011120

I hope that helps.
bug 150611 might be a duplicate of this, but I'm not sure about that.
*** Bug 150611 has been marked as a duplicate of this bug. ***
*** Bug 209941 has been marked as a duplicate of this bug. ***
Keywords: 4xp
*** Bug 211948 has been marked as a duplicate of this bug. ***
*** Bug 211948 has been marked as a duplicate of this bug. ***
I see this in 1.4.  To reproduce:

1. Go to http://www.noaanews.noaa.gov/nightlights/blackout081503-7hrsafter-text.jpg
2. Click the Stop button before the image finishes loading.
3. See the image get replaced by "The image
“http://www.noaanews.noaa.gov/nightlights/blackout081503-7hrsafter-text.jpg”
cannot be displayed, because it contains errors."

Note: it was awkward to select the above message since the cursor changed to the
magifying glass when over it.  When I clicked on it, the window title bar
toggled between indicating it was scaled.

Probably Useless Info: Tried it in NS4.79 also.  Partial image remained on
screen after I clicked Stop.

Interesting Aside:
http://www.noaanews.noaa.gov/nightlights/blackout081403-20hrsbefore-text.jpg
 is another nice big image to test with if you accidentally let the first finish
downloading, and an interesting contrast to the first as well.
The primary example URL gets a 404 error now, so I changed it to one I've
discovered. It's a jpg with a size of 341,099 bytes.
This bug has been around for three years now.   For all practical purposes, it's
the *ONLY* reason that I keep Opera around.   Any prognosis on a fix?
*** Bug 254584 has been marked as a duplicate of this bug. ***
*** Bug 278045 has been marked as a duplicate of this bug. ***
*** Bug 290062 has been marked as a duplicate of this bug. ***
I have a similar but slightly different issue with images not showing up as a
background image if the file is corrupt. A normal image element displays even
if the src is pointing to a corrupt file.

The top image is a truncated version of the bottom image. The img element
displays the partial image but no background while the second one displays both
the image and a repeated background.
*** Bug 326812 has been marked as a duplicate of this bug. ***
QA Contact: tpreston → imagelib
Assignee: pavlov → nobody
*migrates over from Bug 414279*

I'm not sure if this is the same bug, but when you press Stop while directly loading an image in Firefox, the half-loaded image disappears and is replaced by this message:

The image "filenamehere.jpg" cannot be displayed, because it contains errors.

It seems like this is (dumb) intended behavior, rather than any technical limitation.  After all, half-loaded images inside a web page don't disappear if you Stop the page in mid-load.  And AFAIK all other browsers, including Firefox's predecessor Classic Netscape, simply leave the half-loaded image onscreen if Stopped.

If the error message *must* be displayed, I propose putting it in a yellow Notification Bar instead of blanking out the half-loaded image (which is often still useful; More so than the message, anyway).
Searching Firefox Beta 3's source code for the relevant error, I found:

mozilla\dom\locales\en-US\chrome\layout\MediaDocument.properties
line 53: InvalidImage=The image \u201c%S\u201d cannot be displayed, because it contains errors.

Then searching for "InvalidImage", I found:

mozilla\content\html\document\src\nsImageDocument.cpp
Line 238: NS_NAMED_LITERAL_STRING(str, "InvalidImage");

Hopefully this info can help track down the bug.
I've tried looking at the relevant function here:
http://lxr.mozilla.org/mozilla/source/content/html/document/src/nsImageDocument.cpp#218

But even with the handy reference hyperlinks, I don't know enough to figure out which specific part of it is causing the problem :(  Could someone more knowledgeable give it a once-over?
I think that a rewrite is needed for this, introducing a new bit for cases when an image is being loaded, and some data has already arrived. I will call that bit HAS_IMAGE_DATA. Here is a task flow that the browser should follow when displaying images separately (that is, not embedded into pages):
1. Image download begins. No image data is received yet, but the connection to the server is still up, we are just waiting for data. HAS_IMAGE_DATA = 0. Nothing should be displayed at this point.
If the server closes connection/times out in this stage, or undecodeable data is received:
2a. Checking for HAS_IMAGE_DATA and finding it as 0, we should print out the error.
If image data begins to arrive, and image parsing/decoding begins:
2b. There is some image data available now, but not enough to display the full image. Download of the image is still in progress. In the moment when the first pixel of the image is decoded, set HAS_IMAGE_DATA to 1. The already-decoded part of the image should be displayed.
If the connection fails at this point:
3a. Checking for HAS_IMAGE_DATA and finding it as 1, either display the image based on the available data and give no error message, or print a different message under the image (maybe "This image might be displayed incorrectly, because it contains errors").
If the connection doesn't fail, and the entire image is downloaded without errors:
3b. Check for correctness/validness of the image. If it is valid (not just decodeable, but fully conforming to the spec), display the completed image as is. If it is invalid (but decodeable at least partially), possibly display the alternative error message.

The following changes are needed for this:
1. When we really begin downloading the image, and the first pixel is decoded successfully (that is, there is something to display), set HAS_IMAGE_DATA to 1.
2. Wrap the code responsible for replacing the image with the error message into an if-clause that checks for HAS_IMAGE_DATA=0.
3. Possibly write a new piece of code for printing an error message under the image when the image is broken but HAS_IMAGE_DATA=1. This would require a string change, as the current error message is inappropriate for such cases.
The real problem might be point 1, as it might need heavy libimg/libpr0n changes.
Also, this appears to be fixed for embedded images now, but separately-opened images are still affected.
Firefox 3 RC1 shows a to-scale placeholder for the image when loading is Stopped halfway through (see attachment), but still throws away the partial image data instead of leaving it viewable.  Sigh.
I'm on FF3 Beta 5 and can confirm this bug.
On these two pages:
http://www.noaanews.noaa.gov/nightlights/blackout081503-7hrsafter-text.jpg
http://www.noaanews.noaa.gov/nightlights/blackout081403-20hrsbefore-text.jpg
On them they load just fine. If I decide to stop them (press ESC) halfway through I get a similar result to the screenshot posted by #33. 

I haven't noticed this bug before, since I normally newer stop images loading, but it sure is a annoying bug when you just want half of the image (for instance) and a unnecessary behaviour of Firefox.

A bit sad that it hasn't been fixed yet considered the time since bugged.
Don't take that comment ill, don't get me wrong:
Thanks to all developers having and making FF as good as it is. 
Chill
I believe this should be fixed by bug 514033. Please re-open if you still see it.
Status: NEW → RESOLVED
Closed: 23 years ago14 years ago
Resolution: --- → FIXED
Wow; I never thought I'd see the day.  Looking forward to trying this out in 4.0.
(In reply to comment #37)
> Wow; I never thought I'd see the day.  Looking forward to trying this out in
> 4.0.

To clarify, there are two separate issues at play here.

1-bug 565773 - Canceling an image load when the image is part of an html page
2-bug 602108 - Canceling an image load when the image is viewed standalone

#1 is fixed, #2 is not. #2 might get fixed soon, but probably not.
Keywords: qawanted
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: