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

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

Issue 2323933004: Disallow users modify canvas after it transfers control to offscreen (Closed)
Patch Set: Fix 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/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 e673f25d2fb1e24173f604a6aec06cb0bb484ecd..60f2cdbf7bcbe8c8f32ea0d7cdcc0bcf482435f9 100644
--- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
@@ -11,8 +11,14 @@
namespace blink {
-void HTMLCanvasElementModule::getContext(HTMLCanvasElement& canvas, const String& type, const CanvasContextCreationAttributes& attributes, RenderingContext& result)
+void HTMLCanvasElementModule::getContext(HTMLCanvasElement& canvas, const String& type, const CanvasContextCreationAttributes& attributes, ExceptionState& exceptionState, RenderingContext& result)
{
+ if (canvas.surfaceLayerBridge()) {
+ // The existence of canvas surfaceLayerBridge indicates that HTMLCanvasElement.transferControlToOffscreen() has been called.
+ exceptionState.throwDOMException(InvalidStateError, "Cannot get context from a canvas that has transferred its control to offscreen.");
+ return;
+ }
+
CanvasRenderingContext* context = canvas.getCanvasRenderingContext(type, attributes);
if (context) {
context->setCanvasGetContextResult(result);

Powered by Google App Engine
This is Rietveld 408576698