Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 297293004: Adding cache for security origin validations in 2D/WebGL canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reorganized code Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
index 44257b1cd9224d4839c5782592c8ff55309c4cb9..3304a1793ecf0fb248830bf931eff1ff01deb763 100644
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
@@ -5221,7 +5221,8 @@ bool WebGLRenderingContextBase::validateHTMLImageElement(const char* functionNam
synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid image");
return false;
}
- if (image->wouldTaintOrigin(canvas()->securityOrigin())) {
+
+ if (wouldTaintOrigin(image)) {
exceptionState.throwSecurityError("The cross-origin image at " + url.elidedString() + " may not be loaded.");
return false;
}
@@ -5234,7 +5235,7 @@ bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionNa
synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas");
return false;
}
- if (canvas->wouldTaintOrigin(this->canvas()->securityOrigin())) {
+ if (wouldTaintOrigin(canvas)) {
exceptionState.throwSecurityError("Tainted canvases may not be loaded.");
return false;
}
@@ -5247,7 +5248,8 @@ bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionNam
synthesizeGLError(GL_INVALID_VALUE, functionName, "no video");
return false;
}
- if (video->wouldTaintOrigin(canvas()->securityOrigin())) {
+
+ if (wouldTaintOrigin(video)) {
exceptionState.throwSecurityError("The video element contains cross-origin data, and may not be loaded.");
return false;
}
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698