b=516213; freshen WebGL implementation and enable on trunk (part 1); r=vlad
authorMark Steele <mwsteele@gmail.com>
Thu, 17 Sep 2009 23:01:07 -0700
changeset 32835 38901b377b1e
parent 32834 2bd25bc1f2e7
child 32836 be2a05a9e4ef
push id9184
push uservladimir@mozilla.com
push date2009-09-18 06:04 +0000
treeherdermozilla-central@be2a05a9e4ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs516213
milestone1.9.3a1pre
b=516213; freshen WebGL implementation and enable on trunk (part 1); r=vlad
content/canvas/public/Makefile.in
content/canvas/public/WebGLArray.h
content/canvas/src/WebGLContext.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/glwrap.cpp
content/canvas/src/glwrap.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoID.h
dom/interfaces/canvas/nsICanvasRenderingContextWebGL.idl
--- a/content/canvas/public/Makefile.in
+++ b/content/canvas/public/Makefile.in
@@ -42,16 +42,17 @@ VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= content
 
 EXPORTS		= \
 		nsICanvasRenderingContextInternal.h \
 		nsICanvasElement.h \
+		WebGLArray.h \
 		$(NULL)
 
 ifdef MOZ_ENABLE_CANVAS3D
 
 XPIDL_MODULE = content_canvas
 
 XPIDLSRCS	= \
 		nsICanvasGLPrivate.idl \
new file mode 100644
--- /dev/null
+++ b/content/canvas/public/WebGLArray.h
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ *   Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef WEBGLARRAY_H_
+#define WEBGLARRAY_H_
+
+#include "nsICanvasRenderingContextWebGL.h"
+
+nsresult NS_NewCanvasFloatArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasByteArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasUnsignedByteArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasShortArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasUnsignedShortArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasIntArray(nsISupports **aNewObject);
+nsresult NS_NewCanvasUnsignedIntArray(nsISupports **aNewObject);
+
+#endif
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 #include "WebGLContext.h"
 
 #include "nsIConsoleService.h"
 #include "nsIPrefService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIClassInfoImpl.h"
 #include "nsContentUtils.h"
+#include "nsDOMError.h"
 
 #include "gfxContext.h"
 #include "gfxPattern.h"
 
 using namespace mozilla;
 
 nsresult NS_NewCanvasRenderingContextWebGL(nsICanvasRenderingContextWebGL** aResult);
 
@@ -357,127 +358,353 @@ NS_IMPL_RELEASE(WebGLContext)
 NS_INTERFACE_MAP_BEGIN(WebGLContext)
   NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextWebGL)
   NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICanvasRenderingContextWebGL)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CanvasRenderingContextWebGL)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1(WebGLBuffer, nsIWebGLBuffer)
 NS_IMPL_ADDREF(WebGLBuffer)
 NS_IMPL_RELEASE(WebGLBuffer)
 
 NS_INTERFACE_MAP_BEGIN(WebGLBuffer)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLBuffer)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLBuffer)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1(WebGLTexture, nsIWebGLTexture)
 NS_IMPL_ADDREF(WebGLTexture)
 NS_IMPL_RELEASE(WebGLTexture)
 
 NS_INTERFACE_MAP_BEGIN(WebGLTexture)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLTexture)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLTexture)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1(WebGLProgram, nsIWebGLProgram)
 NS_IMPL_ADDREF(WebGLProgram)
 NS_IMPL_RELEASE(WebGLProgram)
 
 NS_INTERFACE_MAP_BEGIN(WebGLProgram)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLProgram)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLProgram)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1_CI(WebGLShader, nsIWebGLShader)
 NS_IMPL_ADDREF(WebGLShader)
 NS_IMPL_RELEASE(WebGLShader)
 
 NS_INTERFACE_MAP_BEGIN(WebGLShader)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLShader)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLShader)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1(WebGLFramebuffer, nsIWebGLFramebuffer)
 NS_IMPL_ADDREF(WebGLFramebuffer)
 NS_IMPL_RELEASE(WebGLFramebuffer)
 
 NS_INTERFACE_MAP_BEGIN(WebGLFramebuffer)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLFramebuffer)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLFramebuffer)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS1(WebGLRenderbuffer, nsIWebGLRenderbuffer)
 NS_IMPL_ADDREF(WebGLRenderbuffer)
 NS_IMPL_RELEASE(WebGLRenderbuffer)
 
 NS_INTERFACE_MAP_BEGIN(WebGLRenderbuffer)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLRenderbuffer)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLRenderbuffer)
 NS_INTERFACE_MAP_END
 
-
-//NS_IMPL_ISUPPORTS2(WebGLFloatArray, nsIWebGLNumberArray, nsIWebGLFloatArray)
 NS_IMPL_ADDREF(WebGLFloatArray)
 NS_IMPL_RELEASE(WebGLFloatArray)
 
 NS_INTERFACE_MAP_BEGIN(WebGLFloatArray)
-  NS_INTERFACE_MAP_ENTRY(nsIWebGLNumberArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLFloatArray)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLFloatArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLFloatArray)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS2(WebGLShortArray, nsIWebGLNumberArray, nsIWebGLShortArray)
+NS_IMPL_ADDREF(WebGLByteArray)
+NS_IMPL_RELEASE(WebGLByteArray)
+
+NS_INTERFACE_MAP_BEGIN(WebGLByteArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLByteArray)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLByteArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
+  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLByteArray)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_ADDREF(WebGLUnsignedByteArray)
+NS_IMPL_RELEASE(WebGLUnsignedByteArray)
+
+NS_INTERFACE_MAP_BEGIN(WebGLUnsignedByteArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLUnsignedByteArray)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLUnsignedByteArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
+  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLUnsignedByteArray)
+NS_INTERFACE_MAP_END
+
 NS_IMPL_ADDREF(WebGLShortArray)
 NS_IMPL_RELEASE(WebGLShortArray)
 
 NS_INTERFACE_MAP_BEGIN(WebGLShortArray)
-  NS_INTERFACE_MAP_ENTRY(nsIWebGLNumberArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLShortArray)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLShortArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLShortArray)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS2(WebGLUnsignedShortArray, nsIWebGLNumberArray, nsIWebGLUnsignedShortArray)
 NS_IMPL_ADDREF(WebGLUnsignedShortArray)
 NS_IMPL_RELEASE(WebGLUnsignedShortArray)
 
 NS_INTERFACE_MAP_BEGIN(WebGLUnsignedShortArray)
-  NS_INTERFACE_MAP_ENTRY(nsIWebGLNumberArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
   NS_INTERFACE_MAP_ENTRY(nsIWebGLUnsignedShortArray)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLUnsignedShortArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLUnsignedShortArray)
 NS_INTERFACE_MAP_END
 
-//NS_IMPL_ISUPPORTS2(WebGLUnsignedByteArray, nsIWebGLNumberArray, nsIWebGLUnsignedByteArray)
-NS_IMPL_ADDREF(WebGLUnsignedByteArray)
-NS_IMPL_RELEASE(WebGLUnsignedByteArray)
+NS_IMPL_ADDREF(WebGLIntArray)
+NS_IMPL_RELEASE(WebGLIntArray)
 
-NS_INTERFACE_MAP_BEGIN(WebGLUnsignedByteArray)
-  NS_INTERFACE_MAP_ENTRY(nsIWebGLNumberArray)
-  NS_INTERFACE_MAP_ENTRY(nsIWebGLUnsignedByteArray)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLUnsignedByteArray)
-  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLUnsignedByteArray)
+NS_INTERFACE_MAP_BEGIN(WebGLIntArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLIntArray)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLIntArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
+  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLIntArray)
 NS_INTERFACE_MAP_END
 
+NS_IMPL_ADDREF(WebGLUnsignedIntArray)
+NS_IMPL_RELEASE(WebGLUnsignedIntArray)
+
+NS_INTERFACE_MAP_BEGIN(WebGLUnsignedIntArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLArray)
+  NS_INTERFACE_MAP_ENTRY(nsIWebGLUnsignedIntArray)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebGLUnsignedIntArray)
+  NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
+  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(WebGLUnsignedIntArray)
+NS_INTERFACE_MAP_END
+
+
+nsresult
+NS_NewCanvasFloatArray(nsISupports **aResult)
+{
+    nsIWebGLFloatArray *wgfa = new WebGLFloatArray();
+    if (!wgfa)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wgfa);
+    return NS_OK;
+}
+
+WebGLFloatArray::WebGLFloatArray()
+{
+}
+
+WebGLFloatArray::WebGLFloatArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+{
+    mBuffer.InitFromJSArray(LOCAL_GL_FLOAT, 1, cx, arrayObj, arrayLen);
+}
+
+NS_IMETHODIMP
+WebGLFloatArray::Initialize(nsISupports *owner,
+                            JSContext *cx,
+                            JSObject *obj,
+                            PRUint32 argc,
+                            jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_FLOAT, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
+/* attribute unsigned long length; */
+NS_IMETHODIMP WebGLFloatArray::GetLength(PRUint32 *aLength)
+{
+    *aLength = mBuffer.length;
+    return NS_OK;
+}
+NS_IMETHODIMP WebGLFloatArray::SetLength(PRUint32 aLength)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeType()
+{
+    return mBuffer.type;
+}
+
+/* [noscript, notxpcom] voidPtr nativePointer (); */
+NS_IMETHODIMP_(void *) WebGLFloatArray::NativePointer()
+{
+    return mBuffer.data;
+}
+
+/* [noscript, notxpcom] unsigned long nativeSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeSize()
+{
+    return mBuffer.capacity;
+}
+
+/* [noscript, notxpcom] unsigned long nativeElementSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeElementSize()
+{
+    return mBuffer.ElementSize();
+}
+
+/* [noscript, notxpcom] unsigned long nativeCount (); */
+NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeCount()
+{
+    return mBuffer.length;
+}
+
+nsresult
+NS_NewCanvasByteArray(nsISupports **aResult)
+{
+    nsIWebGLByteArray *wgba = new WebGLByteArray();
+    if (!wgba)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wgba);
+    return NS_OK;
+}
+
+WebGLByteArray::WebGLByteArray() { }
+ 
+WebGLByteArray::WebGLByteArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+{
+    mBuffer.InitFromJSArray(LOCAL_GL_BYTE, 1, cx, arrayObj, arrayLen);
+}
+
+NS_IMETHODIMP
+WebGLByteArray::Initialize(nsISupports *owner,
+                           JSContext *cx,
+                           JSObject *obj,
+                           PRUint32 argc,
+                           jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_BYTE, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
+/* attribute unsigned long length; */
+NS_IMETHODIMP WebGLByteArray::GetLength(PRUint32 *aLength)
+{
+    *aLength = mBuffer.length;
+    return NS_OK;
+}
+NS_IMETHODIMP WebGLByteArray::SetLength(PRUint32 aLength)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP_(PRUint32) WebGLByteArray::NativeType()
+{
+    return mBuffer.type;
+}
+
+/* [noscript, notxpcom] voidPtr nativePointer (); */
+NS_IMETHODIMP_(void *) WebGLByteArray::NativePointer()
+{
+    return mBuffer.data;
+}
+
+/* [noscript, notxpcom] unsigned long nativeSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLByteArray::NativeSize()
+{
+    return mBuffer.capacity;
+}
+
+/* [noscript, notxpcom] unsigned long nativeElementSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLByteArray::NativeElementSize()
+{
+    return mBuffer.ElementSize();
+}
+
+/* [noscript, notxpcom] unsigned long nativeCount (); */
+NS_IMETHODIMP_(PRUint32) WebGLByteArray::NativeCount()
+{
+    return mBuffer.length;
+}
+
+nsresult
+NS_NewCanvasUnsignedByteArray(nsISupports **aResult)
+{
+    nsIWebGLUnsignedByteArray *wguba = new WebGLUnsignedByteArray();
+    if (!wguba)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wguba);
+    return NS_OK;
+}
+
+WebGLUnsignedByteArray::WebGLUnsignedByteArray() { }
 
 WebGLUnsignedByteArray::WebGLUnsignedByteArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
 {
     mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_BYTE, 1, cx, arrayObj, arrayLen);
 }
 
+NS_IMETHODIMP
+WebGLUnsignedByteArray::Initialize(nsISupports *owner,
+                                   JSContext *cx,
+                                   JSObject *obj,
+                                   PRUint32 argc,
+                                   jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_BYTE, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
 /* attribute unsigned long length; */
 NS_IMETHODIMP WebGLUnsignedByteArray::GetLength(PRUint32 *aLength)
 {
     *aLength = mBuffer.length;
     return NS_OK;
 }
 NS_IMETHODIMP WebGLUnsignedByteArray::SetLength(PRUint32 aLength)
 {
@@ -508,66 +735,57 @@ NS_IMETHODIMP_(PRUint32) WebGLUnsignedBy
 }
 
 /* [noscript, notxpcom] unsigned long nativeCount (); */
 NS_IMETHODIMP_(PRUint32) WebGLUnsignedByteArray::NativeCount()
 {
     return mBuffer.length;
 }
 
-WebGLUnsignedShortArray::WebGLUnsignedShortArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
-{
-    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_SHORT, 1, cx, arrayObj, arrayLen);
-}
-
-/* attribute unsigned long length; */
-NS_IMETHODIMP WebGLUnsignedShortArray::GetLength(PRUint32 *aLength)
+nsresult
+NS_NewCanvasShortArray(nsISupports **aResult)
 {
-    *aLength = mBuffer.length;
+    nsIWebGLShortArray *wgsa = new WebGLShortArray();
+    if (!wgsa)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wgsa);
     return NS_OK;
 }
-NS_IMETHODIMP WebGLUnsignedShortArray::SetLength(PRUint32 aLength)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeType()
-{
-    return mBuffer.type;
-}
 
-/* [noscript, notxpcom] voidPtr nativePointer (); */
-NS_IMETHODIMP_(void *) WebGLUnsignedShortArray::NativePointer()
-{
-    return mBuffer.data;
-}
-
-/* [noscript, notxpcom] unsigned long nativeSize (); */
-NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeSize()
-{
-    return mBuffer.capacity;
-}
-
-/* [noscript, notxpcom] unsigned long nativeElementSize (); */
-NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeElementSize()
-{
-    return mBuffer.ElementSize();
-}
-
-/* [noscript, notxpcom] unsigned long nativeCount (); */
-NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeCount()
-{
-    return mBuffer.length;
-}
+WebGLShortArray::WebGLShortArray() { }
 
 WebGLShortArray::WebGLShortArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
 {
     mBuffer.InitFromJSArray(LOCAL_GL_SHORT, 1, cx, arrayObj, arrayLen);
 }
 
+NS_IMETHODIMP
+WebGLShortArray::Initialize(nsISupports *owner,
+                            JSContext *cx,
+                            JSObject *obj,
+                            PRUint32 argc,
+                            jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_SHORT, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
 /* attribute unsigned long length; */
 NS_IMETHODIMP WebGLShortArray::GetLength(PRUint32 *aLength)
 {
     *aLength = mBuffer.length;
     return NS_OK;
 }
 NS_IMETHODIMP WebGLShortArray::SetLength(PRUint32 aLength)
 {
@@ -599,62 +817,259 @@ NS_IMETHODIMP_(PRUint32) WebGLShortArray
 
 /* [noscript, notxpcom] unsigned long nativeCount (); */
 NS_IMETHODIMP_(PRUint32) WebGLShortArray::NativeCount()
 {
     return mBuffer.length;
 }
 
 
-WebGLFloatArray::WebGLFloatArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+nsresult
+NS_NewCanvasUnsignedShortArray(nsISupports **aResult)
 {
-    mBuffer.InitFromJSArray(LOCAL_GL_FLOAT, 1, cx, arrayObj, arrayLen);
+    nsIWebGLUnsignedShortArray *wgusa = new WebGLUnsignedShortArray();
+    if (!wgusa)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wgusa);
+    return NS_OK;
+}
+
+WebGLUnsignedShortArray::WebGLUnsignedShortArray() { }
+
+WebGLUnsignedShortArray::WebGLUnsignedShortArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+{
+    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_SHORT, 1, cx, arrayObj, arrayLen);
+}
+
+NS_IMETHODIMP
+WebGLUnsignedShortArray::Initialize(nsISupports *owner,
+                                   JSContext *cx,
+                                   JSObject *obj,
+                                   PRUint32 argc,
+                                   jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_SHORT, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
 }
 
 /* attribute unsigned long length; */
-NS_IMETHODIMP WebGLFloatArray::GetLength(PRUint32 *aLength)
+NS_IMETHODIMP WebGLUnsignedShortArray::GetLength(PRUint32 *aLength)
 {
     *aLength = mBuffer.length;
     return NS_OK;
 }
-NS_IMETHODIMP WebGLFloatArray::SetLength(PRUint32 aLength)
+NS_IMETHODIMP WebGLUnsignedShortArray::SetLength(PRUint32 aLength)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeType()
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeType()
 {
     return mBuffer.type;
 }
 
 /* [noscript, notxpcom] voidPtr nativePointer (); */
-NS_IMETHODIMP_(void *) WebGLFloatArray::NativePointer()
+NS_IMETHODIMP_(void *) WebGLUnsignedShortArray::NativePointer()
 {
     return mBuffer.data;
 }
 
 /* [noscript, notxpcom] unsigned long nativeSize (); */
-NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeSize()
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeSize()
 {
     return mBuffer.capacity;
 }
 
 /* [noscript, notxpcom] unsigned long nativeElementSize (); */
-NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeElementSize()
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeElementSize()
 {
     return mBuffer.ElementSize();
 }
 
 /* [noscript, notxpcom] unsigned long nativeCount (); */
-NS_IMETHODIMP_(PRUint32) WebGLFloatArray::NativeCount()
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedShortArray::NativeCount()
 {
     return mBuffer.length;
 }
 
+nsresult
+NS_NewCanvasIntArray(nsISupports **aResult)
+{
+    nsIWebGLIntArray *wgia = new WebGLIntArray();
+    if (!wgia)
+        return NS_ERROR_OUT_OF_MEMORY;
 
+    NS_ADDREF(*aResult = wgia);
+    return NS_OK;
+}
+
+WebGLIntArray::WebGLIntArray() { }
+
+WebGLIntArray::WebGLIntArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+{
+    mBuffer.InitFromJSArray(LOCAL_GL_INT, 1, cx, arrayObj, arrayLen);
+}
+
+NS_IMETHODIMP
+WebGLIntArray::Initialize(nsISupports *owner,
+                          JSContext *cx,
+                          JSObject *obj,
+                          PRUint32 argc,
+                          jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_INT, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
+
+/* attribute unsigned long length; */
+NS_IMETHODIMP WebGLIntArray::GetLength(PRUint32 *aLength)
+{
+    *aLength = mBuffer.length;
+    return NS_OK;
+}
+NS_IMETHODIMP WebGLIntArray::SetLength(PRUint32 aLength)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP_(PRUint32) WebGLIntArray::NativeType()
+{
+    return mBuffer.type;
+}
+
+/* [noscript, notxpcom] voidPtr nativePointer (); */
+NS_IMETHODIMP_(void *) WebGLIntArray::NativePointer()
+{
+    return mBuffer.data;
+}
+
+/* [noscript, notxpcom] unsigned long nativeSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLIntArray::NativeSize()
+{
+    return mBuffer.capacity;
+}
+
+/* [noscript, notxpcom] unsigned long nativeElementSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLIntArray::NativeElementSize()
+{
+    return mBuffer.ElementSize();
+}
+
+/* [noscript, notxpcom] unsigned long nativeCount (); */
+NS_IMETHODIMP_(PRUint32) WebGLIntArray::NativeCount()
+{
+    return mBuffer.length;
+}
+
+nsresult
+NS_NewCanvasUnsignedIntArray(nsISupports **aResult)
+{
+    nsIWebGLUnsignedIntArray *wguia = new WebGLUnsignedIntArray();
+    if (!wguia)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    NS_ADDREF(*aResult = wguia);
+    return NS_OK;
+}
+
+WebGLUnsignedIntArray::WebGLUnsignedIntArray() { }
+
+WebGLUnsignedIntArray::WebGLUnsignedIntArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen)
+{
+    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_INT, 1, cx, arrayObj, arrayLen);
+}
+
+NS_IMETHODIMP
+WebGLUnsignedIntArray::Initialize(nsISupports *owner,
+                                  JSContext *cx,
+                                  JSObject *obj,
+                                  PRUint32 argc,
+                                  jsval *argv)
+{
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(cx, argc, argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(cx, arrayObj) ||
+        !::JS_GetArrayLength(cx, arrayObj, &arrayLen))
+    {
+        return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    mBuffer.InitFromJSArray(LOCAL_GL_UNSIGNED_INT, 1, cx, arrayObj, arrayLen);
+
+    return NS_OK;
+}
+
+/* attribute unsigned long length; */
+NS_IMETHODIMP WebGLUnsignedIntArray::GetLength(PRUint32 *aLength)
+{
+    *aLength = mBuffer.length;
+    return NS_OK;
+}
+NS_IMETHODIMP WebGLUnsignedIntArray::SetLength(PRUint32 aLength)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedIntArray::NativeType()
+{
+    return mBuffer.type;
+}
+
+/* [noscript, notxpcom] voidPtr nativePointer (); */
+NS_IMETHODIMP_(void *) WebGLUnsignedIntArray::NativePointer()
+{
+    return mBuffer.data;
+}
+
+/* [noscript, notxpcom] unsigned long nativeSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedIntArray::NativeSize()
+{
+    return mBuffer.capacity;
+}
+
+/* [noscript, notxpcom] unsigned long nativeElementSize (); */
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedIntArray::NativeElementSize()
+{
+    return mBuffer.ElementSize();
+}
+
+/* [noscript, notxpcom] unsigned long nativeCount (); */
+NS_IMETHODIMP_(PRUint32) WebGLUnsignedIntArray::NativeCount()
+{
+    return mBuffer.length;
+}
 
 /* [noscript] attribute GLuint name; */
 NS_IMETHODIMP WebGLTexture::GetName(GLuint *aName)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 NS_IMETHODIMP WebGLTexture::SetName(GLuint aName)
 {
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -47,25 +47,26 @@
 #include "nsHashKeys.h"
 
 #include "nsIDocShell.h"
 
 #include "nsICanvasRenderingContextWebGL.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "nsWeakReference.h"
 #include "nsIDOMHTMLElement.h"
+#include "nsIJSNativeInitializer.h"
 
 #include "SimpleBuffer.h"
 #include "nsGLPbuffer.h"
 
 class nsIDocShell;
 
 namespace mozilla {
 
-class WebGLNumberArray;
+class WebGLArray;
 class WebGLTexture;
 class WebGLBuffer;
 class WebGLProgram;
 class WebGLShader;
 class WebGLFramebuffer;
 class WebGLRenderbuffer;
 
 class WebGLZeroingObject;
@@ -343,17 +344,17 @@ public:
         if (mDeleted)
             return;
         ZeroOwners();
         mDeleted = PR_TRUE;
     }
     PRBool Deleted() { return mDeleted; }
     GLuint GLName() { return mName; }
 
-    void Set(nsIWebGLNumberArray *na) {
+    void Set(nsIWebGLArray *na) {
         mGLType = na->NativeType();
         mElementSize = na->NativeElementSize();
         mCount = na->NativeCount();
     }
 
     GLenum GLType() { return mGLType; }
     PRUint32 ByteCount() { return mElementSize * mCount; }
     PRUint32 Count() { return mCount; }
@@ -491,79 +492,188 @@ protected:
     PRBool mDeleted;
 };
 
 //
 // array wrapper classes
 //
 
 class WebGLFloatArray :
-    public nsIWebGLFloatArray
+    public nsIWebGLFloatArray,
+    public nsIJSNativeInitializer
 {
 public:
+    WebGLFloatArray();
     WebGLFloatArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
 
     NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBGLNUMBERARRAY
+    NS_DECL_NSIWEBGLARRAY
     NS_DECL_NSIWEBGLFLOATARRAY
+
+    static nsresult NewCanvasFloatArray(nsISupports **aNewObject);
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
+
+protected:
+    SimpleBuffer mBuffer;
+    PRUint32 mLength;
+    PRUint32 mSize;
+    PRUint32 mElementSize;
+    PRUint32 mCount;
+};
+
+class WebGLByteArray :
+    public nsIWebGLByteArray,
+    public nsIJSNativeInitializer
+{
+public:
+    WebGLByteArray();
+    WebGLByteArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
+
+    NS_DECL_ISUPPORTS
+    NS_DECL_NSIWEBGLARRAY
+    NS_DECL_NSIWEBGLBYTEARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
+protected:
+    SimpleBuffer mBuffer;
+    PRUint32 mLength;
+    PRUint32 mSize;
+    PRUint32 mElementSize;
+    PRUint32 mCount;
+};
+
+class WebGLUnsignedByteArray :
+    public nsIWebGLUnsignedByteArray,
+    public nsIJSNativeInitializer
+{
+public:
+    WebGLUnsignedByteArray();
+    WebGLUnsignedByteArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
+
+    NS_DECL_ISUPPORTS
+    NS_DECL_NSIWEBGLARRAY
+    NS_DECL_NSIWEBGLUNSIGNEDBYTEARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
 protected:
     SimpleBuffer mBuffer;
     PRUint32 mLength;
     PRUint32 mSize;
     PRUint32 mElementSize;
     PRUint32 mCount;
 };
 
 class WebGLShortArray :
-    public nsIWebGLShortArray
+    public nsIWebGLShortArray,
+    public nsIJSNativeInitializer
 {
 public:
+    WebGLShortArray();
     WebGLShortArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
 
     NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBGLNUMBERARRAY
+    NS_DECL_NSIWEBGLARRAY
     NS_DECL_NSIWEBGLSHORTARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
 protected:
     SimpleBuffer mBuffer;
     PRUint32 mLength;
     PRUint32 mSize;
     PRUint32 mElementSize;
     PRUint32 mCount;
 };
 
 class WebGLUnsignedShortArray :
-    public nsIWebGLUnsignedShortArray
+    public nsIWebGLUnsignedShortArray,
+    public nsIJSNativeInitializer
 {
 public:
+    WebGLUnsignedShortArray();
     WebGLUnsignedShortArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
 
     NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBGLNUMBERARRAY
+    NS_DECL_NSIWEBGLARRAY
     NS_DECL_NSIWEBGLUNSIGNEDSHORTARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
 protected:
     SimpleBuffer mBuffer;
     PRUint32 mLength;
     PRUint32 mSize;
     PRUint32 mElementSize;
     PRUint32 mCount;
 };
 
-class WebGLUnsignedByteArray :
-    public nsIWebGLUnsignedByteArray
+class WebGLIntArray :
+    public nsIWebGLIntArray,
+    public nsIJSNativeInitializer
 {
 public:
-    WebGLUnsignedByteArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
+    WebGLIntArray();
+    WebGLIntArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
 
     NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBGLNUMBERARRAY
-    NS_DECL_NSIWEBGLUNSIGNEDBYTEARRAY
+    NS_DECL_NSIWEBGLARRAY
+    NS_DECL_NSIWEBGLINTARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
 protected:
     SimpleBuffer mBuffer;
     PRUint32 mLength;
     PRUint32 mSize;
     PRUint32 mElementSize;
     PRUint32 mCount;
 };
 
+class WebGLUnsignedIntArray :
+    public nsIWebGLUnsignedIntArray,
+    public nsIJSNativeInitializer
+{
+public:
+    WebGLUnsignedIntArray();
+    WebGLUnsignedIntArray(JSContext *cx, JSObject *arrayObj, jsuint arrayLen);
+
+    NS_DECL_ISUPPORTS
+    NS_DECL_NSIWEBGLARRAY
+    NS_DECL_NSIWEBGLUNSIGNEDINTARRAY
+
+    NS_IMETHOD Initialize(nsISupports* aOwner,
+                          JSContext* aCx,
+                          JSObject* aObj,
+                          PRUint32 aArgc,
+                          jsval* aArgv);
+protected:
+    SimpleBuffer mBuffer;
+    PRUint32 mLength;
+    PRUint32 mSize;
+    PRUint32 mElementSize;
+    PRUint32 mCount;
+};
 
 }
 
 #endif
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -84,25 +84,75 @@ WebGLContext::CreateFloatArray(nsIWebGLF
     if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
         arrayObj == NULL ||
         !::JS_IsArrayObject(js.ctx, arrayObj) ||
         !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
     {
             return NS_ERROR_DOM_SYNTAX_ERR;
     }
 
-    SimpleBuffer sbuffer(LOCAL_GL_FLOAT, 1, js.ctx, arrayObj, arrayLen);
-
     WebGLFloatArray *wgfa = new WebGLFloatArray(js.ctx, arrayObj, arrayLen);
     if (wgfa)
         NS_ADDREF(*retval = wgfa);
 
     return NS_OK;
 }
 
+/* nsIWebGLByteArray createByteArray (); */
+NS_IMETHODIMP
+WebGLContext::CreateByteArray(nsIWebGLByteArray **retval)
+{
+    NativeJSContext js;
+
+    if (js.argc != 1)
+        return NS_ERROR_DOM_SYNTAX_ERR;
+
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(js.ctx, arrayObj) ||
+        !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
+    {
+            return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    WebGLByteArray *wgba = new WebGLByteArray(js.ctx, arrayObj, arrayLen);
+    if (wgba)
+        NS_ADDREF(*retval = wgba);
+    return NS_OK;
+}
+
+/* nsIWebGLUnsignedByteArray createUnsignedByteArray (); */
+NS_IMETHODIMP
+WebGLContext::CreateUnsignedByteArray(nsIWebGLUnsignedByteArray **retval)
+{
+    NativeJSContext js;
+
+    if (js.argc != 1)
+        return NS_ERROR_DOM_SYNTAX_ERR;
+
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(js.ctx, arrayObj) ||
+        !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
+    {
+            return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    WebGLUnsignedByteArray *wguba = new WebGLUnsignedByteArray(js.ctx, arrayObj, arrayLen);
+    if (wguba)
+        NS_ADDREF(*retval = wguba);
+    return NS_OK;
+}
+
 /* nsIWebGLShortArray createShortArray (); */
 NS_IMETHODIMP
 WebGLContext::CreateShortArray(nsIWebGLShortArray **retval)
 {
     NativeJSContext js;
 
     if (js.argc != 1)
         return NS_ERROR_DOM_SYNTAX_ERR;
@@ -113,26 +163,25 @@ WebGLContext::CreateShortArray(nsIWebGLS
     if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
         arrayObj == NULL ||
         !::JS_IsArrayObject(js.ctx, arrayObj) ||
         !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
     {
             return NS_ERROR_DOM_SYNTAX_ERR;
     }
 
-    SimpleBuffer sbuffer(LOCAL_GL_SHORT, 1, js.ctx, arrayObj, arrayLen);
-
     WebGLShortArray *wgsa = new WebGLShortArray(js.ctx, arrayObj, arrayLen);
     if (wgsa)
         NS_ADDREF(*retval = wgsa);
     return NS_OK;
 }
 
 /* nsIWebGLUnsignedShortArray createUnsignedShortArray (); */
-NS_IMETHODIMP WebGLContext::CreateUnsignedShortArray(nsIWebGLUnsignedShortArray **retval)
+NS_IMETHODIMP
+WebGLContext::CreateUnsignedShortArray(nsIWebGLUnsignedShortArray **retval)
 {
     NativeJSContext js;
 
     if (js.argc != 1)
         return NS_ERROR_DOM_SYNTAX_ERR;
 
     JSObject *arrayObj;
     jsuint arrayLen;
@@ -140,27 +189,26 @@ NS_IMETHODIMP WebGLContext::CreateUnsign
     if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
         arrayObj == NULL ||
         !::JS_IsArrayObject(js.ctx, arrayObj) ||
         !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
     {
             return NS_ERROR_DOM_SYNTAX_ERR;
     }
 
-    SimpleBuffer sbuffer(LOCAL_GL_UNSIGNED_SHORT, 1, js.ctx, arrayObj, arrayLen);
-
     WebGLUnsignedShortArray *wgusa = new WebGLUnsignedShortArray(js.ctx, arrayObj, arrayLen);
     if (wgusa)
         NS_ADDREF(*retval = wgusa);
     return NS_OK;
 }
 
+
 /* nsIWebGLUnsignedByteArray createUnsignedByteArray (); */
 NS_IMETHODIMP
-WebGLContext::CreateUnsignedByteArray(nsIWebGLUnsignedByteArray **retval)
+WebGLContext::CreateIntArray(nsIWebGLIntArray **retval)
 {
     NativeJSContext js;
 
     if (js.argc != 1)
         return NS_ERROR_DOM_SYNTAX_ERR;
 
     JSObject *arrayObj;
     jsuint arrayLen;
@@ -168,31 +216,112 @@ WebGLContext::CreateUnsignedByteArray(ns
     if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
         arrayObj == NULL ||
         !::JS_IsArrayObject(js.ctx, arrayObj) ||
         !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
     {
             return NS_ERROR_DOM_SYNTAX_ERR;
     }
 
-    SimpleBuffer sbuffer(LOCAL_GL_UNSIGNED_SHORT, 1, js.ctx, arrayObj, arrayLen);
-
-    WebGLUnsignedByteArray *wguba = new WebGLUnsignedByteArray(js.ctx, arrayObj, arrayLen);
-    if (wguba)
-        NS_ADDREF(*retval = wguba);
+    WebGLIntArray *wgia = new WebGLIntArray(js.ctx, arrayObj, arrayLen);
+    if (wgia)
+        NS_ADDREF(*retval = wgia);
+    return NS_OK;
+}
+
+/* nsIWebGLUnsignedByteArray createUnsignedByteArray (); */
+NS_IMETHODIMP
+WebGLContext::CreateUnsignedIntArray(nsIWebGLUnsignedIntArray **retval)
+{
+    NativeJSContext js;
+
+    if (js.argc != 1)
+        return NS_ERROR_DOM_SYNTAX_ERR;
+
+    JSObject *arrayObj;
+    jsuint arrayLen;
+
+    if (!::JS_ConvertArguments(js.ctx, js.argc, js.argv, "o", &arrayObj) ||
+        arrayObj == NULL ||
+        !::JS_IsArrayObject(js.ctx, arrayObj) ||
+        !::JS_GetArrayLength(js.ctx, arrayObj, &arrayLen))
+    {
+            return NS_ERROR_DOM_SYNTAX_ERR;
+    }
+
+    WebGLUnsignedIntArray *wguia = new WebGLUnsignedIntArray(js.ctx, arrayObj, arrayLen);
+    if (wguia)
+        NS_ADDREF(*retval = wguia);
     return NS_OK;
 }
 
 /* readonly attribute nsIDOMHTMLCanvasElement canvas; */
 NS_IMETHODIMP
-WebGLContext::GetCanvas(nsIDOMHTMLCanvasElement * *aCanvas)
+WebGLContext::GetCanvas(nsIDOMHTMLCanvasElement **aCanvas)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+/* readonly attribute nsIWebGLBuffer currentArrayBufferBinding; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentArrayBufferBinding(nsIWebGLBuffer **aCurrentArrayBufferBinding)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLBuffer currentElementArrayBufferBinding; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentElementArrayBufferBinding(nsIWebGLBuffer **aCurrentElementArrayBufferBinding)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLFramebuffer currentFramebufferBinding; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentFramebufferBinding(nsIWebGLFramebuffer **aCurrentFramebufferBinding)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLRenderbuffer currentRenderbufferBinding; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentRenderbufferBinding(nsIWebGLRenderbuffer **aCurrentRenderbufferBinding)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLTexture currentTextureBinding2D; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentTextureBinding2D(nsIWebGLTexture **aCurrentTextureBinding2D)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLTexture currentTextureBindingCubeMap; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentTextureBindingCubeMap(nsIWebGLTexture **aCurrentTextureBindingCubeMap)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* readonly attribute nsIWebGLProgram currentProgram; */
+NS_IMETHODIMP
+WebGLContext::GetCurrentProgram(nsIWebGLProgram **aCurrentProgram)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* void present (); */
+NS_IMETHODIMP
+WebGLContext::Present()
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+
 /* void GlActiveTexture (in PRUint32 texture); */
 NS_IMETHODIMP
 WebGLContext::ActiveTexture(PRUint32 texture)
 {
     if (texture < LOCAL_GL_TEXTURE0 || texture >= LOCAL_GL_TEXTURE0+mBound2DTextures.Length())
         return NS_ERROR_DOM_SYNTAX_ERR;
 
     MakeContextCurrent();
@@ -336,25 +465,25 @@ GL_SAME_METHOD_1(BlendEquation, BlendEqu
 
 GL_SAME_METHOD_2(BlendEquationSeparate, BlendEquationSeparate, PRUint32, PRUint32)
 
 GL_SAME_METHOD_2(BlendFunc, BlendFunc, PRUint32, PRUint32)
 
 GL_SAME_METHOD_4(BlendFuncSeparate, BlendFuncSeparate, PRUint32, PRUint32, PRUint32, PRUint32)
 
 NS_IMETHODIMP
-WebGLContext::BufferData(GLenum target, nsIWebGLNumberArray *na, GLenum usage)
+WebGLContext::BufferData(GLenum target, nsIWebGLArray *na, GLenum usage)
 {
     WebGLBuffer *boundBuffer = NULL;
 
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         if (na->NativeType() != LOCAL_GL_UNSIGNED_SHORT)
-            return ErrorMessage("glBufferDatA: GL_ELEMENT_ARRAY_BUFFER target must be used with UnsignedShortBuffer");
+            return ErrorMessage("glBufferData: %x - GL_ELEMENT_ARRAY_BUFFER target must be used with UnsignedShortBuffer", na->NativeType());
 
         boundBuffer = mBoundElementArrayBuffer;
     } else {
         return ErrorMessage("glBufferData: invalid target");
     }
 
     if (boundBuffer == NULL) {
         return ErrorMessage("glBufferData: no buffer bound!");
@@ -365,17 +494,17 @@ WebGLContext::BufferData(GLenum target, 
     boundBuffer->Set(na);
 
     gl->fBufferData(target, na->NativeSize(), na->NativePointer(), usage);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::BufferSubData(GLenum target, GLuint offset, nsIWebGLNumberArray *na)
+WebGLContext::BufferSubData(GLenum target, GLuint offset, nsIWebGLArray *na)
 {
     WebGLBuffer *boundBuffer = NULL;
 
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundElementArrayBuffer;
     } else {
@@ -747,19 +876,18 @@ WebGLContext::DrawArrays(GLenum mode, GL
 
     gl->fDrawArrays(mode, offset, count);
 
     Invalidate();
 
     return NS_OK;
 }
 
-// XXX why are count & type swapped?
 NS_IMETHODIMP
-WebGLContext::DrawElements(GLenum mode, GLenum type, GLuint count, GLuint offset)
+WebGLContext::DrawElements(GLenum mode, GLuint count, GLenum type, GLuint offset)
 {
     switch (mode) {
         case LOCAL_GL_TRIANGLES:
         case LOCAL_GL_TRIANGLE_STRIP:
         case LOCAL_GL_TRIANGLE_FAN:
         case LOCAL_GL_POINTS:
         case LOCAL_GL_LINE_STRIP:
         case LOCAL_GL_LINE_LOOP:
@@ -899,17 +1027,17 @@ GL_SAME_METHOD_0(Flush, Flush)
 GL_SAME_METHOD_0(Finish, Finish)
 
 GL_SAME_METHOD_1(FrontFace, FrontFace, GLenum)
 
 GL_SAME_METHOD_1(GenerateMipmap, GenerateMipmap, GLenum)
 
 // returns an object: { size: ..., type: ..., name: ... }
 NS_IMETHODIMP
-WebGLContext::GetActiveAttrib(nsIWebGLProgram *prog, PRUint32 index)
+WebGLContext::GetActiveAttrib(nsIWebGLProgram *prog, PRUint32 index, nsIWebGLActiveInfo **retval)
 {
     if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
         return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
 
     GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
 
     NativeJSContext js;
     if (NS_FAILED(js.error))
@@ -936,17 +1064,17 @@ WebGLContext::GetActiveAttrib(nsIWebGLPr
     retobj.DefineProperty("name", name, len);
 
     js.SetRetVal(retobj);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetActiveUniform(nsIWebGLProgram *prog, PRUint32 index)
+WebGLContext::GetActiveUniform(nsIWebGLProgram *prog, PRUint32 index, nsIWebGLActiveInfo **retval)
 {
     if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
         return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
 
     GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
 
     NativeJSContext js;
     if (NS_FAILED(js.error))
@@ -1194,17 +1322,17 @@ WebGLContext::GetParameter(PRUint32 pnam
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetBufferParameter(GLenum target, GLenum pname)
+WebGLContext::GetBufferParameteri(GLenum target, GLenum pname, GLint *retval)
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     MakeContextCurrent();
 
     switch (pname) {
@@ -1222,17 +1350,17 @@ WebGLContext::GetBufferParameter(GLenum 
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname)
+WebGLContext::GetFramebufferAttachmentParameteri(GLenum target, GLenum attachment, GLenum pname, GLint *retval)
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     MakeContextCurrent();
 
     switch (attachment) {
@@ -1259,17 +1387,17 @@ WebGLContext::GetFramebufferAttachmentPa
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetRenderbufferParameter(GLenum target, GLenum pname)
+WebGLContext::GetRenderbufferParameteri(GLenum target, GLenum pname, GLint *retval)
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     MakeContextCurrent();
 
     switch (pname) {
@@ -1292,17 +1420,17 @@ WebGLContext::GetRenderbufferParameter(G
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GenBuffer(nsIWebGLBuffer **retval)
+WebGLContext::CreateBuffer(nsIWebGLBuffer **retval)
 {
     MakeContextCurrent();
 
     GLuint name;
     gl->fGenBuffers(1, &name);
 
     WebGLBuffer *globj = new WebGLBuffer(name);
     if (globj) {
@@ -1311,17 +1439,17 @@ WebGLContext::GenBuffer(nsIWebGLBuffer *
     } else {
         gl->fDeleteBuffers(1, &name);
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GenTexture(nsIWebGLTexture **retval)
+WebGLContext::CreateTexture(nsIWebGLTexture **retval)
 {
     MakeContextCurrent();
 
     GLuint name;
     gl->fGenTextures(1, &name);
 
     WebGLTexture *globj = new WebGLTexture(name);
     if (globj) {
@@ -1338,17 +1466,17 @@ NS_IMETHODIMP
 WebGLContext::GetError(GLenum *_retval)
 {
     MakeContextCurrent();
     *_retval = gl->fGetError();
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetProgramParameter(nsIWebGLProgram *prog, PRUint32 pname)
+WebGLContext::GetProgrami(nsIWebGLProgram *prog, PRUint32 pname, GLint *retval)
 {
     if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
         return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
 
     GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
 
     NativeJSContext js;
     if (NS_FAILED(js.error))
@@ -1418,16 +1546,50 @@ NS_IMETHODIMP
 WebGLContext::GetString(GLenum name, nsAString & _retval NS_OUTPARAM)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* XXX fix */
 /* void texParameter (); */
 NS_IMETHODIMP
+WebGLContext::TexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    if (js.argc != 3)
+        return NS_ERROR_DOM_SYNTAX_ERR;
+
+    MakeContextCurrent();
+
+    gl->fTexParameterf (target, pname, param);
+
+    return NS_OK;
+}
+NS_IMETHODIMP
+WebGLContext::TexParameteri(GLenum target, GLenum pname, GLint param)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    if (js.argc != 3)
+        return NS_ERROR_DOM_SYNTAX_ERR;
+
+    MakeContextCurrent();
+
+    gl->fTexParameteri (target, pname, param);
+
+    return NS_OK;
+}
+
+#if 0
+NS_IMETHODIMP
 WebGLContext::TexParameter()
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     if (js.argc != 3)
         return NS_ERROR_DOM_SYNTAX_ERR;
@@ -1507,21 +1669,81 @@ WebGLContext::TexParameter()
         }
             break;
         default:
             return NS_ERROR_DOM_SYNTAX_ERR;
     }
 
     return NS_OK;
 }
+#endif
 
 /* XXX fix */
 /* void getTexParameter (); */
+
+/* GLfloat getTexParameterf (in GLenum target, in GLenum pname); */
 NS_IMETHODIMP
-WebGLContext::GetTexParameter(GLenum target, GLenum pname)
+WebGLContext::GetTexParameterf(GLenum target, GLenum pname, GLfloat *retval)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    MakeContextCurrent();
+
+    switch (pname) {
+        case LOCAL_GL_TEXTURE_MIN_FILTER:
+        case LOCAL_GL_TEXTURE_MAG_FILTER:
+        case LOCAL_GL_TEXTURE_WRAP_S:
+        case LOCAL_GL_TEXTURE_WRAP_T:
+        {
+            float fv = 0;
+            gl->fGetTexParameterfv(target, pname, (GLfloat*) &fv);
+            js.SetRetVal(fv);
+        }
+            break;
+
+        default:
+            return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    return NS_OK;
+}
+
+/* nsIWebGLArray getTexParameterfv (in GLenum target, in GLenum pname); */
+NS_IMETHODIMP
+WebGLContext::GetTexParameterfv(GLenum target, GLenum pname, nsIWebGLArray **retval)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    MakeContextCurrent();
+
+    switch (pname) {
+        case LOCAL_GL_TEXTURE_MIN_FILTER:
+        case LOCAL_GL_TEXTURE_MAG_FILTER:
+        case LOCAL_GL_TEXTURE_WRAP_S:
+        case LOCAL_GL_TEXTURE_WRAP_T:
+        {
+            float fv = 0;
+            gl->fGetTexParameterfv(target, pname, (GLfloat*) &fv);
+            js.SetRetVal(&fv, 1);
+        }
+            break;
+
+        default:
+            return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    return NS_OK;
+}
+
+NS_IMETHODIMP
+WebGLContext::GetTexParameteri(GLenum target, GLenum pname, GLint *retval)
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     MakeContextCurrent();
 
     switch (pname) {
@@ -1538,19 +1760,48 @@ WebGLContext::GetTexParameter(GLenum tar
 
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
+/* nsIWebGLArray getTexParameteriv (in GLenum target, in GLenum pname); */
+NS_IMETHODIMP
+WebGLContext::GetTexParameteriv(GLenum target, GLenum pname, nsIWebGLArray **retval)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    MakeContextCurrent();
+
+    switch (pname) {
+        case LOCAL_GL_TEXTURE_MIN_FILTER:
+        case LOCAL_GL_TEXTURE_MAG_FILTER:
+        case LOCAL_GL_TEXTURE_WRAP_S:
+        case LOCAL_GL_TEXTURE_WRAP_T:
+        {
+            PRInt32 iv = 0;
+            gl->fGetTexParameteriv(target, pname, (GLint*) &iv);
+            js.SetRetVal(&iv, 1);
+        }
+            break;
+
+        default:
+            return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    return NS_OK;
+}
+
 /* XXX fix */
 NS_IMETHODIMP
-WebGLContext::GetUniform(nsIWebGLProgram *prog, GLint location)
+WebGLContext::GetUniformf(nsIWebGLProgram *prog, GLint location, GLfloat *retval)
 {
     if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
         return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
 
     GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
 
     NativeJSContext js;
     if (NS_FAILED(js.error))
@@ -1587,32 +1838,99 @@ WebGLContext::GetUniform(nsIWebGLProgram
         gl->fGetUniformiv(program, location, iv);
         js.SetRetVal((PRInt32*)iv, unitSize);
     } else {
         js.SetRetValAsJSVal(JSVAL_NULL);
     }
 
     return NS_OK;
 }
+/* nsIWebGLArray getUniformfv (in nsIWebGLProgram program, in GLint location); */
+NS_IMETHODIMP
+WebGLContext::GetUniformfv(nsIWebGLProgram *program, GLint location, nsIWebGLArray **retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+/* GLint getUniformi (in nsIWebGLProgram program, in GLint location); */
+NS_IMETHODIMP
+WebGLContext::GetUniformi(nsIWebGLProgram *program, GLint location, GLint *retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* nsIWebGLArray getUniformiv (in nsIWebGLProgram program, in GLint location); */
+NS_IMETHODIMP
+WebGLContext::GetUniformiv(nsIWebGLProgram *program, GLint location, nsIWebGLArray **retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
 
 NS_IMETHODIMP
 WebGLContext::GetUniformLocation(nsIWebGLProgram *prog, const nsAString& name, GLint *retval)
 {
     if (!prog || static_cast<WebGLProgram*>(prog)->Deleted())
         return ErrorMessage("%s: program is null or deleted!", __FUNCTION__);
 
     GLuint program = static_cast<WebGLProgram*>(prog)->GLName();
 
     MakeContextCurrent();
     *retval = gl->fGetUniformLocation(program, NS_LossyConvertUTF16toASCII(name).get());
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetVertexAttrib(GLuint index, GLenum pname)
+WebGLContext::GetVertexAttribf(GLuint index, GLenum pname, GLfloat *retval)
+{
+    NativeJSContext js;
+    if (NS_FAILED(js.error))
+        return js.error;
+
+    MakeContextCurrent();
+
+    switch (pname) {
+        // int
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE:
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE:
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+        {
+            PRInt32 iv = 0;
+            gl->fGetVertexAttribiv(index, pname, (GLint*) &iv);
+            *retval = (GLfloat) iv;
+        }
+            break;
+
+        case LOCAL_GL_CURRENT_VERTEX_ATTRIB:
+        {
+            GLfloat fv[4] = { 0 };
+            gl->fGetVertexAttribfv(index, LOCAL_GL_CURRENT_VERTEX_ATTRIB, &fv[0]);
+            js.SetRetVal(fv, 4);
+        }
+            break;
+
+        // not supported; doesn't make sense to return a pointer unless we have some kind of buffer object abstraction
+        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER:
+        default:
+            return NS_ERROR_NOT_IMPLEMENTED;
+
+    }
+
+    return NS_OK;
+}
+
+NS_IMETHODIMP
+WebGLContext::GetVertexAttribfv(GLuint index, GLenum pname, nsIWebGLArray **retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+WebGLContext::GetVertexAttribi(GLuint index, GLenum pname, GLint *retval)
 {
     NativeJSContext js;
     if (NS_FAILED(js.error))
         return js.error;
 
     MakeContextCurrent();
 
     switch (pname) {
@@ -1644,16 +1962,29 @@ WebGLContext::GetVertexAttrib(GLuint ind
             return NS_ERROR_NOT_IMPLEMENTED;
 
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
+WebGLContext::GetVertexAttribiv(GLuint index, GLenum pname, nsIWebGLArray **retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* GLuint getVertexAttribOffset (in GLuint index, in GLenum pname); */
+NS_IMETHODIMP
+WebGLContext::GetVertexAttribOffset(GLuint index, GLenum pname, GLuint *retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
 WebGLContext::Hint(GLenum target, GLenum mode)
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsBuffer(nsIWebGLBuffer *iobj, GLboolean *retval)
 {
@@ -2028,17 +2359,17 @@ GL_SAME_METHOD_5(Uniform4i, Uniform4i, G
 GL_SAME_METHOD_2(Uniform1f, Uniform1f, GLint, GLfloat)
 GL_SAME_METHOD_3(Uniform2f, Uniform2f, GLint, GLfloat, GLfloat)
 GL_SAME_METHOD_4(Uniform3f, Uniform3f, GLint, GLfloat, GLfloat, GLfloat)
 GL_SAME_METHOD_5(Uniform4f, Uniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat)
 
 // one uint arg followed by an array of c elements of glTypeConst.
 #define GL_SIMPLE_ARRAY_METHOD(glname, name, c, glTypeConst, ptrType)   \
 NS_IMETHODIMP                                                           \
-WebGLContext::name()                                                    \
+WebGLContext::name(GLint idx, nsIWebGLArray *v)                         \
 {                                                                       \
     NativeJSContext js;                                                 \
     if (NS_FAILED(js.error))                                            \
         return js.error;                                                \
     jsuint index;                                                       \
     JSObject *arrayObj;                                                 \
     jsuint arrayLen;                                                    \
     if (js.argc != 2 ||                                                 \
@@ -2053,17 +2384,17 @@ WebGLContext::name()                    
         return NS_ERROR_FAILURE;                                        \
     MakeContextCurrent();                                               \
     gl->f##glname(index, arrayLen / c, ( ptrType *)sbuffer.data);       \
     return NS_OK;                                                       \
 }
 
 #define GL_SIMPLE_ARRAY_METHOD_NO_COUNT(glname, name, c, glTypeConst, ptrType) \
 NS_IMETHODIMP                                                           \
-WebGLContext::name()                                                    \
+WebGLContext::name(GLuint idx, nsIWebGLArray *v)                        \
 {                                                                       \
     NativeJSContext js;                                                 \
     if (NS_FAILED(js.error))                                            \
         return js.error;                                                \
     jsuint index;                                                       \
     JSObject *arrayObj;                                                 \
     jsuint arrayLen;                                                    \
     if (js.argc != 2 ||                                                 \
@@ -2078,36 +2409,36 @@ WebGLContext::name()                    
         return NS_ERROR_FAILURE;                                        \
     MakeContextCurrent();                                               \
     gl->f##glname(index, ( ptrType *)sbuffer.data);                     \
     return NS_OK;                                                       \
 }
 
 #define GL_SIMPLE_MATRIX_METHOD(glname, name, c, glTypeConst, ptrType)  \
 NS_IMETHODIMP                                                           \
-WebGLContext::name()                                                    \
+WebGLContext::name(GLint location, GLboolean transpose, nsIWebGLArray *value)   \
 {                                                                       \
     NativeJSContext js;                                                 \
     if (NS_FAILED(js.error))                                            \
         return js.error;                                                \
     jsuint index;                                                       \
     JSObject *arrayObj;                                                 \
     jsuint arrayLen;                                                    \
-    if (js.argc != 2 ||                                                 \
+    if (js.argc != 3 ||                                                 \
         !::JS_ValueToECMAUint32(js.ctx, js.argv[0], &index) ||          \
-        !NativeJSContext::JSValToJSArrayAndLength(js.ctx, js.argv[1], &arrayObj, &arrayLen)) \
+        !NativeJSContext::JSValToJSArrayAndLength(js.ctx, js.argv[2], &arrayObj, &arrayLen)) \
         return NS_ERROR_INVALID_ARG;                                    \
     if (arrayLen != c) {                                                \
         return ErrorMessage(#name ": array wrong size, expected " #c);  \
     }                                                                   \
     SimpleBuffer sbuffer(glTypeConst, c, js.ctx, arrayObj, arrayLen);   \
     if (!sbuffer.Valid())                                               \
         return NS_ERROR_FAILURE;                                        \
     MakeContextCurrent();                                               \
-    gl->f##glname(index, arrayLen / c, LOCAL_GL_FALSE, ( ptrType *)sbuffer.data); \
+    gl->f##glname(index, arrayLen / c, transpose, ( ptrType *)sbuffer.data); \
     return NS_OK;                                                       \
 }
 
 GL_SIMPLE_ARRAY_METHOD(Uniform1iv, Uniform1iv, 1, LOCAL_GL_INT, GLint)
 GL_SIMPLE_ARRAY_METHOD(Uniform2iv, Uniform2iv, 2, LOCAL_GL_INT, GLint)
 GL_SIMPLE_ARRAY_METHOD(Uniform3iv, Uniform3iv, 3, LOCAL_GL_INT, GLint)
 GL_SIMPLE_ARRAY_METHOD(Uniform4iv, Uniform4iv, 4, LOCAL_GL_INT, GLint)
 
@@ -2158,17 +2489,17 @@ GL_SAME_METHOD_4(VertexAttrib3f, VertexA
 GL_SAME_METHOD_5(VertexAttrib4f, VertexAttrib4f, PRUint32, float, float, float, float)
 
 GL_SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib1fv, VertexAttrib1fv, 1, LOCAL_GL_FLOAT, GLfloat)
 GL_SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib2fv, VertexAttrib2fv, 2, LOCAL_GL_FLOAT, GLfloat)
 GL_SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib3fv, VertexAttrib3fv, 3, LOCAL_GL_FLOAT, GLfloat)
 GL_SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib4fv, VertexAttrib4fv, 4, LOCAL_GL_FLOAT, GLfloat)
 
 NS_IMETHODIMP
-WebGLContext::GenFramebuffer(nsIWebGLFramebuffer **retval)
+WebGLContext::CreateFramebuffer(nsIWebGLFramebuffer **retval)
 {
     MakeContextCurrent();
 
     GLuint name;
     gl->fGenFramebuffers(1, &name);
 
     WebGLFramebuffer *globj = new WebGLFramebuffer(name);
     if (globj) {
@@ -2177,17 +2508,17 @@ WebGLContext::GenFramebuffer(nsIWebGLFra
     } else {
         gl->fDeleteFramebuffers(1, &name);
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-WebGLContext::GenRenderbuffer(nsIWebGLRenderbuffer **retval)
+WebGLContext::CreateRenderbuffer(nsIWebGLRenderbuffer **retval)
 {
     MakeContextCurrent();
 
     GLuint name;
     gl->fGenRenderbuffers(1, &name);
 
     WebGLRenderbuffer *globj = new WebGLRenderbuffer(name);
     if (globj) {
@@ -2214,17 +2545,17 @@ WebGLContext::CompileShader(nsIWebGLShad
 
     gl->fCompileShader(shader);
 
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
-WebGLContext::GetShaderParameter(nsIWebGLShader *shobj, GLenum pname)
+WebGLContext::GetShaderi(nsIWebGLShader *shobj, GLenum pname, GLint *_retval)
 {
     if (!shobj || static_cast<WebGLShader*>(shobj)->Deleted())
         return ErrorMessage("%s: shader is null or deleted!", __FUNCTION__);
 
     GLuint shader = static_cast<WebGLShader*>(shobj)->GLName();
     
     NativeJSContext js;
     if (NS_FAILED(js.error))
@@ -2247,16 +2578,23 @@ WebGLContext::GetShaderParameter(nsIWebG
 
         default:
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
+/* nsIWebGLIntArray getShaderiv (in nsIWebGLShader shader, in GLenum pname); */
+NS_IMETHODIMP
+WebGLContext::GetShaderiv(nsIWebGLShader *shader, GLenum pname, nsIWebGLIntArray **retval)
+{
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 NS_IMETHODIMP
 WebGLContext::GetShaderInfoLog(nsIWebGLShader *shobj, nsAString& retval)
 {
     if (!shobj || static_cast<WebGLShader*>(shobj)->Deleted())
         return ErrorMessage("%s: shader is null or deleted!", __FUNCTION__);
 
     GLuint shader = static_cast<WebGLShader*>(shobj)->GLName();    
 
--- a/content/canvas/src/glwrap.cpp
+++ b/content/canvas/src/glwrap.cpp
@@ -207,16 +207,17 @@ GLES20Wrap::InitWithPrefix(const char *p
         { (PRFuncPtr*) &fGetBufferParameteriv, { "GetBufferParameteriv", "GetBufferParameterivARB", NULL } },
         { (PRFuncPtr*) &fGenBuffers, { "GenBuffers", "GenBuffersARB", NULL } },
         { (PRFuncPtr*) &fGenTextures, { "GenTextures", NULL } },
         { (PRFuncPtr*) &fGetError, { "GetError", NULL } },
         { (PRFuncPtr*) &fGetProgramiv, { "GetProgramiv", "GetProgramivARB", NULL } },
         { (PRFuncPtr*) &fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", NULL } },
         { (PRFuncPtr*) &fTexParameteri, { "TexParameteri", NULL } },
         { (PRFuncPtr*) &fTexParameterf, { "TexParameterf", NULL } },
+        { (PRFuncPtr*) &fGetTexParameterfv, { "GetTexParameterfv", NULL } },
         { (PRFuncPtr*) &fGetTexParameteriv, { "GetTexParameteriv", NULL } },
         { (PRFuncPtr*) &fGetUniformfv, { "GetUniformfv", "GetUniformfvARB", NULL } },
         { (PRFuncPtr*) &fGetUniformiv, { "GetUniformiv", "GetUniformivARB", NULL } },
         { (PRFuncPtr*) &fGetUniformLocation, { "GetUniformLocation", "GetUniformLocationARB", NULL } },
         { (PRFuncPtr*) &fGetVertexAttribfv, { "GetVertexAttribfv", "GetVertexAttribfvARB", NULL } },
         { (PRFuncPtr*) &fGetVertexAttribiv, { "GetVertexAttribiv", "GetVertexAttribivARB", NULL } },
         { (PRFuncPtr*) &fHint, { "Hint", NULL } },
         { (PRFuncPtr*) &fIsBuffer, { "IsBuffer", "IsBufferARB", NULL } },
--- a/content/canvas/src/glwrap.h
+++ b/content/canvas/src/glwrap.h
@@ -229,18 +229,20 @@ public:
     typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);
     PFNGLGETPROGRAMIVPROC fGetProgramiv;
     typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
     PFNGLGETPROGRAMINFOLOGPROC fGetProgramInfoLog;
     typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
     PFNGLTEXPARAMETERIPROC fTexParameteri;
     typedef void (GLAPIENTRY * PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
     PFNGLTEXPARAMETERFPROC fTexParameterf;
-    typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-    PFNGLTEXPARAMETERIVPROC fGetTexParameteriv;
+    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+    PFNGLGETTEXPARAMETERFVPROC fGetTexParameterfv;
+    typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+    PFNGLGETTEXPARAMETERIVPROC fGetTexParameteriv;
     typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);
     PFNGLGETUNIFORMFVPROC fGetUniformfv;
     typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);
     PFNGLGETUNIFORMIVPROC fGetUniformiv;
     typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLint programObj, const GLchar* name);
     PFNGLGETUNIFORMLOCATIONPROC fGetUniformLocation;
     typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);
     PFNGLGETVERTEXATTRIBFVPROC fGetVertexAttribfv;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -429,16 +429,17 @@
 #include "nsIDOMSVGZoomAndPan.h"
 #include "nsIDOMSVGZoomEvent.h"
 #endif // MOZ_SVG
 
 #ifdef MOZ_ENABLE_CANVAS
 #include "nsIDOMCanvasRenderingContext2D.h"
 #ifdef MOZ_ENABLE_CANVAS3D
 #include "nsICanvasRenderingContextWebGL.h"
+#include "WebGLArray.h"
 #endif
 #endif
 
 #include "nsIImageDocument.h"
 
 // Storage includes
 #include "nsDOMStorage.h"
 
@@ -1329,21 +1330,27 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(WebGLShader, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLFramebuffer, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLRenderbuffer, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLFloatArray, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
+  NS_DEFINE_CLASSINFO_DATA(WebGLByteArray, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
+  NS_DEFINE_CLASSINFO_DATA(WebGLUnsignedByteArray, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLShortArray, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLUnsignedShortArray, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(WebGLUnsignedByteArray, nsDOMGenericSH,
+  NS_DEFINE_CLASSINFO_DATA(WebGLIntArray, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
+  NS_DEFINE_CLASSINFO_DATA(WebGLUnsignedIntArray, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 };
 
 // Objects that shuld be constructable through |new Name();|
 struct nsContractIDMapData
 {
   PRInt32 mDOMClassInfoID;
@@ -1370,16 +1377,25 @@ struct nsConstructorFuncMapData
 };
 
 #define NS_DEFINE_CONSTRUCTOR_FUNC_DATA(_class, _func)                        \
   { eDOMClassInfo_##_class##_id, _func },
 
 static const nsConstructorFuncMapData kConstructorFuncMap[] =
 {
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Worker, nsDOMWorker::NewWorker)
+#ifdef MOZ_ENABLE_CANVAS3D
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLFloatArray, NS_NewCanvasFloatArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLByteArray, NS_NewCanvasByteArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLUnsignedByteArray, NS_NewCanvasUnsignedByteArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLShortArray, NS_NewCanvasShortArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLUnsignedShortArray, NS_NewCanvasUnsignedShortArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLIntArray, NS_NewCanvasIntArray)
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebGLUnsignedIntArray, NS_NewCanvasUnsignedIntArray)
+#endif
 };
 
 nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull;
 nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nsnull;
 PRBool nsDOMClassInfo::sIsInitialized = PR_FALSE;
 PRBool nsDOMClassInfo::sDisableDocumentAllSupport = PR_FALSE;
 PRBool nsDOMClassInfo::sDisableGlobalScopePollutionSupport = PR_FALSE;
 
@@ -3653,26 +3669,38 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(WebGLRenderbuffer, nsIWebGLRenderbuffer)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLRenderbuffer)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(WebGLFloatArray, nsIWebGLFloatArray)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLFloatArray)
   DOM_CLASSINFO_MAP_END
 
+  DOM_CLASSINFO_MAP_BEGIN(WebGLByteArray, nsIWebGLByteArray)
+    DOM_CLASSINFO_MAP_ENTRY(nsIWebGLByteArray)
+  DOM_CLASSINFO_MAP_END
+
+  DOM_CLASSINFO_MAP_BEGIN(WebGLUnsignedByteArray, nsIWebGLUnsignedByteArray)
+    DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUnsignedByteArray)
+  DOM_CLASSINFO_MAP_END
+
   DOM_CLASSINFO_MAP_BEGIN(WebGLShortArray, nsIWebGLShortArray)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLShortArray)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(WebGLUnsignedShortArray, nsIWebGLUnsignedShortArray)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUnsignedShortArray)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(WebGLUnsignedByteArray, nsIWebGLUnsignedByteArray)
-    DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUnsignedByteArray)
+  DOM_CLASSINFO_MAP_BEGIN(WebGLIntArray, nsIWebGLIntArray)
+    DOM_CLASSINFO_MAP_ENTRY(nsIWebGLIntArray)
+  DOM_CLASSINFO_MAP_END
+
+  DOM_CLASSINFO_MAP_BEGIN(WebGLUnsignedIntArray, nsIWebGLUnsignedIntArray)
+    DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUnsignedIntArray)
   DOM_CLASSINFO_MAP_END
 #endif
 
 #ifdef NS_DEBUG
   {
     PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData);
 
     if (i != eDOMClassInfoIDCount) {
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -468,19 +468,22 @@ enum nsDOMClassInfoID {
   eDOMClassInfo_WebGLBuffer_id,
   eDOMClassInfo_WebGLTexture_id,
   eDOMClassInfo_WebGLProgram_id,
   eDOMClassInfo_WebGLShader_id,
   eDOMClassInfo_WebGLFramebuffer_id,
   eDOMClassInfo_WebGLRenderbuffer_id,
 
   eDOMClassInfo_WebGLFloatArray_id,
+  eDOMClassInfo_WebGLByteArray_id,
+  eDOMClassInfo_WebGLUnsignedByteArray_id,
   eDOMClassInfo_WebGLShortArray_id,
   eDOMClassInfo_WebGLUnsignedShortArray_id,
-  eDOMClassInfo_WebGLUnsignedByteArray_id,
+  eDOMClassInfo_WebGLIntArray_id,
+  eDOMClassInfo_WebGLUnsignedIntArray_id,
 #endif
 
   // This one better be the last one in this list
   eDOMClassInfoIDCount
 };
 
 /**
  * nsIClassInfo helper macros
--- a/dom/interfaces/canvas/nsICanvasRenderingContextWebGL.idl
+++ b/dom/interfaces/canvas/nsICanvasRenderingContextWebGL.idl
@@ -61,44 +61,59 @@ typedef long           GLfixed;
 //typedef unsigned long  GLintptr;
 //typedef unsigned long  GLsizeiptr;
 
 //
 // Array types
 //
 
 [scriptable, uuid(84ba4e98-8173-7c10-dca0-b5ba7809fcf3)]
-interface nsIWebGLNumberArray : nsISupports
+interface nsIWebGLArray : nsISupports
 {
   attribute unsigned long length;
 
   [noscript, notxpcom] unsigned long nativeType();
   [noscript, notxpcom] voidPtr nativePointer();
   [noscript, notxpcom] unsigned long nativeSize();
   [noscript, notxpcom] unsigned long nativeElementSize();
   [noscript, notxpcom] unsigned long nativeCount();
 };
 
 [scriptable, Uuid(0f6d0e7b-bcfc-9305-6a1d-a9653b5e8c80)]
-interface nsIWebGLFloatArray : nsIWebGLNumberArray
+interface nsIWebGLFloatArray : nsIWebGLArray
+{
+};
+
+[scriptable, uuid(b29db7cf-fa58-435f-8d45-611cc50979ad)]
+interface nsIWebGLByteArray : nsIWebGLArray
+{
+};
+
+[scriptable, uuid(3daa67fa-e743-2cbd-a212-805c2fc520cc)]
+interface nsIWebGLUnsignedByteArray : nsIWebGLArray
 {
 };
 
 [scriptable, uuid(a8a982e3-3977-7364-f012-c497a5ab7681)]
-interface nsIWebGLShortArray : nsIWebGLNumberArray
+interface nsIWebGLShortArray : nsIWebGLArray
 {
 };
 
 [scriptable, uuid(8b9c67cc-c7be-a062-84b0-76a910a5c1e6)]
-interface nsIWebGLUnsignedShortArray : nsIWebGLNumberArray
+interface nsIWebGLUnsignedShortArray : nsIWebGLArray
 {
 };
 
-[scriptable, uuid(3daa67fa-e743-2cbd-a212-805c2fc520cc)]
-interface nsIWebGLUnsignedByteArray : nsIWebGLNumberArray
+[scriptable, uuid(b9b2e861-3a28-4311-993c-799e4f77dcba)]
+interface nsIWebGLIntArray : nsIWebGLArray
+{
+};
+
+[scriptable, uuid(0d6ee3f8-71b6-460d-b05a-d579cc55edbe)]
+interface nsIWebGLUnsignedIntArray : nsIWebGLArray
 {
 };
 
 //
 // OpenGL object wrappers
 //
 
 [scriptable, uuid(3b43762a-8305-11de-98ab-000c29206271)]
@@ -120,39 +135,56 @@ interface nsIWebGLProgram : nsISupports
 };
 
 [scriptable, uuid(ac7440a4-8305-11de-807b-000c29206271)]
 interface nsIWebGLShader : nsISupports
 {
   [noscript] attribute GLuint name;
 };
 
+[scriptable, uuid(beea4b38-3094-4e8d-b6e6-8b21d07e8994)]
+interface nsIWebGLShaderArray {
+    readonly attribute unsigned long length;
+    nsIWebGLShader item(in unsigned long index);
+};
+
 [scriptable, uuid(bce8be60-8305-11de-9f3c-000c29206271)]
 interface nsIWebGLFramebuffer : nsISupports
 {
   [noscript] attribute GLuint name;
 };
 
 [scriptable, uuid(c82eacd0-8305-11de-9de9-000c29206271)]
 interface nsIWebGLRenderbuffer : nsISupports
 {
   [noscript] attribute GLuint name;
 };
 
+[scriptable, uuid(a85d4fd0-5b9f-4cb8-aeee-5a2c5c5bad76)]
+interface nsIWebGLActiveInfo {
+    readonly attribute GLint size;
+    readonly attribute GLenum type;
+    readonly attribute DOMString name;
+};
+
+
 [scriptable, uuid(f02c85e0-8305-11de-abe2-000c29206271)]
 interface nsICanvasRenderingContextWebGL : nsISupports
 {
   //
   //  ARRAY CONSTRUCTORS
   //
 
   nsIWebGLFloatArray createFloatArray();
+  nsIWebGLByteArray createByteArray();
+  nsIWebGLUnsignedByteArray createUnsignedByteArray();
   nsIWebGLShortArray createShortArray();
   nsIWebGLUnsignedShortArray createUnsignedShortArray();
-  nsIWebGLUnsignedByteArray createUnsignedByteArray();
+  nsIWebGLIntArray createIntArray();
+  nsIWebGLUnsignedIntArray createUnsignedIntArray();
 
   //
   //  CONSTANTS
   //
 
   /* ClearBufferMask */
   const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;
   const unsigned long STENCIL_BUFFER_BIT             = 0x00000400;
@@ -575,57 +607,72 @@ interface nsICanvasRenderingContextWebGL
   const unsigned long MAX_RENDERBUFFER_SIZE          = 0x84E8;
 
   const unsigned long INVALID_FRAMEBUFFER_OPERATION  = 0x0506;
 
   //
   //  ATTRIBUTES
   //
   readonly attribute nsIDOMHTMLCanvasElement canvas;
+  readonly attribute nsIWebGLBuffer currentArrayBufferBinding;
+  readonly attribute nsIWebGLBuffer currentElementArrayBufferBinding;
+  readonly attribute nsIWebGLFramebuffer currentFramebufferBinding;
+  readonly attribute nsIWebGLRenderbuffer currentRenderbufferBinding;
+  readonly attribute nsIWebGLTexture currentTextureBinding2D;
+  readonly attribute nsIWebGLTexture currentTextureBindingCubeMap;
+  readonly attribute nsIWebGLProgram currentProgram;
 
   //
   //  METHODS
   //
+  void present();
 
   void activeTexture (in GLenum texture);
   void attachShader (in nsIWebGLProgram program, in nsIWebGLShader shader);
   void bindAttribLocation (in nsIWebGLProgram program, in GLuint index, in DOMString name);
   void bindBuffer (in GLenum target, in nsIWebGLBuffer buffer);
   void bindFramebuffer (in GLenum target, in nsIWebGLFramebuffer framebuffer);
   void bindRenderbuffer (in GLenum target, in nsIWebGLRenderbuffer renderbuffer);
   void bindTexture (in GLenum target, in nsIWebGLTexture texture);
   void blendColor (in GLclampf red, in GLclampf green, in GLclampf blue, in GLclampf alpha);
   void blendEquation (in GLenum mode);
   void blendEquationSeparate (in GLenum modeRGB, in GLenum modeAlpha);
   void blendFunc (in GLenum sfactor, in GLenum dfactor);
   void blendFuncSeparate (in GLenum srcRGB, in GLenum dstRGB, in GLenum srcAlpha, in GLenum dstAlpha);
 
   // Modified: void glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
-  void bufferData (in GLenum target, in nsIWebGLNumberArray data, in GLenum usage);
+  // void bufferData (in GLenum target, in GLsizei size, in GLenum usage);
+  void bufferData (in GLenum target, in nsIWebGLArray data, in GLenum usage);
 
   // Modified: void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
-  void bufferSubData (in GLenum target, in GLuint offset, in nsIWebGLNumberArray data);
+  void bufferSubData (in GLenum target, in GLuint offset, in nsIWebGLArray data);
 
   GLenum checkFramebufferStatus (in GLenum target);
   void clear (in GLbitfield mask);
   void clearColor (in GLclampf red, in GLclampf green, in GLclampf blue, in GLclampf alpha);
   void clearDepthf (in GLclampf depth);
   void clearStencil (in GLint s);
   void colorMask (in GLboolean red, in GLboolean green, in GLboolean blue, in GLboolean alpha);
   void compileShader (in nsIWebGLShader shader);
 
   //void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
   //void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
 
   void copyTexImage2D (in GLenum target, in GLint level, in GLenum internalformat, 
                          in GLint x, in GLint y, in GLsizei width, in GLsizei height, in GLint border);
   void copyTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
                             in GLint x, in GLint y, in GLsizei width, in GLsizei height);
+
+  nsIWebGLBuffer createBuffer();
   nsIWebGLProgram createProgram ();
+  nsIWebGLFramebuffer createFramebuffer();
+  nsIWebGLRenderbuffer createRenderbuffer();
   nsIWebGLShader createShader (in GLenum type);
+  nsIWebGLTexture createTexture();
+
   void cullFace (in GLenum mode);
 
   // Modified: void glDeleteBuffers (GLsizei n, const GLuint* buffers);
   //ZZ void deleteBuffer (in nsIWebGLBuffer buffer);
   void deleteBuffer (in nsIWebGLBuffer buffer);
 
   // Modified: glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
   //ZZ void deleteFramebuffer (in nsIWebGLFramebuffer framebuffer);
@@ -647,121 +694,126 @@ interface nsICanvasRenderingContextWebGL
   void depthMask (in GLboolean flag);
   void depthRangef (in GLclampf zNear, in GLclampf zFar);
   void detachShader (in nsIWebGLProgram program, in nsIWebGLShader shader);
   void disable (in GLenum cap);
   void disableVertexAttribArray (in GLuint index);
   void drawArrays (in GLenum mode, in GLint first, in GLsizei count);
 
   // Modified: void glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices);
-  // ZZZ something with NumberArray blah
-  void drawElements (in GLenum mode, in GLenum type, in GLuint count, in GLuint offset);
+  void drawElements (in GLenum mode, in GLuint count, in GLenum type, in GLuint offset);
 
   void enable (in GLenum cap);
   void enableVertexAttribArray (in GLuint index);
   void finish ();
   void flush ();
   void framebufferRenderbuffer (in GLenum target, in GLenum attachment, in GLenum renderbuffertarget, 
                                   in nsIWebGLRenderbuffer renderbuffer);
   void framebufferTexture2D (in GLenum target, in GLenum attachment, in GLenum textarget, 
                                in nsIWebGLTexture texture, in GLint level);
   void frontFace (in GLenum mode);
 
   void generateMipmap (in GLenum target);
 
   //ZZ in the spec these are all createBuffer/createFramebuffer/etc.
   // Modified: void glGenBuffers (GLsizei n, GLuint* buffers);
-  nsIWebGLBuffer genBuffer();
+  //nsIWebGLBuffer genBuffer();
   // Modified: void glGenFramebuffers (GLsizei n, GLuint* framebuffers);
-  nsIWebGLFramebuffer genFramebuffer();
+  //nsIWebGLFramebuffer genFramebuffer();
   // Modified: void glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
-  nsIWebGLRenderbuffer genRenderbuffer();
+  //nsIWebGLRenderbuffer genRenderbuffer();
   // Modified: void glGenTextures (GLsizei n, GLuint* textures);
-  nsIWebGLTexture genTexture();
+  //nsIWebGLTexture genTexture();
 
   // TBD
   //void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 
   // GLenum* type, char* name);
-  void getActiveAttrib(in nsIWebGLProgram program, in PRUint32 index);
+  nsIWebGLActiveInfo getActiveAttrib(in nsIWebGLProgram program, in PRUint32 index);
 
   // TBD
   //void glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 
   // GLenum* type, char* name);
-  void getActiveUniform(in nsIWebGLProgram program, in PRUint32 index);
+  nsIWebGLActiveInfo getActiveUniform(in nsIWebGLProgram program, in PRUint32 index);
 
   // TBD
   // void glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+  //nsIWebGLShaderArray glGetAttachedShaders(in GLuint program);
 
   GLint getAttribLocation (in nsIWebGLProgram program, in DOMString name);
 
   // Modified
-  //ZZ nsIWebGLNumberArray glGetBoolean(in GLenum pname);
-  //ZZ nsIWebGLNumberArray glGetFloat(in GLenum pname);
-  //ZZ nsIWebGLNumberArray glGetInteger(in GLenum pname);
+  //GLboolean getBoolean(in GLenum pname);
+  // NOTYET nsIWebGLBooleanArray getBooleanv(in GLenum pname);
+  //GLfloat getFloat(in GLenum pname);
+  //nsIWebGLArray getFloatv(in GLenum pname);
+  //GLint getInteger(in GLenum pname);
+  //nsIWebGLIntArray getIntegerv(in GLenum pname);
   // js only
   void getParameter(in GLenum pname);
 
   // Modified: void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
-  //ZZ nsIWebGLNumberArray glGetBufferParameteri (in GLenum target, in GLenum pname);
-  void getBufferParameter (in GLenum target, in GLenum pname);
+  GLint getBufferParameteri (in GLenum target, in GLenum pname);
+  //nsIWebGLIntArray glGetBufferParameteriv (in GLenum target, in GLenum pname);
 
   GLenum getError ();
 
   // Modified: void glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-  //ZZ nsIWebGLNumberArray glGetFramebufferAttachmentParameteri (in GLenum target, in GLenum attachment, in GLenum pname);
-  void getFramebufferAttachmentParameter (in GLenum target, in GLenum attachment, in GLenum pname);
+  GLint getFramebufferAttachmentParameteri (in GLenum target, in GLenum attachment, in GLenum pname);
+  //nsIWebGLIntArray glGetFramebufferAttachmentParameteriv (in GLenum target, in GLenum attachment, in GLenum pname);
 
   // Modified: void glGetProgramiv (nsIWebGLProgram program, GLenum pname, GLint* params);
-  //ZZ nsIWebGLNumberArray glGetProgrami (in nsIWebGLProgram program, in GLenum pname);
-  void getProgramParameter (in nsIWebGLProgram program, in GLenum pname);
+  GLint getProgrami (in nsIWebGLProgram program, in GLenum pname);
+  //nsIWebGLIntArray getProgramiv (in nsIWebGLProgram program, in GLenum pname);
+  //void getProgramParameter (in nsIWebGLProgram program, in GLenum pname);
 
   // Modified: void glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
   DOMString getProgramInfoLog (in nsIWebGLProgram program);
 
   // Modified: void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
-  //ZZ nsIWebGLNumberArray glGetRenderbufferParameteri (in GLenum target, in GLenum pname);
-  void getRenderbufferParameter (in GLenum target, in GLenum pname);
+  //nsIWebGLIntArray getRenderbufferParameteriv (in GLenum target, in GLenum pname);
+  GLint getRenderbufferParameteri (in GLenum target, in GLenum pname);
 
-  // Modified: void glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
-  //ZZ nsIWebGLNumberArray glGetShaderi (in nsIWebGLShader shader, in GLenum pname);
-  void getShaderParameter (in nsIWebGLShader shader, in GLenum pname);
+  GLint getShaderi (in nsIWebGLShader shader, in GLenum pname);
+  nsIWebGLIntArray getShaderiv (in nsIWebGLShader shader, in GLenum pname);
+  // GONE void getShaderParameter (in nsIWebGLShader shader, in GLenum pname);
 
   // Modified: void glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
   DOMString getShaderInfoLog (in nsIWebGLShader shader);
 
   // TBD
   //void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
 
   DOMString getShaderSource (in nsIWebGLShader shader);
   DOMString getString (in GLenum name);
 
-  // Modified
-  //ZZ nsIWebGLNumberArray glGetTexParameterf (in GLenum target, in GLenum pname);
-  //ZZ nsIWebGLNumberArray glGetTexParameteri (in GLenum target, in GLenum pname);
-  void getTexParameter(in GLenum target, in GLenum pname);
+  GLfloat getTexParameterf (in GLenum target, in GLenum pname);
+  nsIWebGLArray getTexParameterfv (in GLenum target, in GLenum pname);
+  GLint getTexParameteri (in GLenum target, in GLenum pname);
+  nsIWebGLArray getTexParameteriv (in GLenum target, in GLenum pname);
 
-  // Modified: This replaces glGetUniformfv and glGetUniformiv
-  //
   // FIXME: This is problematic. We don't implicitly know how big the returned data buffer
   // needs to be like in the other glGet* calls. The only way to find out is to iterate 
   // through all the active uniforms with glGetActiveUniform() looking for the corresponding
   // 'location'. This will give us the type and size of the data. Since this is a get call
   // maybe that's ok?
-  //ZZ nsIWebGLNumberArray glGetUniformf (in nsIWebGLProgram program, in GLint location);
-  //ZZ nsIWebGLNumberArray glGetUniformi (in nsIWebGLProgram program, in GLint location);
-  void getUniform (in nsIWebGLProgram program, in GLint location);
+  GLfloat getUniformf (in nsIWebGLProgram program, in GLint location);
+  nsIWebGLArray getUniformfv (in nsIWebGLProgram program, in GLint location);
+  GLint getUniformi (in nsIWebGLProgram program, in GLint location);
+  nsIWebGLArray getUniformiv (in nsIWebGLProgram program, in GLint location);
 
   GLint getUniformLocation (in nsIWebGLProgram program, in DOMString name);
 
-  // Modified: This replaces glGetVertexAttribfv and glGetVertexAttribiv
-  //ZZ nsIWebGLNumberArray glGetVertexAttribf (in GLuint index, in GLenum pname);
-  void getVertexAttrib (in GLuint index, in GLenum pname);
+  GLfloat getVertexAttribf (in GLuint index, in GLenum pname);
+  nsIWebGLArray getVertexAttribfv (in GLuint index, in GLenum pname);
+  GLint getVertexAttribi (in GLuint index, in GLenum pname);
+  nsIWebGLArray getVertexAttribiv (in GLuint index, in GLenum pname);
 
   // TBD
   // void glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer);
+  GLuint getVertexAttribOffset(in GLuint index, in GLenum pname);
 
   void hint (in GLenum target, in GLenum mode);
 
   GLboolean isBuffer (in nsIWebGLBuffer buffer);
   GLboolean isFramebuffer (in nsIWebGLFramebuffer framebuffer);
   GLboolean isProgram (in nsIWebGLProgram program);
   GLboolean isRenderbuffer (in nsIWebGLRenderbuffer renderbuffer);
   GLboolean isShader (in nsIWebGLShader shader);
@@ -790,95 +842,76 @@ interface nsICanvasRenderingContextWebGL
   void stencilFuncSeparate (in GLenum face, in GLenum func, in GLint ref, in GLuint mask);
   void stencilMask (in GLuint mask);
   void stencilMaskSeparate (in GLenum face, in GLuint mask);
   void stencilOp (in GLenum fail, in GLenum zfail, in GLenum zpass);
   void stencilOpSeparate (in GLenum face, in GLenum fail, in GLenum zfail, in GLenum zpass);
 
   // Modified: glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, 
   // GLint border, GLenum format, GLenum type, const void* pixels);
-  //void glTexImage2D (in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, nsIWebGLNumberArray pixels);
+  //void glTexImage2D (in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, nsIWebGLArray pixels);
   //void glTexImage2D (in GLenum target, in GLint level, in HTMLImageElement image);
   //void glTexImage2D (in GLenum target, in GLint level, in HTMLnsIWebGLElement canvas);
   //void glTexImage2D (in GLenum target, in GLint level, in HTMLVideoElement video);
   void texImage2D ();
 
 
   // Modified: This replaces glTexParameterf, glTexParameterfv, glTexParameteri and glTexParameteriv
-  //void glTexParameter (in GLenum target, in GLenum pname, in GLfloat param);
-  //void glTexParameter (in GLenum target, in GLenum pname, in GLint param);
-  //void glTexParameter (in GLenum target, in GLenum pname, in nsIWebGLNumberArray params);
-  void texParameter ();
+  void texParameterf (in GLenum target, in GLenum pname, in GLfloat param);
+  void texParameteri (in GLenum target, in GLenum pname, in GLint param);
+  //void glTexParameter (in GLenum target, in GLenum pname, in nsIWebGLArray params);
 
   // Modified: void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
-  //void glTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in GLenum format, in GLenum type, nsIWebGLNumberArray pixels);
+  //void glTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in GLenum format, in GLenum type, nsIWebGLArray pixels);
   //void glTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in HTMLImageElement image);
   //void glTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in HTMLnsIWebGLElement canvas);
   //void glTexSubImage2D (in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in HTMLVideoElement video);
 
   void texSubImage2D ();
 
-  // Modified: All the glUniform*v forms below are modified by replacing 'count' and 'v' with a nsIWebGLNumberArray
+  // Modified: All the glUniform*v forms below are modified by replacing 'count' and 'v' with a nsIWebGLArray
   void uniform1f (in GLint location, in GLfloat x);
   void uniform1i (in GLint location, in GLint x);
   void uniform2f (in GLint location, in GLfloat x, in GLfloat y);
   void uniform2i (in GLint location, in GLint x, in GLint y);
   void uniform3f (in GLint location, in GLfloat x, in GLfloat y, in GLfloat z);
   void uniform3i (in GLint location, in GLint x, in GLint y, in GLint z);
   void uniform4f (in GLint location, in GLfloat x, in GLfloat y, in GLfloat z, in GLfloat w);
   void uniform4i (in GLint location, in GLint x, in GLint y, in GLint z, in GLint w);
 
-  //XX void glUniform1fv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform1iv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform2fv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform2iv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform3fv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform3iv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform4fv (in GLint location, in nsIWebGLNumberArray v);
-  //XX void glUniform4iv (in GLint location, in nsIWebGLNumberArray v);
+  void uniform1fv (in GLint location, in nsIWebGLArray v);
+  void uniform1iv (in GLint location, in nsIWebGLArray v);
+  void uniform2fv (in GLint location, in nsIWebGLArray v);
+  void uniform2iv (in GLint location, in nsIWebGLArray v);
+  void uniform3fv (in GLint location, in nsIWebGLArray v);
+  void uniform3iv (in GLint location, in nsIWebGLArray v);
+  void uniform4fv (in GLint location, in nsIWebGLArray v);
+  void uniform4iv (in GLint location, in nsIWebGLArray v);
 
-  void uniform1fv ();
-  void uniform1iv ();
-  void uniform2fv ();
-  void uniform2iv ();
-  void uniform3fv ();
-  void uniform3iv ();
-  void uniform4fv ();
-  void uniform4iv ();
-
-  // Modified. These are modified by replacing 'count' and 'value' with a nsIWebGLNumberArray
-  //XX void glUniformMatrix2fv (in GLint location, in GLboolean transpose, in nsIWebGLNumberArray value);
-  //XX void glUniformMatrix3fv (in GLint location, in GLboolean transpose, in nsIWebGLNumberArray value);
-  //XX void glUniformMatrix4fv (in GLint location, in GLboolean transpose, in nsIWebGLNumberArray value);
-
-  void uniformMatrix2fv ();
-  void uniformMatrix3fv ();
-  void uniformMatrix4fv ();
+  // Modified. These are modified by replacing 'count' and 'value' with a nsIWebGLArray
+  void uniformMatrix2fv (in GLint location, in GLboolean transpose, in nsIWebGLArray value);
+  void uniformMatrix3fv (in GLint location, in GLboolean transpose, in nsIWebGLArray value);
+  void uniformMatrix4fv (in GLint location, in GLboolean transpose, in nsIWebGLArray value);
 
   // Added API using top entry from the passed nsIWebGLMatrixStack
   //ZZ void glUniformMatrix (in GLint location, in GLboolean 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 nsIWebGLNumberArray
+  // Modified: All the glVertexAttrib*v forms below are modified by replacing 'values' with a nsIWebGLArray
   void vertexAttrib1f (in GLuint indx, in GLfloat x);
   void vertexAttrib2f (in GLuint indx, in GLfloat x, in GLfloat y);
   void vertexAttrib3f (in GLuint indx, in GLfloat x, in GLfloat y, in GLfloat z);
   void vertexAttrib4f (in GLuint indx, in GLfloat x, in GLfloat y, in GLfloat z, in GLfloat w);
 
-  //XX void glVertexAttrib1fv (in GLuint indx, in nsIWebGLNumberArray values);
-  //XX void glVertexAttrib2fv (in GLuint indx, in nsIWebGLNumberArray values);
-  //XX void glVertexAttrib3fv (in GLuint indx, in nsIWebGLNumberArray values);
-  //XX void glVertexAttrib4fv (in GLuint indx, in nsIWebGLNumberArray values);
-
-  void vertexAttrib1fv ();
-  void vertexAttrib2fv ();
-  void vertexAttrib3fv ();
-  void vertexAttrib4fv ();
+  void vertexAttrib1fv (in GLuint indx, in nsIWebGLArray values);
+  void vertexAttrib2fv (in GLuint indx, in nsIWebGLArray values);
+  void vertexAttrib3fv (in GLuint indx, in nsIWebGLArray values);
+  void vertexAttrib4fv (in GLuint indx, in nsIWebGLArray values);
 
   // TBD
   //void glVertexAttribPointer (in GLuint indx, GLint size, GLenum type, GLboolean normalized, 
   // GLsizei stride, const void* ptr);
 
   // size is number of elements; type must match the bound vbo type; offset is in elements
   void vertexAttribPointer (in GLuint idx, in GLint size, in GLenum type, in GLboolean normalized, in GLuint stride, in GLuint offset);