A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
[WebKit-https.git] / LayoutTests / svg / as-image / svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
1 <!DOCTYPE html>
2 <head>
3     <script src="../../resources/js-test-pre.js"></script>
4 </head>
5 <body>
6     <canvas></canvas>
7     <script type="text/javascript">
8         if (window.testRunner)
9             testRunner.dumpAsText();
10
11         jsTestIsAsync = true;
12         description("Canvas should not be tainted if a data url image with a &lt;foreignObject&gt; is drawn into the canvas.");
13
14         var data = "data:image/svg+xml;charset=utf-8,"
15                 + '<svg xmlns="http://www.w3.org/2000/svg">'
16                 + '    <foreignObject width="100%" height="100%">'
17                 + '        <div xmlns="http://www.w3.org/1999/xhtml" style="width:100px; height: 100px; background-color: green;"></div>'
18                 + '    </foreignObject>'
19                 + '</svg>';
20
21         var svg = new Image();
22         svg.onload = function() {
23             var canvas = document.querySelector('canvas');
24             window.ctx = canvas.getContext('2d');
25             ctx.drawImage(svg, 0, 0);
26             shouldNotThrow("window.ctx.getImageData(0, 0, 1, 1)");
27             finishJSTest();
28         }
29         svg.src = data;
30     </script>
31     <script src="../../resources/js-test-post.js"></script>
32 </body>
33 </html>