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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html

Issue 2323933004: Disallow users modify canvas after it transfers control to offscreen (Closed)
Patch Set: Rebase Created 4 years, 3 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/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
index e881b63c0d1e52d926029c1165e6cee65f3e4559..e541808549b9485387e0a383c4e305a6bc0debf4 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
@@ -46,6 +46,26 @@ test(function() {
assert_throws("InvalidStateError", function() { offscreenCanvas3.height = 20; });
}, "Test if resizing on offscreencanvas transferred from html canvas has thrown exceptions.");
+test(function() {
+ var canvas4 = createCanvas(10, 10);
+ var offscreenCanvas4 = canvas4.transferControlToOffscreen();
+ assert_throws("InvalidStateError", function() {
+ canvas4.getContext("2d");
+ }, "canvas.getContext() is not allowed after transferring control to offscreen.");
+ assert_throws("InvalidStateError", function() {
+ canvas4.height = 20;
+ }, "canvas resizing height is not allowed after transferring control to offscreen.");
+ assert_throws("InvalidStateError", function() {
+ canvas4.width = 20;
+ }, "canvas resizing width is not allowed after transferring control to offscreen.");
+ assert_throws("InvalidStateError", function() {
+ canvas4.toBlob(function() {});
+ }, "canvas.toBlob is not allowed after transferring control to offscreen.");
+ assert_throws("InvalidStateError", function() {
+ canvas4.toDataURL();
+ }, "canvas.toDataURL is not allowed after transferring control to offscreen.");
+}, "Test if modifying canvas after it transfers controls to offscreen throw exceptions");
+
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698