ladybird/Tests/LibWeb/Text/input/HTML/image-decode-rejects-when-source-changes-before-request.html
Andreas Kling 56da8f01d7 LibWeb: Reject stale image decode promises
When an image source changes before a queued decode() job can attach
fetch callbacks, the current request can still be unavailable and have
no shared resource request. Treat that as the spec's current request
changed case instead of asserting while adding callbacks.

Add text coverage for changing an image source immediately after
calling decode(), matching the WPT image-decode-path-changes crash.
2026-05-23 11:36:45 +02:00

20 lines
532 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
asyncTest(async done => {
const image = new Image();
image.src = "../../../Assets/120.png?image-decode-source-change";
const promise = image.decode();
image.src = "../../../Assets/120.png?image-decode-source-changed";
try {
await promise;
println("FAIL: decode resolved after source changed");
} catch (error) {
println(error.name === "EncodingError" ? "PASS" : `FAIL: ${error.name}`);
}
done();
});
</script>