OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script> | |
4 if (window.testRunner) { | |
5 testRunner.dumpAsText(); | |
6 testRunner.waitUntilDone(); | |
7 } | |
8 | |
9 function log(message) { | |
10 var console = document.getElementById('log'); | |
11 console.appendChild(document.createTextNode(message)); | |
12 console.appendChild(document.createElement('br')); | |
13 } | |
14 | |
15 function loaded() { | |
16 var canvas = document.getElementById('canvas'); | |
17 var ctx = canvas.getContext("2d"); | |
18 var img = document.getElementById('img'); | |
19 log('Starting...'); | |
20 | |
21 // This should taint the canvas by rendering an SVG on to it via the pattern | |
22 // route. | |
23 var p = ctx.createPattern(img, 'repeat'); | |
24 ctx.fillStyle = p; | |
25 ctx.fillRect(0, 0, 100, 100); | |
26 | |
27 try { | |
28 // This should fail as the canvas should be tainted. | |
29 var data = ctx.getImageData(0, 0, 10, 10); | |
30 log('Oh dear -- missing exception!'); | |
31 } catch (e) { | |
32 log('Exception: ' + e.name); | |
33 if (window.testRunner) | |
34 testRunner.notifyDone(); | |
35 } | |
36 } | |
37 </script> | |
38 </head> | |
39 <body> | |
40 Let's check that rendering an SVG pattern to a canvas taints it! | |
41 <p> | |
42 See https://bugs.webkit.org/show_bug.cgi?id=36838 | |
43 <div id="log"></div> | |
44 <canvas id="canvas" width="100" height="100"></canvas> | |
45 <img id="img" onload="loaded()" src="resources/empty.svg"></img> | |
46 </body> | |
OLD | NEW |