test_large_imageData.html (1748B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1716622 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for large ImageData</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1716622">Mozilla Bug 1716622</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 17 </div> 18 <pre id="test"> 19 </pre> 20 <canvas id="canvas" width="800" height="800"></canvas> 21 <script type="application/javascript"> 22 SimpleTest.waitForExplicitFinish(); 23 24 function go() { 25 var ctx = document.getElementById("canvas").getContext("2d"); 26 27 var ex = null; 28 try { 29 ctx.createImageData(23175, 23175); 30 } catch (e) { 31 ex = e; 32 } 33 ok(ex.toString().includes("Invalid width or height"), 34 "Expected createImageData exception"); 35 36 ex = null; 37 try { 38 ctx.createImageData(33000, 33000); 39 } catch (e) { 40 ex = e; 41 } 42 ok(ex.toString().includes("Invalid width or height"), 43 "Expected createImageData exception"); 44 45 ex = null; 46 try { 47 ctx.getImageData(0, 0, 23175, 23175); 48 } catch (e) { 49 ex = e; 50 } 51 ok(ex.toString().includes("negative or greater than the allowed amount"), 52 "Expected getImageData exception"); 53 54 ex = null; 55 try { 56 new ImageData(23175, 23175); 57 } catch (e) { 58 ex = e; 59 } 60 ok(ex.toString().includes("negative or greater than the allowed amount"), 61 "Expected ImageData constructor exception"); 62 63 SimpleTest.finish(); 64 } 65 go(); 66 </script> 67 </body> 68 </html>