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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-createPattern.html

Issue 1954533002: Implement wouldTaintOrigin and expose createPattern for OCRC2D on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OCRC2D pattern is working fine in GPU; remove Failure mark in TestExpectations Created 4 years, 7 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/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>

Powered by Google App Engine
This is Rietveld 408576698