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

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

Issue 2468263002: Handle exception when user call canvas.transferControlToOffscreen() twice (Closed)
Patch Set: 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/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..bcd0143e15a4e838b9a3637845c2de256e5e32c1 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()) {
Justin Novosad 2016/11/02 20:00:11 No need for !!
xlai (Olivia) 2016/11/02 20:07:50 Done.
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "Cannot transfer control from a canvas for more than one time.");
+ return nullptr;
+ }
+
if (!canvas.createSurfaceLayer()) {
exceptionState.throwDOMException(
V8Error,

Powered by Google App Engine
This is Rietveld 408576698