Index: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp |
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp |
index 2863df303511f9dbf33204113c5724b874e8a994..fe38ed1904863ae96ab6bf8be0b35c5ec1d39e52 100644 |
--- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp |
+++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp |
@@ -6,6 +6,9 @@ |
#include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContext.h" |
#include "core/frame/ImageBitmap.h" |
+#include "core/frame/Settings.h" |
+#include "core/workers/WorkerGlobalScope.h" |
+#include "core/workers/WorkerSettings.h" |
#include "platform/graphics/ImageBuffer.h" |
#include "platform/graphics/StaticBitmapImage.h" |
#include "wtf/Assertions.h" |
@@ -18,10 +21,20 @@ OffscreenCanvasRenderingContext2D::~OffscreenCanvasRenderingContext2D() |
{ |
} |
-OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D(OffscreenCanvas* canvas, const CanvasContextCreationAttributes& attrs) |
+OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D(ScriptState* scriptState, OffscreenCanvas* canvas, const CanvasContextCreationAttributes& attrs) |
: CanvasRenderingContext(nullptr, canvas) |
, m_hasAlpha(attrs.alpha()) |
{ |
+ ExecutionContext* executionContext = scriptState->getExecutionContext(); |
+ if (executionContext->isDocument()) { |
+ if (toDocument(executionContext)->settings()->disableReadingFromCanvas()) |
+ canvas->setDisableReadingFromCanvasTrue(); |
+ return; |
+ } |
+ |
+ WorkerSettings* workerSettings = toWorkerGlobalScope(executionContext)->workerSettings(); |
+ if (workerSettings && workerSettings->disableReadingFromCanvas()) |
+ canvas->setDisableReadingFromCanvasTrue(); |
} |
DEFINE_TRACE(OffscreenCanvasRenderingContext2D) |