Open Bug 1415116 Opened 3 years ago Updated 3 years ago

When an <img> referencing a missing/corrupt image is reinserted into the document it should look the same

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

People

(Reporter: jwatt, Unassigned)

References

(Blocks 1 open bug)

Details

When:

https://dxr.mozilla.org/mozilla-central/source/image/test/reftest/pngsuite-corrupted/wrapper.html?x00n0g01.png

is opened via a file:// URL (as it is when run as a reftest) and the following script is run:

  let img = document.images[0];
  let parent = img.parentNode;
  let nextSibling = img.nextSibling;
  img.parentNode.removeChild(img);
  parent.insertBefore(img, nextSibling);

the effect is to remove the <img> element, then reinsert it back where it was.

This should not change the rendering of the document. It should continue to display a blank page, but instead the blue background of the image now shows.
Note that the behavior is different again when loaded via https:// - now a stock "broken image" icon appears.
Blocks: VisFuzzBugs
Summary: When an <img> referencing a corrupt image is reinserted into the document it should look the same → When an <img> referencing a missing/corrupt image is reinserted into the document it should look the same
Priority: -- → P3
With the initial loading, gCS returns "auto" for width and height of the <img>. Since image frame is eReplace, according to code in nsComputedDOMStyle [1] I think the only possible reason that it returns a non-numeric value would be that it has no frame at all.

So I guess the problem here is that in this case we don't create the frame at the initial loading, and we create one when we reinsert it.

[1] https://searchfox.org/mozilla-central/rev/fb5422ff98ba43f3732debd9d1f4dcd3b3a920f6/layout/style/nsComputedDOMStyle.cpp#5277-5290
You need to log in before you can comment on or make changes to this bug.