Index: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp |
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp |
index 8f80b02040daa0f04f29f6c585c61e1dd5c5e908..c1c2227181b529b8306a0e872619ca7e671e66ec 100644 |
--- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp |
+++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp |
@@ -13,6 +13,7 @@ |
#include "core/html/HTMLImageElement.h" |
#include "core/html/HTMLVideoElement.h" |
#include "core/html/ImageData.h" |
+#include "core/offscreencanvas/OffscreenCanvas.h" |
#include "modules/canvas2d/CanvasGradient.h" |
#include "modules/canvas2d/CanvasPattern.h" |
#include "modules/canvas2d/CanvasStyle.h" |
@@ -878,6 +879,13 @@ static inline CanvasImageSource* toImageSourceInternal(const CanvasImageSourceUn |
} |
return value.getAsImageBitmap(); |
} |
+ if (value.isOffscreenCanvas()) { |
+ if (static_cast<OffscreenCanvas*>(value.getAsOffscreenCanvas())->isNeutered()) { |
+ exceptionState.throwDOMException(InvalidStateError, String::format("The image source is detached")); |
+ return nullptr; |
+ } |
+ return value.getAsOffscreenCanvas(); |
+ } |
ASSERT_NOT_REACHED(); |
return nullptr; |
} |