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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1573173002: Make WebGL's texImage2D and texSubImage2D handle cross-origin ImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 324450bc7340d13d7a713c69f3de9b8adb00b591..44d1037077b65c3b658ec06a5f27c41c5e38f761 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -4506,13 +4506,17 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int
}
void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint internalformat,
- GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap)
+ GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, ExceptionState& exceptionState)
{
ASSERT(bitmap->bitmapImage());
if (bitmap->isNeutered()) {
synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "The source data has been neutered.");
return;
}
+ if (!bitmap->originClean()) {
Justin Novosad 2016/01/11 17:52:13 Could you factor this out into a helper, like the
+ exceptionState.throwSecurityError("The ImageBitmap contains cross-origin data, and may not be loaded.");
+ return;
+ }
if (isContextLost() || !validateTexFunc("texImage2D", TexImage, SourceImageBitmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0))
return;
StaticBitmapImage* imageForRender = bitmap->bitmapImage();
@@ -4732,13 +4736,17 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap)
+ GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, ExceptionState& exceptionState)
{
ASSERT(bitmap->bitmapImage());
if (bitmap->isNeutered()) {
synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "The source data has been neutered.");
return;
}
+ if (!bitmap->originClean()) {
Justin Novosad 2016/01/11 17:52:13 Ditto. -> use helper to avoid duplicated code (and
+ exceptionState.throwSecurityError("The ImageBitmap contains cross-origin data, and may not be loaded.");
+ return;
+ }
if (isContextLost() || !validateTexFunc("texSubImage2D", TexSubImage, SourceImageBitmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0))
return;
StaticBitmapImage* imageForRender = bitmap->bitmapImage();

Powered by Google App Engine
This is Rietveld 408576698