<html>
<script>
function runTest() {
    if (window.layoutTestController) {
        layoutTestController.dumpAsText();
        layoutTestController.waitUntilDone();
    }
    
    var image = new Image();
    
    image.onload = function () {
        document.getElementById('result').innerHTML = 'SUCCESS';
        
        if (window.layoutTestController) 
            layoutTestController.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>
