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 f22f6ef226bdf3da08e997975c64cb196fc3bf6c..7119ec0471da0fe9edd446d70cd1586f478b6534 100644 |
--- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp |
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp |
@@ -21,13 +21,22 @@ void HTMLCanvasElementModule::getContext(HTMLCanvasElement& canvas, const String |
OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreen(HTMLCanvasElement& canvas, ExceptionState& exceptionState) |
{ |
+ if (!canvas.createSurfaceLayer()) { |
+ exceptionState.throwDOMException(V8GeneralError, "Offscreen canvas creation failed due to an internal timeout."); |
+ return nullptr; |
+ } |
+ |
+ return transferControlToOffscreenInternal(canvas, exceptionState); |
+} |
+ |
+OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreenInternal(HTMLCanvasElement& canvas, ExceptionState& exceptionState) |
+{ |
if (canvas.renderingContext()) { |
exceptionState.throwDOMException(InvalidStateError, "Cannot transfer control from a canvas that has a rendering context."); |
return nullptr; |
} |
OffscreenCanvas* offscreenCanvas = OffscreenCanvas::create(canvas.width(), canvas.height()); |
offscreenCanvas->setAssociatedCanvasId(DOMNodeIds::idForNode(&canvas)); |
- canvas.createSurfaceLayerBridge(); |
return offscreenCanvas; |
} |