Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)
Patch Set: Moved from circle to rect, to avoid aliasing Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html b/third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html
new file mode 100644
index 0000000000000000000000000000000000000000..9cb00ebd1afc69d1eeb3c2c22c512d8eb2313716
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body></body>
+<script>
+
+async_test(function(t) {
+ var canvas = document.createElement("canvas");
+ canvas.width = canvas.height = 100;
+
+ var svg = document.createElementNS('http://www.w3.org/2000/svg','svg');
+ var image = document.createElementNS("http://www.w3.org/2000/svg", "image");
+ svg.appendChild(image);
+ image.setAttribute('href',
+ 'http://localhost:8000/security/resources/red200x100.png');
+
+ var ctx = canvas.getContext("2d");
+
+ image.addEventListener('load', t.step_func_done(function() {
+ ctx.drawImage(image, 0, 0);
+
+ assert_throws("SecurityError", function() {
+ var c = ctx.getImageData(0, 0, 1, 1);
+ }, "We are trying cross-origin getImageData");
+ }));
+
+ document.body.appendChild(canvas);
+ document.body.appendChild(svg);
+}, "Checks no cross-origin on tainted canvas due to SVG image");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698