Diff
Modified: trunk/LayoutTests/ChangeLog (115672 => 115673)
--- trunk/LayoutTests/ChangeLog 2012-04-30 21:41:19 UTC (rev 115672)
+++ trunk/LayoutTests/ChangeLog 2012-04-30 21:48:07 UTC (rev 115673)
@@ -1,3 +1,20 @@
+2012-04-30 Kentaro Hara <[email protected]>
+
+ WebGLRenderingContext methods should throw TypeError for not enough arguments
+ https://bugs.webkit.org/show_bug.cgi?id=84787
+
+ Reviewed by Kenneth Russell.
+
+ Currently, WebGLRenderingcontext methods implement
+ "Not enough arguments" error as SyntaxError. The Web IDL
+ spec requires that it should be TypeError:
+ http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm
+
+ This patch changes SyntaxError to TypeError.
+
+ * fast/canvas/webgl/webgl-exceptions-expected.txt: Added.
+ * fast/canvas/webgl/webgl-exceptions.html: Added.
+
2012-04-30 Abhishek Arya <[email protected]>
Remove positioned float code.
Added: trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions-expected.txt (0 => 115673)
--- trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions-expected.txt 2012-04-30 21:48:07 UTC (rev 115673)
@@ -0,0 +1,19 @@
+PASS gl.getBufferParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getRenderbufferParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getTexParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getVertexAttrib() threw exception TypeError: Not enough arguments.
+PASS gl.getAttachedShaders() threw exception TypeError: Not enough arguments.
+PASS gl.getExtension() threw exception TypeError: Not enough arguments.
+PASS gl.getFramebufferAttachmentParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getProgramParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getShaderParameter() threw exception TypeError: Not enough arguments.
+PASS gl.getUniform() threw exception TypeError: Not enough arguments.
+PASS gl.uniform1iv() threw exception TypeError: Not enough arguments.
+PASS gl.uniformMatrix2fv() threw exception TypeError: Not enough arguments.
+PASS gl.uniform1fv() threw exception TypeError: Not enough arguments.
+PASS gl.vertexAttrib1fv() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions.html (0 => 115673)
--- trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-exceptions.html 2012-04-30 21:48:07 UTC (rev 115673)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+var gl = create3DContext();
+shouldThrow('gl.getBufferParameter()');
+shouldThrow('gl.getRenderbufferParameter()');
+shouldThrow('gl.getTexParameter()');
+shouldThrow('gl.getVertexAttrib()');
+shouldThrow('gl.getAttachedShaders()');
+shouldThrow('gl.getExtension()');
+shouldThrow('gl.getFramebufferAttachmentParameter()');
+shouldThrow('gl.getParameter()');
+shouldThrow('gl.getProgramParameter()');
+shouldThrow('gl.getShaderParameter()');
+shouldThrow('gl.getUniform()');
+shouldThrow('gl.uniform1iv()');
+shouldThrow('gl.uniformMatrix2fv()');
+shouldThrow('gl.uniform1fv()');
+shouldThrow('gl.vertexAttrib1fv()');
+</script>
+</body>
+<script src=""
+</html>
Modified: trunk/Source/WebCore/ChangeLog (115672 => 115673)
--- trunk/Source/WebCore/ChangeLog 2012-04-30 21:41:19 UTC (rev 115672)
+++ trunk/Source/WebCore/ChangeLog 2012-04-30 21:48:07 UTC (rev 115673)
@@ -1,3 +1,47 @@
+2012-04-30 Kentaro Hara <[email protected]>
+
+ WebGLRenderingContext methods should throw TypeError for not enough arguments
+ https://bugs.webkit.org/show_bug.cgi?id=84787
+
+ Reviewed by Kenneth Russell.
+
+ Currently, WebGLRenderingcontext methods implement
+ "Not enough arguments" error as SyntaxError. The Web IDL
+ spec requires that it should be TypeError:
+ http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm
+
+ This patch changes SyntaxError to TypeError.
+
+ I wanted to confirm the behavior of Firefox and Opera,
+ but they do not implement WebGL yet.
+
+ Test: fast/canvas/webgl/webgl-exceptions.html
+
+ * bindings/js/JSWebGLRenderingContextCustom.cpp:
+ (WebCore::getObjectParameter):
+ (WebCore::JSWebGLRenderingContext::getAttachedShaders):
+ (WebCore::JSWebGLRenderingContext::getExtension):
+ (WebCore::JSWebGLRenderingContext::getFramebufferAttachmentParameter):
+ (WebCore::JSWebGLRenderingContext::getParameter):
+ (WebCore::JSWebGLRenderingContext::getProgramParameter):
+ (WebCore::JSWebGLRenderingContext::getShaderParameter):
+ (WebCore::JSWebGLRenderingContext::getUniform):
+ (WebCore::dataFunctionf):
+ (WebCore::dataFunctioni):
+ (WebCore::dataFunctionMatrix):
+ * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+ (WebCore::getObjectParameter):
+ (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
+ (WebCore::V8WebGLRenderingContext::getExtensionCallback):
+ (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getUniformCallback):
+ (WebCore::vertexAttribAndUniformHelperf):
+ (WebCore::uniformHelperi):
+ (WebCore::uniformMatrixHelper):
+
2012-04-30 Emil A Eklund <[email protected]>
[gtk, qt, chromium, win] Fix usage of LayoutUnits and rounding in platform code
Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp (115672 => 115673)
--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp 2012-04-30 21:41:19 UTC (rev 115672)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp 2012-04-30 21:48:07 UTC (rev 115673)
@@ -143,7 +143,7 @@
static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, ObjectType objectType)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl());
@@ -222,7 +222,7 @@
JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLProgram::s_info))
@@ -247,7 +247,7 @@
JSValue JSWebGLRenderingContext::getExtension(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
const String& name = ustringToString(exec->argument(0).toString(exec)->value(exec));
@@ -265,7 +265,7 @@
JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec)
{
if (exec->argumentCount() != 3)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -289,7 +289,7 @@
JSValue JSWebGLRenderingContext::getParameter(ExecState* exec)
{
if (exec->argumentCount() != 1)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -307,7 +307,7 @@
JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -333,7 +333,7 @@
JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -371,7 +371,7 @@
JSValue JSWebGLRenderingContext::getUniform(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -445,7 +445,7 @@
static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
WebGLUniformLocation* location = 0;
long index = -1;
@@ -535,7 +535,7 @@
static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 2)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLUniformLocation::s_info))
return throwTypeError(exec);
@@ -600,7 +600,7 @@
static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 3)
- return throwSyntaxError(exec);
+ return throwError(exec, createNotEnoughArgumentsError(exec));
if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLUniformLocation::s_info))
return throwTypeError(exec);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp (115672 => 115673)
--- trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp 2012-04-30 21:41:19 UTC (rev 115672)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp 2012-04-30 21:48:07 UTC (rev 115673)
@@ -216,10 +216,8 @@
static v8::Handle<v8::Value> getObjectParameter(const v8::Arguments& args, ObjectType objectType)
{
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -270,10 +268,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getAttachedShaders()");
- if (args.Length() < 1) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() < 1)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -306,10 +302,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getExtensionCallback()");
WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
- if (args.Length() < 1) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() < 1)
+ return V8Proxy::throwNotEnoughArgumentsError();
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
WebGLExtension* extension = imp->getExtension(name);
return toV8Object(extension, args.Holder(), args.GetIsolate());
@@ -319,10 +313,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getFramebufferAttachmentParameter()");
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 3)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -341,10 +333,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getParameter()");
- if (args.Length() != 1) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 1)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -361,10 +351,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getProgramParameter()");
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -392,10 +380,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getShaderParameter()");
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -437,10 +423,8 @@
{
INC_STATS("DOM.WebGLRenderingContext.getUniform()");
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
ExceptionCode ec = 0;
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
@@ -510,10 +494,8 @@
// * glVertexAttrib4fv(GLint index, Array data);
// * glVertexAttrib4fv(GLint index, Float32Array data);
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
bool ok = false;
int index = -1;
@@ -594,10 +576,8 @@
// * glUniform4iv(GLUniformLocation location, Array data);
// * glUniform4iv(GLUniformLocation location, Int32Array data);
- if (args.Length() != 2) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 2)
+ return V8Proxy::throwNotEnoughArgumentsError();
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0])) {
@@ -710,10 +690,8 @@
// * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array data);
//
// FIXME: need to change to accept Float32Array as well.
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
- return notHandledByInterceptor();
- }
+ if (args.Length() != 3)
+ return V8Proxy::throwNotEnoughArgumentsError();
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());