Chromium Code Reviews| 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(); |