Commit b983e904 authored by's avatar
Browse files

Do error checking of parameter to createShader

git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c4897228
2009-11-24 Chris Marrin <>
Reviewed by Eric Seidel.
Test for createShader param passing
This test will eventually contain more param passing tests as
they are implemented.
* fast/canvas/webgl/invalidPassedParams-expected.txt: Added.
* fast/canvas/webgl/invalidPassedParams.html: Added.
2009-11-24 Darin Fisher <>
Reviewed by Adam Barth.
Test for invalid passed parameters
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Test shaders
PASS shader = context.createShader(context.FRAGMENT_SHADER) is shader
PASS shader = context.createShader(context.VERTEX_SHADER) is shader
PASS context.createShader(0) threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS context.createShader(context.TRIANGLES) threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS successfullyParsed is true
<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<div id="description"></div>
<div id="console"></div>
description("Test for invalid passed parameters");
var context = create3DContext();
debug("Test shaders");
var shader;
shouldBe("shader = context.createShader(context.FRAGMENT_SHADER)", "shader");
shouldBe("shader = context.createShader(context.VERTEX_SHADER)", "shader");
successfullyParsed = true;
<script src="../../js/resources/js-test-post.js"></script>
2009-11-24 Chris Marrin <>
Reviewed by Eric Seidel.
Do error checking of parameter to createShader
Test: fast/canvas/webgl/invalidPassedParams.html
* html/canvas/WebGLRenderingContext.cpp:
* html/canvas/WebGLRenderingContext.h:
* html/canvas/WebGLRenderingContext.idl:
2009-11-24 Kent Tamura <>
Reviewed by Eric Seidel.
......@@ -448,9 +448,13 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer()
return o;
PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(unsigned long type)
PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(unsigned long type, ExceptionCode& ec)
// FIXME: Need to do param checking and throw exception if an illegal value is passed in
if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) {
return 0;
RefPtr<WebGLShader> o = WebGLShader::create(this, static_cast<GraphicsContext3D::WebGLEnumType>(type));
return o;
......@@ -96,7 +96,7 @@ class WebKitCSSMatrix;
PassRefPtr<WebGLFramebuffer> createFramebuffer();
PassRefPtr<WebGLProgram> createProgram();
PassRefPtr<WebGLRenderbuffer> createRenderbuffer();
PassRefPtr<WebGLShader> createShader(unsigned long type);
PassRefPtr<WebGLShader> createShader(unsigned long type, ExceptionCode&);
PassRefPtr<WebGLTexture> createTexture();
void cullFace(unsigned long mode);
......@@ -499,7 +499,7 @@ module html {
WebGLFramebuffer createFramebuffer();
WebGLProgram createProgram();
WebGLRenderbuffer createRenderbuffer();
WebGLShader createShader(in unsigned long type);
WebGLShader createShader(in unsigned long type) raises(DOMException);
WebGLTexture createTexture();
void cullFace(in unsigned long mode);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment