summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp')
-rw-r--r--Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 2051750..6261c2c 100644
--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -84,6 +84,14 @@ using namespace HTMLNames;
static const char* const defaultFont = "10px sans-serif";
+static bool isOriginClean(CachedImage* cachedImage, SecurityOrigin* securityOrigin)
+{
+ if (!cachedImage->image()->hasSingleSecurityOrigin())
+ return false;
+ if (cachedImage->passesAccessControlCheck(securityOrigin))
+ return true;
+ return !securityOrigin->taintsCanvas(cachedImage->response().url());
+}
class CanvasStrokeStyleApplier : public StrokeStyleApplier {
public:
@@ -1525,7 +1533,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme
if (!cachedImage || !image->cachedImage()->image())
return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true);
- bool originClean = !canvas()->securityOrigin().taintsCanvas(KURL(KURL(), cachedImage->response().url())) && cachedImage->image()->hasSingleSecurityOrigin();
+ bool originClean = isOriginClean(cachedImage, canvas()->securityOrigin());
return CanvasPattern::create(cachedImage->image(), repeatX, repeatY, originClean);
}