ladybird/Tests/LibWeb/Text/input/HTML/png-without-IDAT-should-still-load.html
Andreas Kling 9164c9784d LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still
display it as *something*, even if the image data itself is missing or
corrupted.

This matches the behavior of other browsers, and is something that
Cloudflare Turnstile checks for.

To achieve this, we split the PNG decoder's initialization into two
steps: "everything except reading frame data" and "reading frame data".
If the latter step fails, we yield a transparent bitmap with the
geometry from the PNG's IHDR chunk.
2024-12-19 16:49:28 +01:00

16 lines
509 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(done => {
const image = document.createElement("img");
image.onload = () => {
println(`loaded, width=${image.width}, height=${image.height}`);
done();
};
image.onerror = () => {
println("error :^(");
done();
};
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAABhCAIAAAABe4UxAAAABElEQVQAAAABnSTXkQAAAABJRU5ErkJggg==";
});
</script>