blob: 0a6b1b4a370e5d6bfd5a3d6242d4b5ab3c03505e [file] [log] [blame]
dino@apple.com275110522014-05-08 01:30:21 +00001<body>
2<script>
3if (window.testRunner)
4 window.testRunner.dumpAsText();
5
6var canvas = document.createElement("canvas");
7canvas.width = 100;
8canvas.height = 100;
9
10// Make a pattern so large that it will fail to be allocated.
11var patternCanvas = document.createElement("canvas");
12patternCanvas.width = 300000;
13patternCanvas.height = 300000;
14
15var ctx = canvas.getContext("2d");
16var pattern;
17try {
18 pattern = ctx.createPattern(patternCanvas, "repeat");
19} catch (e) {
20 if (e.code == DOMException.INVALID_STATE_ERR)
21 document.body.appendChild(document.createTextNode("PASS: Saw exception."));
22}
23
24// The remainder of this code doesn't really matter, since pattern is null.
25ctx.rect(0, 0, canvas.width, canvas.height);
26ctx.fillStyle = pattern;
27
28ctx.fill();
29</script>