| window.testRunner.dumpAsText(); |
| var canvas = document.createElement("canvas"); |
| // Make a pattern so large that it will fail to be allocated. |
| var patternCanvas = document.createElement("canvas"); |
| patternCanvas.width = 300000; |
| patternCanvas.height = 300000; |
| var ctx = canvas.getContext("2d"); |
| pattern = ctx.createPattern(patternCanvas, "repeat"); |
| if (e.code == DOMException.INVALID_STATE_ERR) |
| document.body.appendChild(document.createTextNode("PASS: Saw exception.")); |
| // The remainder of this code doesn't really matter, since pattern is null. |
| ctx.rect(0, 0, canvas.width, canvas.height); |