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.
20 lines
532 B
HTML
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>
|