dino@apple.com | 27511052 | 2014-05-08 01:30:21 +0000 | [diff] [blame] | 1 | <body> |
| 2 | <script> |
| 3 | if (window.testRunner) |
| 4 | window.testRunner.dumpAsText(); |
| 5 | |
| 6 | var canvas = document.createElement("canvas"); |
| 7 | canvas.width = 100; |
| 8 | canvas.height = 100; |
| 9 | |
| 10 | // Make a pattern so large that it will fail to be allocated. |
| 11 | var patternCanvas = document.createElement("canvas"); |
| 12 | patternCanvas.width = 300000; |
| 13 | patternCanvas.height = 300000; |
| 14 | |
| 15 | var ctx = canvas.getContext("2d"); |
| 16 | var pattern; |
| 17 | try { |
| 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. |
| 25 | ctx.rect(0, 0, canvas.width, canvas.height); |
| 26 | ctx.fillStyle = pattern; |
| 27 | |
| 28 | ctx.fill(); |
| 29 | </script> |