Changeset 57324 in webkit
- Timestamp:
- Apr 9, 2010 3:37:19 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57322 r57324 1 2010-04-09 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Darin Fisher. 4 5 Passing null WebGLObjects should synthesize INVALID_VALUE error 6 https://bugs.webkit.org/show_bug.cgi?id=37047 7 8 * fast/canvas/webgl/error-reporting-expected.txt: Change a few errors from INVALID_OPERATION to INVALID_VALUE. 9 * fast/canvas/webgl/getActiveTest-expected.txt: Ditto. 10 * fast/canvas/webgl/null-object-behaviour-expected.txt: Ditto. 11 * fast/canvas/webgl/script-tests/error-reporting.js: Ditto. 12 1 13 2010-04-09 Zhenyao Mo <zmo@google.com> 2 14 -
trunk/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt
r52164 r57324 6 6 Testing getActiveAttrib 7 7 PASS context.getActiveAttrib(null, 2) is null 8 PASS context.getError() is context.INVALID_ OPERATION8 PASS context.getError() is context.INVALID_VALUE 9 9 PASS context.getError() is context.NO_ERROR 10 10 PASS context.getActiveAttrib(program, 2) is null … … 13 13 Testing getActiveUniform 14 14 PASS context.getActiveUniform(null, 0) is null 15 PASS context.getError() is context.INVALID_ OPERATION15 PASS context.getError() is context.INVALID_VALUE 16 16 PASS context.getError() is context.NO_ERROR 17 17 PASS context.getActiveUniform(program, 50) is null -
trunk/LayoutTests/fast/canvas/webgl/getActiveTest-expected.txt
r51970 r57324 11 11 PASS context.getActiveUniform(program, -1) threw exception GL error 1281 in getActiveUniform. 12 12 PASS context.getError() is 0 13 PASS context.getActiveUniform(null, 0) threw exception GL error 128 2in getActiveUniform.13 PASS context.getActiveUniform(null, 0) threw exception GL error 1281 in getActiveUniform. 14 14 PASS context.getError() is 0 15 15 PASS context.getActiveAttrib(program, 0).name is 'a_normal' … … 23 23 PASS context.getActiveAttrib(program, -1) threw exception GL error 1281 in getActiveAttrib. 24 24 PASS context.getError() is 0 25 PASS context.getActiveAttrib(null, 0) threw exception GL error 128 2in getActiveAttrib.25 PASS context.getActiveAttrib(null, 0) threw exception GL error 1281 in getActiveAttrib. 26 26 PASS context.getError() is 0 27 27 PASS context2.getError() is 0 -
trunk/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
r52164 r57324 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 PASS context.compileShader() threw exception GL error 128 2in compileShader.6 PASS context.linkProgram() threw exception GL error 128 2in linkProgram.5 PASS context.compileShader() threw exception GL error 1281 in compileShader. 6 PASS context.linkProgram() threw exception GL error 1281 in linkProgram. 7 7 PASS context.attachShader() threw exception GL error 1281 in attachShader. 8 8 PASS context.attachShader(program, undefined) threw exception GL error 1281 in attachShader. 9 9 PASS context.attachShader(undefined, shader) threw exception GL error 1281 in attachShader. 10 PASS context.detachShader(program, undefined) threw exception GL error 128 2in detachShader.11 PASS context.detachShader(undefined, shader) threw exception GL error 128 2in detachShader.12 PASS context.shaderSource() threw exception GL error 128 2in shaderSource.13 PASS context.shaderSource(undefined, 'foo') threw exception GL error 128 2in shaderSource.14 PASS context.bindAttribLocation(undefined, 0, 'foo') threw exception GL error 128 2in bindAttribLocation.10 PASS context.detachShader(program, undefined) threw exception GL error 1281 in detachShader. 11 PASS context.detachShader(undefined, shader) threw exception GL error 1281 in detachShader. 12 PASS context.shaderSource() threw exception GL error 1281 in shaderSource. 13 PASS context.shaderSource(undefined, 'foo') threw exception GL error 1281 in shaderSource. 14 PASS context.bindAttribLocation(undefined, 0, 'foo') threw exception GL error 1281 in bindAttribLocation. 15 15 PASS context.bindBuffer(context.ARRAY_BUFFER, 0) is undefined. 16 16 PASS context.bindFramebuffer(context.FRAMEBUFFER, 0) is undefined. … … 19 19 PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) threw exception GL error 1282 in framebufferRenderbuffer. 20 20 PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) threw exception GL error 1282 in framebufferTexture2D. 21 PASS context.getProgramParameter(undefined, 0) threw exception GL error 128 2in getProgramParameter.22 PASS context.getProgramInfoLog(undefined, 0) threw exception GL error 128 2in getProgramInfoLog.23 PASS context.getShaderParameter(undefined, 0) threw exception GL error 128 2in getShaderParameter.24 PASS context.getShaderInfoLog(undefined, 0) threw exception GL error 128 2in getShaderInfoLog.25 PASS context.getShaderSource(undefined) threw exception GL error 128 2in getShaderSource.26 PASS context.getUniform(undefined, 0) threw exception GL error 128 2in getUniform.27 PASS context.getUniformLocation(undefined, 'foo') threw exception GL error 128 2in getUniformLocation.21 PASS context.getProgramParameter(undefined, 0) threw exception GL error 1281 in getProgramParameter. 22 PASS context.getProgramInfoLog(undefined, 0) threw exception GL error 1281 in getProgramInfoLog. 23 PASS context.getShaderParameter(undefined, 0) threw exception GL error 1281 in getShaderParameter. 24 PASS context.getShaderInfoLog(undefined, 0) threw exception GL error 1281 in getShaderInfoLog. 25 PASS context.getShaderSource(undefined) threw exception GL error 1281 in getShaderSource. 26 PASS context.getUniform(undefined, 0) threw exception GL error 1281 in getUniform. 27 PASS context.getUniformLocation(undefined, 'foo') threw exception GL error 1281 in getUniformLocation. 28 28 PASS successfullyParsed is true 29 29 -
trunk/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js
r52164 r57324 16 16 // Synthetic OpenGL error 17 17 shouldBeNull("context.getActiveAttrib(null, 2)"); 18 shouldBe("context.getError()", "context.INVALID_ OPERATION");18 shouldBe("context.getError()", "context.INVALID_VALUE"); 19 19 // Error state should be clear by this point 20 20 shouldBe("context.getError()", "context.NO_ERROR"); … … 28 28 // Synthetic OpenGL error 29 29 shouldBeNull("context.getActiveUniform(null, 0)"); 30 shouldBe("context.getError()", "context.INVALID_ OPERATION");30 shouldBe("context.getError()", "context.INVALID_VALUE"); 31 31 // Error state should be clear by this point 32 32 shouldBe("context.getError()", "context.NO_ERROR"); -
trunk/WebCore/ChangeLog
r57322 r57324 1 2010-04-09 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Darin Fisher. 4 5 Passing null WebGLObjects should synthesize INVALID_VALUE error 6 https://bugs.webkit.org/show_bug.cgi?id=37047 7 8 * html/canvas/WebGLRenderingContext.cpp: Synthesize INVALID_VALUE error when input object is 0. 9 (WebCore::WebGLRenderingContext::bindAttribLocation): 10 (WebCore::WebGLRenderingContext::compileShader): 11 (WebCore::WebGLRenderingContext::detachShader): 12 (WebCore::WebGLRenderingContext::validateWebGLObject): 13 (WebCore::WebGLRenderingContext::getActiveAttrib): 14 (WebCore::WebGLRenderingContext::getActiveUniform): 15 (WebCore::WebGLRenderingContext::getProgramParameter): 16 (WebCore::WebGLRenderingContext::getProgramInfoLog): 17 (WebCore::WebGLRenderingContext::getShaderParameter): 18 (WebCore::WebGLRenderingContext::getShaderInfoLog): 19 (WebCore::WebGLRenderingContext::getShaderSource): 20 (WebCore::WebGLRenderingContext::getUniform): 21 (WebCore::WebGLRenderingContext::getUniformLocation): 22 (WebCore::WebGLRenderingContext::linkProgram): 23 (WebCore::WebGLRenderingContext::shaderSource): 24 * html/canvas/WebGLRenderingContext.h: Add helper function to validate webgl object input parameters. 25 1 26 2010-04-09 Zhenyao Mo <zmo@google.com> 2 27 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r57049 r57324 184 184 { 185 185 UNUSED_PARAM(ec); 186 if (!program || program->context() != this) { 187 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 188 return; 189 } 186 if (!validateWebGLObject(program)) 187 return; 190 188 m_context->bindAttribLocation(program, index, name); 191 189 cleanupAfterGraphicsCall(false); … … 410 408 { 411 409 UNUSED_PARAM(ec); 412 if (!shader || shader->context() != this) { 413 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 414 return; 415 } 410 if (!validateWebGLObject(shader)) 411 return; 416 412 m_context->compileShader(shader); 417 413 cleanupAfterGraphicsCall(false); … … 553 549 { 554 550 UNUSED_PARAM(ec); 555 if (!program || program->context() != this || !shader || shader->context() != this) { 556 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 557 return; 558 } 551 if (!validateWebGLObject(program) || !validateWebGLObject(shader)) 552 return; 559 553 m_context->detachShader(program, shader); 560 554 cleanupAfterGraphicsCall(false); … … 701 695 702 696 return numElementsRequired <= smallestNumElements; 697 } 698 699 bool WebGLRenderingContext::validateWebGLObject(CanvasObject* object) 700 { 701 if (!object) { 702 m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); 703 return false; 704 } 705 if (object->context() != this) { 706 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 707 return false; 708 } 709 return true; 703 710 } 704 711 … … 864 871 UNUSED_PARAM(ec); 865 872 ActiveInfo info; 866 if (!program || program->context() != this) { 867 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 873 if (!validateWebGLObject(program)) 868 874 return 0; 869 }870 875 if (!m_context->getActiveAttrib(program, index, info)) { 871 876 return 0; … … 878 883 UNUSED_PARAM(ec); 879 884 ActiveInfo info; 880 if (!program || program->context() != this) { 881 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 885 if (!validateWebGLObject(program)) 882 886 return 0; 883 }884 887 if (!m_context->getActiveUniform(program, index, info)) { 885 888 return 0; … … 1153 1156 { 1154 1157 UNUSED_PARAM(ec); 1155 if (!program || program->context() != this) { 1156 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1158 if (!validateWebGLObject(program)) 1157 1159 return WebGLGetInfo(); 1158 }1159 1160 1160 1161 WebGLStateRestorer(this, false); … … 1183 1184 { 1184 1185 UNUSED_PARAM(ec); 1185 if (!program || program->context() != this) { 1186 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1186 if (!validateWebGLObject(program)) 1187 1187 return ""; 1188 }1189 1188 WebGLStateRestorer(this, false); 1190 1189 return m_context->getProgramInfoLog(program); … … 1227 1226 { 1228 1227 UNUSED_PARAM(ec); 1229 if (!shader || shader->context() != this) { 1230 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1228 if (!validateWebGLObject(shader)) 1231 1229 return WebGLGetInfo(); 1232 }1233 1230 WebGLStateRestorer(this, false); 1234 1231 int value = 0; … … 1254 1251 { 1255 1252 UNUSED_PARAM(ec); 1256 if (!shader || shader->context() != this) { 1257 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1253 if (!validateWebGLObject(shader)) 1258 1254 return ""; 1259 }1260 1255 WebGLStateRestorer(this, false); 1261 1256 return m_context->getShaderInfoLog(shader); … … 1265 1260 { 1266 1261 UNUSED_PARAM(ec); 1267 if (!shader || shader->context() != this) { 1268 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1262 if (!validateWebGLObject(shader)) 1269 1263 return ""; 1270 }1271 1264 WebGLStateRestorer(this, false); 1272 1265 return m_context->getShaderSource(shader); … … 1305 1298 { 1306 1299 UNUSED_PARAM(ec); 1307 if (!program || uniformLocation->program() != program || program->context() != this) { 1300 if (!validateWebGLObject(program)) 1301 return WebGLGetInfo(); 1302 if (uniformLocation->program() != program) { 1308 1303 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1309 1304 return WebGLGetInfo(); … … 1434 1429 { 1435 1430 UNUSED_PARAM(ec); 1436 if (!program || program->context() != this) { 1437 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1431 if (!validateWebGLObject(program)) 1438 1432 return 0; 1439 }1440 1433 WebGLStateRestorer(this, false); 1441 1434 long uniformLocation = m_context->getUniformLocation(program, name); … … 1563 1556 { 1564 1557 UNUSED_PARAM(ec); 1565 if (!program || program->context() != this) { 1566 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1567 return; 1568 } 1569 1558 if (!validateWebGLObject(program)) 1559 return; 1570 1560 m_context->linkProgram(program); 1571 1561 cleanupAfterGraphicsCall(false); … … 1631 1621 { 1632 1622 UNUSED_PARAM(ec); 1633 if (!shader || shader->context() != this) { 1634 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1635 return; 1636 } 1623 if (!validateWebGLObject(shader)) 1624 return; 1637 1625 m_context->shaderSource(shader, string); 1638 1626 cleanupAfterGraphicsCall(false); -
trunk/WebCore/html/canvas/WebGLRenderingContext.h
r53238 r57324 310 310 bool validateRenderingState(long numElements); 311 311 312 bool validateWebGLObject(CanvasObject* object); 313 312 314 OwnPtr<GraphicsContext3D> m_context; 313 315 bool m_needsUpdate;
Note: See TracChangeset
for help on using the changeset viewer.