chromium/third_party/blink/web_tests/fast/loader/image-decode-promise-when-gc.html

<!DOCTYPE html>
<body>
Image object may not be captured by the promise of Image.decode.</br>
If GC kicks in before promise is resolved/rejected, Image object should be kept alive.</br>
</body>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

let decode_promises = [];

for (var i = 0; i < 5; i++) {
    let image = new Image();
    image.src = '../../images/resources/apng00.png';
    decode_promises.push(image.decode());
}

Promise.all(decode_promises).then(() => {
    document.body.innerHTML += 'PASS; no crash.';

    if (window.testRunner)
        testRunner.notifyDone();
});

// Aggressive GC to trigger "GC when decode callback is pending".
if (window.GCController) {
    setInterval(() => {
        GCController.collectAll();
    }, 1);
}
</script>