<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function(t) {
var context = document.createElement("canvas").getContext("2d");
context.fillStyle = "green";
context.fillRect(0,0,100,100);
function clobberGC(count) {
for (var i = 0; i < 5000; ++i)
({a: i*i*i*0.5+"str", b: i/Math.sqrt(i)});
if (count > 0)
clobberGC(count-1);
}
clobberGC(40);
assert_array_equals(context.getImageData(50, 50, 1, 1).data, [0, 128, 0, 255]);
}, 'This test ensures that Canvas and CanvasRenderingContext2D work correctly if the rendering context outlives the canvas element.');
</script>