| 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 5076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5087 { | 5087 { |
| 5088 if (!image || !image->cachedImage()) { | 5088 if (!image || !image->cachedImage()) { |
| 5089 synthesizeGLError(GL_INVALID_VALUE, functionName, "no image"); | 5089 synthesizeGLError(GL_INVALID_VALUE, functionName, "no image"); |
| 5090 return false; | 5090 return false; |
| 5091 } | 5091 } |
| 5092 const KURL& url = image->cachedImage()->response().url(); | 5092 const KURL& url = image->cachedImage()->response().url(); |
| 5093 if (url.isNull() || url.isEmpty() || !url.isValid()) { | 5093 if (url.isNull() || url.isEmpty() || !url.isValid()) { |
| 5094 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid image"); | 5094 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid image"); |
| 5095 return false; | 5095 return false; |
| 5096 } | 5096 } |
| 5097 if (wouldTaintOrigin(image)) { | 5097 if (image->wouldTaintOrigin(canvas()->securityOrigin())) { |
| 5098 exceptionState.throwSecurityError("The cross-origin image at " + url.eli
dedString() + " may not be loaded."); | 5098 exceptionState.throwSecurityError("The cross-origin image at " + url.eli
dedString() + " may not be loaded."); |
| 5099 return false; | 5099 return false; |
| 5100 } | 5100 } |
| 5101 return true; | 5101 return true; |
| 5102 } | 5102 } |
| 5103 | 5103 |
| 5104 bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionNa
me, HTMLCanvasElement* canvas, ExceptionState& exceptionState) | 5104 bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionNa
me, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| 5105 { | 5105 { |
| 5106 if (!canvas || !canvas->buffer()) { | 5106 if (!canvas || !canvas->buffer()) { |
| 5107 synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas"); | 5107 synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas"); |
| 5108 return false; | 5108 return false; |
| 5109 } | 5109 } |
| 5110 if (wouldTaintOrigin(canvas)) { | 5110 if (canvas->wouldTaintOrigin(this->canvas()->securityOrigin())) { |
| 5111 exceptionState.throwSecurityError("Tainted canvases may not be loaded.")
; | 5111 exceptionState.throwSecurityError("Tainted canvases may not be loaded.")
; |
| 5112 return false; | 5112 return false; |
| 5113 } | 5113 } |
| 5114 return true; | 5114 return true; |
| 5115 } | 5115 } |
| 5116 | 5116 |
| 5117 bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionNam
e, HTMLVideoElement* video, ExceptionState& exceptionState) | 5117 bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionNam
e, HTMLVideoElement* video, ExceptionState& exceptionState) |
| 5118 { | 5118 { |
| 5119 if (!video || !video->videoWidth() || !video->videoHeight()) { | 5119 if (!video || !video->videoWidth() || !video->videoHeight()) { |
| 5120 synthesizeGLError(GL_INVALID_VALUE, functionName, "no video"); | 5120 synthesizeGLError(GL_INVALID_VALUE, functionName, "no video"); |
| 5121 return false; | 5121 return false; |
| 5122 } | 5122 } |
| 5123 if (wouldTaintOrigin(video)) { | 5123 if (video->wouldTaintOrigin(canvas()->securityOrigin())) { |
| 5124 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); | 5124 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); |
| 5125 return false; | 5125 return false; |
| 5126 } | 5126 } |
| 5127 return true; | 5127 return true; |
| 5128 } | 5128 } |
| 5129 | 5129 |
| 5130 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) | 5130 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) |
| 5131 { | 5131 { |
| 5132 if (isContextLost() || !validateDrawMode(functionName, mode)) | 5132 if (isContextLost() || !validateDrawMode(functionName, mode)) |
| 5133 return false; | 5133 return false; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5558 if (m_textureUnits[i].m_texture2DBinding | 5558 if (m_textureUnits[i].m_texture2DBinding |
| 5559 || m_textureUnits[i].m_textureCubeMapBinding) { | 5559 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5560 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5560 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5561 return; | 5561 return; |
| 5562 } | 5562 } |
| 5563 } | 5563 } |
| 5564 m_onePlusMaxNonDefaultTextureUnit = 0; | 5564 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5565 } | 5565 } |
| 5566 | 5566 |
| 5567 } // namespace WebCore | 5567 } // namespace WebCore |
| OLD | NEW |