| Index: third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-createPattern.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-createPattern.html b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-createPattern.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..230f2952651fc199162bf9e99d7cf0f22177c6ef
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-createPattern.html
|
| @@ -0,0 +1,35 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="/js-test-resources/js-test.js"></script>
|
| +<script>
|
| +description("The pattern created by OffscreenCanvas2D from cross-origin image must be tainted.");
|
| +
|
| +function shouldBeTainted(pattern) {
|
| + var canvas = document.createElement("canvas");
|
| + canvas.width = 10;
|
| + canvas.height = 10;
|
| + var context = canvas.getContext("2d");
|
| + // Setting tainted pattern as fillStyle on HTMLCanvas will taint the canvas.
|
| + context.fillStyle = pattern;
|
| + context.fillRect(0, 0, canvas.width, canvas.height);
|
| + try {
|
| + var imageData = context.getImageData(0, 0, 10, 10);
|
| + testFailed("ImageBitmap is not tainted.");
|
| + } catch (e) {
|
| + testPassed("ImageBitmap is tainted. Threw error: " + e);
|
| + }
|
| +}
|
| +
|
| +var image = document.createElement('img');
|
| +image.src = 'http://localhost:8080/security/resources/abe.png';
|
| +image.addEventListener('load', function() {
|
| + var offscreenCanvas = new OffscreenCanvas(10, 10);
|
| + var offscreenContext = offscreenCanvas.getContext("2d");
|
| + var pat = offscreenContext.createPattern(image, "no-repeat");
|
| + shouldBeTainted(pat);
|
| + });
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|