1<html> 2<head> 3<script src="../LayoutTests/fast/js/resources/js-test-pre.js"></script> 4</head> 5<body> 6<script> 7description("Test to verify that serial allocation and dereferencing of large canvases will succeed"); 8// This is a manual test because it runs too slow as a LayoutTest, especially for GPU tests with mesa. 9 10// 32 canvases of 8k x 8k will consume 8GB of RAM. 11// Garbage collection should kick-in to prevent OOM failures. 12for (var i = 0; i < 32; i++) { 13 var canvas = document.createElement('canvas'); 14 canvas.width = 8192; 15 canvas.height = 8192; 16 // Draw to trigger lazy backing store allocation 17 var ctx = canvas.getContext('2d'); 18 ctx.fillStyle = '#0f0'; 19 ctx.fillRect(0, 0, 1, 1); 20 // Verify that allocation succeeded by verifying that draw succeeded 21 var imageData = ctx.getImageData(0, 0, 1, 1); 22 var imgdata = imageData.data; 23 shouldBe("imgdata[0]", "0"); 24 shouldBe("imgdata[1]", "255"); 25 shouldBe("imgdata[2]", "0"); 26} 27</script> 28<script src="../LayoutTests/fast/js/resources/js-test-post.js"></script> 29</body> 30</html> 31