| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 5073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5084 { | 5084 { |
| 5085 if (!image || !image->cachedImage()) { | 5085 if (!image || !image->cachedImage()) { |
| 5086 synthesizeGLError(GL_INVALID_VALUE, functionName, "no image"); | 5086 synthesizeGLError(GL_INVALID_VALUE, functionName, "no image"); |
| 5087 return false; | 5087 return false; |
| 5088 } | 5088 } |
| 5089 const KURL& url = image->cachedImage()->response().url(); | 5089 const KURL& url = image->cachedImage()->response().url(); |
| 5090 if (url.isNull() || url.isEmpty() || !url.isValid()) { | 5090 if (url.isNull() || url.isEmpty() || !url.isValid()) { |
| 5091 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid image"); | 5091 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid image"); |
| 5092 return false; | 5092 return false; |
| 5093 } | 5093 } |
| 5094 if (wouldTaintOrigin(image)) { | 5094 if (image->wouldTaintOrigin(this)) { |
| 5095 exceptionState.throwSecurityError("The cross-origin image at " + url.eli
dedString() + " may not be loaded."); | 5095 exceptionState.throwSecurityError("The cross-origin image at " + url.eli
dedString() + " may not be loaded."); |
| 5096 return false; | 5096 return false; |
| 5097 } | 5097 } |
| 5098 return true; | 5098 return true; |
| 5099 } | 5099 } |
| 5100 | 5100 |
| 5101 bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionNa
me, HTMLCanvasElement* canvas, ExceptionState& exceptionState) | 5101 bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionNa
me, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| 5102 { | 5102 { |
| 5103 if (!canvas || !canvas->buffer()) { | 5103 if (!canvas || !canvas->buffer()) { |
| 5104 synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas"); | 5104 synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas"); |
| 5105 return false; | 5105 return false; |
| 5106 } | 5106 } |
| 5107 if (wouldTaintOrigin(canvas)) { | 5107 if (canvas->wouldTaintOrigin(this)) { |
| 5108 exceptionState.throwSecurityError("Tainted canvases may not be loaded.")
; | 5108 exceptionState.throwSecurityError("Tainted canvases may not be loaded.")
; |
| 5109 return false; | 5109 return false; |
| 5110 } | 5110 } |
| 5111 return true; | 5111 return true; |
| 5112 } | 5112 } |
| 5113 | 5113 |
| 5114 bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionNam
e, HTMLVideoElement* video, ExceptionState& exceptionState) | 5114 bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionNam
e, HTMLVideoElement* video, ExceptionState& exceptionState) |
| 5115 { | 5115 { |
| 5116 if (!video || !video->videoWidth() || !video->videoHeight()) { | 5116 if (!video || !video->videoWidth() || !video->videoHeight()) { |
| 5117 synthesizeGLError(GL_INVALID_VALUE, functionName, "no video"); | 5117 synthesizeGLError(GL_INVALID_VALUE, functionName, "no video"); |
| 5118 return false; | 5118 return false; |
| 5119 } | 5119 } |
| 5120 if (wouldTaintOrigin(video)) { | 5120 if (video->wouldTaintOrigin(this)) { |
| 5121 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); | 5121 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); |
| 5122 return false; | 5122 return false; |
| 5123 } | 5123 } |
| 5124 return true; | 5124 return true; |
| 5125 } | 5125 } |
| 5126 | 5126 |
| 5127 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) | 5127 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) |
| 5128 { | 5128 { |
| 5129 if (isContextLost() || !validateDrawMode(functionName, mode)) | 5129 if (isContextLost() || !validateDrawMode(functionName, mode)) |
| 5130 return false; | 5130 return false; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5555 if (m_textureUnits[i].m_texture2DBinding | 5555 if (m_textureUnits[i].m_texture2DBinding |
| 5556 || m_textureUnits[i].m_textureCubeMapBinding) { | 5556 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5557 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5557 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5558 return; | 5558 return; |
| 5559 } | 5559 } |
| 5560 } | 5560 } |
| 5561 m_onePlusMaxNonDefaultTextureUnit = 0; | 5561 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5562 } | 5562 } |
| 5563 | 5563 |
| 5564 } // namespace WebCore | 5564 } // namespace WebCore |
| OLD | NEW |