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

Unified Diff: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp

Issue 2468263002: Handle exception when user call canvas.transferControlToOffscreen() twice (Closed)
Patch Set: fix 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
index 4c30861ef7c573338193634985326ede43e9da06..29baee4a7f7ad88d864b5d997bfea841915e91e3 100644
--- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
@@ -37,6 +37,13 @@ void HTMLCanvasElementModule::getContext(
OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreen(
HTMLCanvasElement& canvas,
ExceptionState& exceptionState) {
+ if (canvas.surfaceLayerBridge()) {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "Cannot transfer control from a canvas for more than one time.");
+ return nullptr;
+ }
+
if (!canvas.createSurfaceLayer()) {
exceptionState.throwDOMException(
V8Error,
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698