Index: third_party/WebKit/LayoutTests/http/tests/security/offscreen-canvas-read-blocked-by-setting.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/offscreen-canvas-read-blocked-by-setting.html b/third_party/WebKit/LayoutTests/http/tests/security/offscreen-canvas-read-blocked-by-setting.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd5be25e0335d17f9df511b03ee9cc719ac6a133 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/offscreen-canvas-read-blocked-by-setting.html |
@@ -0,0 +1,32 @@ |
+<!DOCTYPE html> |
+<title>Block reading offscreen canvas via StrictCanvasTainting setting</title> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<script> |
+if (window.testRunner) |
+ testRunner.overridePreference("WebKitDisableReadingFromCanvas", true); |
+ |
+var image = new Image(); |
+var offCanvas = new OffscreenCanvas(100, 100); |
+var context = offCanvas.getContext('2d'); |
+ |
+test(function () { |
+ assert_throws( |
+ "SecurityError", |
+ function() { |
+ var imageData = context.getImageData(0, 0, 100, 100); |
+ assert_unreached('getImageData should throw'); |
+ }); |
+}, 'getImageData'); |
+ |
+test(function () { |
+ assert_throws( |
+ "SecurityError", |
+ function() { |
+ context.drawImage(image, 0, 0, 100, 100); |
+ var imageData = context.getImageData(0, 0, 100, 100); |
+ assert_unreached('getImageData should throw'); |
+ }); |
+}, 'getImageData'); |
+ |
+</script> |