Bug 722154 - Part e: Remove custom quickstubs for uniform[1-4][i,f]v and uniformMatrix[2-4]fv; r=bjacob
authorMs2ger <ms2ger@gmail.com>
Fri, 16 Mar 2012 10:52:42 +0100
changeset 89468 265fe1dacc915986ca8a2dd0bbe3345669c55881
parent 89467 f41d103e5bbed7d73eb5f14881d862f3aa3d34a5
child 89469 ee56787a20fbd126db503d0bae089e0a45b50282
push id22257
push userMs2ger@gmail.com
push dateFri, 16 Mar 2012 09:55:12 +0000
treeherdermozilla-central@ee56787a20fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs722154
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 722154 - Part e: Remove custom quickstubs for uniform[1-4][i,f]v and uniformMatrix[2-4]fv; r=bjacob
content/canvas/src/CustomQS_WebGL.h
content/canvas/src/WebGLContextGL.cpp
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
js/xpconnect/src/dom_quickstubs.qsconf
--- a/content/canvas/src/CustomQS_WebGL.h
+++ b/content/canvas/src/CustomQS_WebGL.h
@@ -331,237 +331,16 @@ nsIDOMWebGLRenderingContext_TexSubImage2
 
     if (NS_FAILED(rv))
         return xpc_qsThrowMethodFailed(cx, rv, vp);
 
     *vp = JSVAL_VOID;
     return JS_TRUE;
 }
 
-/* NOTE: There is a TN version of this below, update it as well */
-static inline JSBool
-helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(JSContext *cx, unsigned argc, jsval *vp, int nElements)
-{
-    XPC_QS_ASSERT_CONTEXT_OK(cx);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    nsresult rv;
-
-    nsIDOMWebGLRenderingContext *self;
-    xpc_qsSelfRef selfref;
-    JS::AutoValueRooter tvr(cx);
-    if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
-        return JS_FALSE;
-
-    if (argc < 2)
-        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-
-    jsval *argv = JS_ARGV(cx, vp);
-
-    nsIWebGLUniformLocation *location;
-    xpc_qsSelfRef location_selfref;
-    rv = xpc_qsUnwrapArg(cx, argv[0], &location, &location_selfref.ptr, &argv[0]);
-    if (NS_FAILED(rv)) {
-        xpc_qsThrowBadArg(cx, rv, vp, 0);
-        return JS_FALSE;
-    }
-
-    if (JSVAL_IS_PRIMITIVE(argv[1])) {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
-        return JS_FALSE;
-    }
-
-    JSObject *arg1 = JSVAL_TO_OBJECT(argv[1]);
-
-    JS::AutoValueRooter obj_tvr(cx);
-
-    JSObject *wa = 0;
-
-    if (helper_isInt32Array(arg1)) {
-        wa = js::TypedArray::getTypedArray(arg1);
-    }  else if (JS_IsArrayObject(cx, arg1)) {
-        JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_INT32, arg1);
-        if (!nobj) {
-            // XXX this will likely return a strange error message if it goes wrong
-            return JS_FALSE;
-        }
-
-        *obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
-        wa = js::TypedArray::getTypedArray(nobj);
-    } else {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
-        return JS_FALSE;
-    }
-
-    if (nElements == 1) {
-        rv = self->Uniform1iv_array(location, wa);
-    } else if (nElements == 2) {
-        rv = self->Uniform2iv_array(location, wa);
-    } else if (nElements == 3) {
-        rv = self->Uniform3iv_array(location, wa);
-    } else if (nElements == 4) {
-        rv = self->Uniform4iv_array(location, wa);
-    }
-
-    if (NS_FAILED(rv))
-        return xpc_qsThrowMethodFailed(cx, rv, vp);
-
-    *vp = JSVAL_VOID;
-    return JS_TRUE;
-}
-
-/* NOTE: There is a TN version of this below, update it as well */
-static inline JSBool
-helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(JSContext *cx, unsigned argc, jsval *vp, int nElements)
-{
-    XPC_QS_ASSERT_CONTEXT_OK(cx);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    nsresult rv;
-
-    nsIDOMWebGLRenderingContext *self;
-    xpc_qsSelfRef selfref;
-    JS::AutoValueRooter tvr(cx);
-    if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
-        return JS_FALSE;
-
-    if (argc < 2)
-        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-
-    jsval *argv = JS_ARGV(cx, vp);
-
-    nsIWebGLUniformLocation *location;
-    xpc_qsSelfRef location_selfref;
-    rv = xpc_qsUnwrapArg(cx, argv[0], &location, &location_selfref.ptr, &argv[0]);
-    if (NS_FAILED(rv)) {
-        xpc_qsThrowBadArg(cx, rv, vp, 0);
-        return JS_FALSE;
-    }
-
-    if (JSVAL_IS_PRIMITIVE(argv[1])) {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
-        return JS_FALSE;
-    }
-
-    JSObject *arg1 = JSVAL_TO_OBJECT(argv[1]);
-
-    JS::AutoValueRooter obj_tvr(cx);
-
-    JSObject *wa = 0;
-
-    if (helper_isFloat32Array(arg1)) {
-        wa = js::TypedArray::getTypedArray(arg1);
-    }  else if (JS_IsArrayObject(cx, arg1)) {
-        JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg1);
-        if (!nobj) {
-            // XXX this will likely return a strange error message if it goes wrong
-            return JS_FALSE;
-        }
-
-        *obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
-        wa = js::TypedArray::getTypedArray(nobj);
-    } else {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
-        return JS_FALSE;
-    }
-
-    if (nElements == 1) {
-        rv = self->Uniform1fv_array(location, wa);
-    } else if (nElements == 2) {
-        rv = self->Uniform2fv_array(location, wa);
-    } else if (nElements == 3) {
-        rv = self->Uniform3fv_array(location, wa);
-    } else if (nElements == 4) {
-        rv = self->Uniform4fv_array(location, wa);
-    }
-
-    if (NS_FAILED(rv))
-        return xpc_qsThrowMethodFailed(cx, rv, vp);
-
-    *vp = JSVAL_VOID;
-    return JS_TRUE;
-}
-
-/* NOTE: There is a TN version of this below, update it as well */
-static inline JSBool
-helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(JSContext *cx, unsigned argc, jsval *vp, int nElements)
-{
-    XPC_QS_ASSERT_CONTEXT_OK(cx);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    nsIDOMWebGLRenderingContext *self;
-    xpc_qsSelfRef selfref;
-    JS::AutoValueRooter tvr(cx);
-    if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
-        return JS_FALSE;
-
-    if (argc < 3)
-        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-
-    jsval *argv = JS_ARGV(cx, vp);
-
-    nsIWebGLUniformLocation *location;
-    xpc_qsSelfRef location_selfref;
-    nsresult rv = xpc_qsUnwrapArg(cx, argv[0], &location, &location_selfref.ptr, &argv[0]);
-    if (NS_FAILED(rv)) {
-        xpc_qsThrowBadArg(cx, rv, vp, 0);
-        return JS_FALSE;
-    }
-
-    JSBool transpose;
-    MOZ_ALWAYS_TRUE(JS_ValueToBoolean(cx, argv[1], &transpose));
-
-    if (JSVAL_IS_PRIMITIVE(argv[2])) {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
-        return JS_FALSE;
-    }
-
-    JSObject *arg2 = JSVAL_TO_OBJECT(argv[2]);
-
-    JS::AutoValueRooter obj_tvr(cx);
-
-    JSObject *wa = 0;
-
-    if (helper_isFloat32Array(arg2)) {
-        wa = js::TypedArray::getTypedArray(arg2);
-    }  else if (JS_IsArrayObject(cx, arg2)) {
-        JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg2);
-        if (!nobj) {
-            // XXX this will likely return a strange error message if it goes wrong
-            return JS_FALSE;
-        }
-
-        *obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
-        wa = js::TypedArray::getTypedArray(nobj);
-    } else {
-        xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
-        return JS_FALSE;
-    }
-
-    if (nElements == 2) {
-        rv = self->UniformMatrix2fv_array(location, transpose, wa);
-    } else if (nElements == 3) {
-        rv = self->UniformMatrix3fv_array(location, transpose, wa);
-    } else if (nElements == 4) {
-        rv = self->UniformMatrix4fv_array(location, transpose, wa);
-    }
-
-    if (NS_FAILED(rv))
-        return xpc_qsThrowMethodFailed(cx, rv, vp);
-
-    *vp = JSVAL_VOID;
-    return JS_TRUE;
-}
-
 static inline JSBool
 helper_nsIDOMWebGLRenderingContext_VertexAttrib_x_fv(JSContext *cx, unsigned argc, jsval *vp, int nElements)
 {
     XPC_QS_ASSERT_CONTEXT_OK(cx);
     JSObject *obj = JS_THIS_OBJECT(cx, vp);
     if (!obj)
         return JS_FALSE;
 
@@ -621,82 +400,16 @@ helper_nsIDOMWebGLRenderingContext_Verte
     if (NS_FAILED(rv))
         return xpc_qsThrowMethodFailed(cx, rv, vp);
 
     *vp = JSVAL_VOID;
     return JS_TRUE;
 }
 
 static JSBool
-nsIDOMWebGLRenderingContext_Uniform1iv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(cx, argc, vp, 1);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform2iv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(cx, argc, vp, 2);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform3iv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(cx, argc, vp, 3);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform4iv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(cx, argc, vp, 4);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform1fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(cx, argc, vp, 1);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform2fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(cx, argc, vp, 2);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform3fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(cx, argc, vp, 3);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_Uniform4fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(cx, argc, vp, 4);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_UniformMatrix2fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(cx, argc, vp, 2);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_UniformMatrix3fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(cx, argc, vp, 3);
-}
-
-static JSBool
-nsIDOMWebGLRenderingContext_UniformMatrix4fv(JSContext *cx, unsigned argc, jsval *vp)
-{
-    return helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(cx, argc, vp, 4);
-}
-
-static JSBool
 nsIDOMWebGLRenderingContext_VertexAttrib1fv(JSContext *cx, unsigned argc, jsval *vp)
 {
     return helper_nsIDOMWebGLRenderingContext_VertexAttrib_x_fv(cx, argc, vp, 1);
 }
 
 static JSBool
 nsIDOMWebGLRenderingContext_VertexAttrib2fv(JSContext *cx, unsigned argc, jsval *vp)
 {
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -4053,72 +4053,123 @@ WebGLContext::DOMElementToImageSurface(E
         default:
             NS_ASSERTION(false, "Unsupported image format. Unimplemented.");
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
+template<size_t type>
+static JSObject*
+GetTypedArray(JSContext* aCx, const JS::Value& aValue)
+{
+    if (!aValue.isObject()) {
+        return NULL;
+    }
+
+    JSObject& value = aValue.toObject();
+
+    if (js::GetObjectClass(&value) == &js::TypedArray::fastClasses[type]) {
+        return &value;
+    }
+
+    if (JS_IsArrayObject(aCx, &value)) {
+        return js_CreateTypedArrayWithArray(aCx, type, &value);
+    }
+
+    return NULL;
+}
+
+static JSObject*
+GetFloat32Array(JSContext* aCx, const JS::Value& aValue)
+{
+    return GetTypedArray<js::TypedArray::TYPE_FLOAT32>(aCx, aValue);
+}
+
 #define OBTAIN_UNIFORM_LOCATION(info)                                   \
     WebGLUniformLocation *location_object;                              \
     bool isNull;                                                      \
     if (!GetConcreteObject(info, ploc, &location_object, &isNull))      \
         return NS_OK;                                                   \
     if (isNull)                                                         \
         return NS_OK;                                                   \
     /* the need to check specifically for !mCurrentProgram here is explained in bug 657556 */ \
     if (!mCurrentProgram) \
         return ErrorInvalidOperation("%s: no program is currently bound", info); \
     if (mCurrentProgram != location_object->Program()) \
         return ErrorInvalidOperation("%s: this uniform location doesn't correspond to the current program", info); \
     if (mCurrentProgram->Generation() != location_object->ProgramGeneration())            \
         return ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info); \
     GLint location = location_object->Location();
 
-#define SIMPLE_ARRAY_METHOD_UNIFORM(name, cnt, arrayType, ptrType)      \
-NS_IMETHODIMP                                                           \
-WebGLContext::name(PRInt32) {                                     \
-     return NS_ERROR_NOT_IMPLEMENTED;                                   \
-}                                                                       \
-NS_IMETHODIMP                                                           \
-WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, JSObject *wa) \
-{                                                                       \
-    if (!IsContextStable())                                                   \
-        return NS_OK;                                                   \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    if (!wa || JS_GetTypedArrayType(wa) != js::TypedArray::arrayType)   \
+#define SIMPLE_ARRAY_METHOD_UNIFORM(name, cnt, arrayType, ptrType)              \
+NS_IMETHODIMP                                                                   \
+WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue, \
+                   JSContext* aCx)                                              \
+{                                                                               \
+    JSObject* wa = GetTypedArray<js::TypedArray::arrayType>(aCx, aValue);       \
+    if (!wa) {                                                                  \
+        return NS_ERROR_FAILURE;                                                \
+    }                                                                           \
+                                                                                \
+    if (!IsContextStable()) {                                                   \
+        return NS_OK;                                                           \
+    }                                                                           \
+                                                                                \
+    nsIWebGLUniformLocation* ploc = aLocation;                                  \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    if (JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) {                \
         return ErrorInvalidOperation(#name ": array must be " #arrayType);      \
-    if (JS_GetTypedArrayLength(wa) == 0 || JS_GetTypedArrayLength(wa) % cnt != 0)\
-        return ErrorInvalidValue(#name ": array must be > 0 elements and have a length multiple of %d", cnt); \
-    MakeContextCurrent();                                               \
-    gl->f##name(location, JS_GetTypedArrayLength(wa) / cnt, (ptrType *)JS_GetTypedArrayData(wa));            \
-    return NS_OK;                                                       \
+    }                                                                           \
+    if (JS_GetTypedArrayLength(wa) == 0 ||                                      \
+        JS_GetTypedArrayLength(wa) % cnt != 0) {                                \
+        return ErrorInvalidValue(#name ": array must be > 0 elements and have " \
+                                "a length multiple of %d", cnt);                \
+    }                                                                           \
+                                                                                \
+    MakeContextCurrent();                                                       \
+    gl->f##name(location, JS_GetTypedArrayLength(wa) / cnt,                     \
+                static_cast<ptrType*>(JS_GetTypedArrayData(wa)));               \
+    return NS_OK;                                                               \
 }
 
-#define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim, arrayType, ptrType)     \
-NS_IMETHODIMP                                                           \
-WebGLContext::name(PRInt32) {                                     \
-     return NS_ERROR_NOT_IMPLEMENTED;                                   \
-}                                                                       \
-NS_IMETHODIMP                                                           \
-WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, WebGLboolean transpose, JSObject *wa)  \
-{                                                                       \
-    if (!IsContextStable())                                                   \
-        return NS_OK;                                                   \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    if (!wa || JS_GetTypedArrayType(wa) != js::TypedArray::arrayType)                   \
-        return ErrorInvalidValue(#name ": array must be " #arrayType);      \
-    if (JS_GetTypedArrayLength(wa) == 0 || JS_GetTypedArrayLength(wa) % (dim*dim) != 0)                 \
-        return ErrorInvalidValue(#name ": array length must be >0 and multiple of %d", dim*dim); \
-    if (transpose)                                                      \
-        return ErrorInvalidValue(#name ": transpose must be FALSE as per the OpenGL ES 2.0 spec"); \
-    MakeContextCurrent();                                               \
-    gl->f##name(location, JS_GetTypedArrayLength(wa) / (dim*dim), transpose, (ptrType *)JS_GetTypedArrayData(wa)); \
-    return NS_OK;                                                       \
+#define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim)                                 \
+NS_IMETHODIMP                                                                   \
+WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,         \
+                   const JS::Value& aValue, JSContext* aCx)                     \
+{                                                                               \
+    JSObject* wa = GetFloat32Array(aCx, aValue);                                \
+    if (!wa) {                                                                  \
+        return NS_ERROR_FAILURE;                                                \
+    }                                                                           \
+                                                                                \
+    if (!IsContextStable()) {                                                   \
+        return NS_OK;                                                           \
+    }                                                                           \
+                                                                                \
+    nsIWebGLUniformLocation* ploc = aLocation;                                  \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    if (JS_GetTypedArrayType(wa) != js::TypedArray::TYPE_FLOAT32) {             \
+        return ErrorInvalidValue(#name ": array must be TYPE_FLOAT32");         \
+    }                                                                           \
+    if (JS_GetTypedArrayLength(wa) == 0 ||                                      \
+        JS_GetTypedArrayLength(wa) % (dim*dim) != 0) {                          \
+        return ErrorInvalidValue(#name ": array length must be >0 and "         \
+                                 "multiple of %d", dim*dim);                    \
+    }                                                                           \
+    if (aTranspose) {                                                           \
+        return ErrorInvalidValue(#name ": transpose must be FALSE as per the "  \
+                                 "OpenGL ES 2.0 spec");                         \
+    }                                                                           \
+                                                                                \
+    MakeContextCurrent();                                                       \
+    gl->f##name(location, JS_GetTypedArrayLength(wa) / (dim*dim), false,        \
+                static_cast<WebGLfloat*>(JS_GetTypedArrayData(wa)));            \
+    return NS_OK;                                                               \
 }
 
 #define SIMPLE_METHOD_UNIFORM_1(glname, name, t1)        \
 NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1) {      \
     if (!IsContextStable())                                    \
         return NS_OK;                                    \
     OBTAIN_UNIFORM_LOCATION(#name ": location") \
     MakeContextCurrent(); gl->f##glname(location, a1); return NS_OK; \
@@ -4163,19 +4214,19 @@ SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2iv, 
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3iv, 3, TYPE_INT32, WebGLint)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4iv, 4, TYPE_INT32, WebGLint)
 
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1fv, 1, TYPE_FLOAT32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 2, TYPE_FLOAT32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, TYPE_FLOAT32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, TYPE_FLOAT32, WebGLfloat)
 
-SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2, TYPE_FLOAT32, WebGLfloat)
-SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3, TYPE_FLOAT32, WebGLfloat)
-SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix4fv, 4, TYPE_FLOAT32, WebGLfloat)
+SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2)
+SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3)
+SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix4fv, 4)
 
 NS_IMETHODIMP
 WebGLContext::VertexAttrib1f(PRUint32 index, WebGLfloat x0)
 {
     if (!IsContextStable())
         return NS_OK;
 
     MakeContextCurrent();
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -172,17 +172,17 @@ interface nsIWebGLExtensionLoseContext :
 
 [scriptable, uuid(73bfb64d-94bd-4a7a-9eab-6b6d32e57aa0)]
 interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
 {
   const WebGLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
   const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
 };
 
-[scriptable, builtinclass, uuid(aae55fc4-b650-4178-920a-c985b720d9bb)]
+[scriptable, builtinclass, uuid(77c303b8-9d86-48d4-a118-0c32358520ee)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
   //
   //  CONSTANTS
   //
 
   /* ClearBufferMask */
   const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;
@@ -802,42 +802,28 @@ interface nsIDOMWebGLRenderingContext : 
   void uniform1i (in nsIWebGLUniformLocation location, in WebGLint x);
   void uniform2f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y);
   void uniform2i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y);
   void uniform3f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z);
   void uniform3i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y, in WebGLint z);
   void uniform4f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z, in WebGLfloat w);
   void uniform4i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y, in WebGLint z, in WebGLint w);
 
-  void uniform1fv([optional] in long dummy);
-  void uniform1iv([optional] in long dummy);
-  void uniform2fv([optional] in long dummy);
-  void uniform2iv([optional] in long dummy);
-  void uniform3fv([optional] in long dummy);
-  void uniform3iv([optional] in long dummy);
-  void uniform4fv([optional] in long dummy);
-  void uniform4iv([optional] in long dummy);
+  [implicit_jscontext] void uniform1fv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform1iv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform2fv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform2iv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform3fv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform3iv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform4fv(in nsIWebGLUniformLocation location, in jsval v);
+  [implicit_jscontext] void uniform4iv(in nsIWebGLUniformLocation location, in jsval v);
 
-  [noscript] void uniform1fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform1iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform2fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform2iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform3fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform3iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform4fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-  [noscript] void uniform4iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
-
-  // Modified. These are modified by replacing 'count' and 'value' with a WebGLJSObjectPtr
-  void uniformMatrix2fv([optional] in long dummy);
-  void uniformMatrix3fv([optional] in long dummy);
-  void uniformMatrix4fv([optional] in long dummy);
-
-  [noscript] void uniformMatrix2fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
-  [noscript] void uniformMatrix3fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
-  [noscript] void uniformMatrix4fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
+  [implicit_jscontext] void uniformMatrix2fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
+  [implicit_jscontext] void uniformMatrix3fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
+  [implicit_jscontext] void uniformMatrix4fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
 
   // Added API using top entry from the passed nsIWebGLMatrixStack
   //ZZ void glUniformMatrix(in WebGLint location, in WebGLboolean transpose, in nsIWebGLMatrixStack value);
 
   void useProgram(in nsIWebGLProgram program);
   void validateProgram(in nsIWebGLProgram program);
 
   // Modified: All the glVertexAttrib*v forms below are modified by replacing 'values' with a WebGLJSObjectPtr
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -975,27 +975,16 @@ customMethodCalls = {
         },
     'nsIDOMWindow_SetOnmouseleave' : {
         'thisType' : 'nsIDOMWindow',
         'unwrapThisFailureFatal' : False
         },
     # WebGL
     'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
     'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
-    'nsIDOMWebGLRenderingContext_Uniform1iv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform2iv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform3iv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform4iv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform1fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform2fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform3fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_Uniform4fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_UniformMatrix2fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_UniformMatrix3fv': CUSTOM_QS_TN,
-    'nsIDOMWebGLRenderingContext_UniformMatrix4fv': CUSTOM_QS_TN,
     'nsIDOMWebGLRenderingContext_VertexAttrib1fv': CUSTOM_QS,
     'nsIDOMWebGLRenderingContext_VertexAttrib2fv': CUSTOM_QS,
     'nsIDOMWebGLRenderingContext_VertexAttrib3fv': CUSTOM_QS,
     'nsIDOMWebGLRenderingContext_VertexAttrib4fv': CUSTOM_QS,
     # Canvas 2D
     'nsIDOMCanvasRenderingContext2D_CreateImageData': CUSTOM_QS,
     'nsIDOMCanvasRenderingContext2D_PutImageData': CUSTOM_QS,
     # Nasty hack to make the ordering of |arc| and |arcTo| correct.