| Index: Source/core/html/canvas/CanvasRenderingContext.cpp
|
| diff --git a/Source/core/html/canvas/CanvasRenderingContext.cpp b/Source/core/html/canvas/CanvasRenderingContext.cpp
|
| index b2cb6faf378fba6f750699a91da7950620099134..9e5dd350d8f463efb01aa0f5525460e584bfae0a 100644
|
| --- a/Source/core/html/canvas/CanvasRenderingContext.cpp
|
| +++ b/Source/core/html/canvas/CanvasRenderingContext.cpp
|
| @@ -26,6 +26,7 @@
|
| #include "config.h"
|
| #include "core/html/canvas/CanvasRenderingContext.h"
|
|
|
| +#include "core/html/canvas/CanvasImageSource.h"
|
| #include "platform/weborigin/SecurityOrigin.h"
|
|
|
| namespace WebCore {
|
| @@ -36,4 +37,27 @@ CanvasRenderingContext::CanvasRenderingContext(HTMLCanvasElement* canvas)
|
|
|
| }
|
|
|
| +bool CanvasRenderingContext::wouldTaintOrigin(CanvasImageSource* imageSource)
|
| +{
|
| + const KURL& sourceURL = imageSource->sourceURL();
|
| + bool hasURL = (sourceURL.isValid() && !sourceURL.isAboutBlankURL());
|
| +
|
| + if (hasURL) {
|
| + if (sourceURL.protocolIsData() || m_cleanURLs.contains(sourceURL.string()))
|
| + return false;
|
| + if (m_dirtyURLs.contains(sourceURL.string()))
|
| + return true;
|
| + }
|
| +
|
| + bool taintOrigin = imageSource->wouldTaintOrigin(canvas()->securityOrigin());
|
| +
|
| + if (hasURL) {
|
| + if (taintOrigin)
|
| + m_dirtyURLs.add(sourceURL.string());
|
| + else
|
| + m_cleanURLs.add(sourceURL.string());
|
| + }
|
| + return taintOrigin;
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|