chromium/third_party/blink/web_tests/fast/dom/HTMLImageElement/image-loading-gc.html

<html>
<script>
function runTest() {
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }
    
    var image = new Image();
    
    image.onload = function () {
        document.getElementById('result').innerHTML = 'SUCCESS';
        
        if (window.testRunner) 
            testRunner.notifyDone();
    }
    
    image.src = 'resources/blue_rect.jpg'
    image = null;
    
    if (window.GCController)
        GCController.collect();
    else {
        // create lots of objects to force a garbage collection
        var i = 0;
        var s;
        while (i < 5000) {
            i = i + 1.11;
            s = s + " ";
        }
    }
}
</script>
<body onload="runTest()">
<div>This tests that an image element won't be garbage collected when it's loading, even if it doesn't have any references.
<div id="result">FAILURE</div>
</body>
</html>