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

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

Issue 2520973002: Fix a small error in exception handling in convertToBlob (Closed)
Patch Set: address comments. Created 4 years, 1 month 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-convertToBlob.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-convertToBlob.html b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-convertToBlob.html
new file mode 100644
index 0000000000000000000000000000000000000000..270532bd29a1254e029aaed6d0757c7bbadf5f75
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-convertToBlob.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+
+async_test(function(t) {
+ 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 ctx = offscreenCanvas.getContext('2d');
+ ctx.drawImage(image, 0, 0);
+ offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
+ assert_false("convertToBlob on a tainted OffscreenCanvas didn't throw, but should be");
+ }), t.step_func_done(function(e) {
+ assert_true(e instanceof DOMException);
+ assert_equals(e.name, "SecurityError");
+ }));
+ });
+}, "Test that call convertToBlob on a tainted OffscreenCanvas throws exception");
+
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698