mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-18 06:00:27 +00:00
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.
16 lines
509 B
HTML
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>
|