Bug 776243 - Unpref WebGL context bindings; r=peterv
authorMs2ger <ms2ger@gmail.com>
Thu, 20 Sep 2012 09:55:36 +0200
changeset 107588 f6778c068c0352e8ee58bf8870eb48a28dd723eb
parent 107587 075745deb9a88e96e8290fd20af30f2788117ea9
child 107589 0c97d9b38576fc9b8f4eb34782f84a904ada6fde
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerspeterv
bugs776243
milestone18.0a1
Bug 776243 - Unpref WebGL context bindings; r=peterv
content/canvas/src/CustomQS_WebGL.h
content/canvas/src/Makefile.in
content/canvas/src/WebGLContext.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextNotSupported.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
js/xpconnect/src/dom_quickstubs.qsconf
deleted file mode 100644
--- a/content/canvas/src/CustomQS_WebGL.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 4; tab-width: 40; indent-tabs-mode: nil; -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Intended to be #included in dom_quickstubs.cpp via qsconf!
- */
-
-#include "jsapi.h"
-#include "jsfriendapi.h"
-#include "CustomQS_Canvas.h"
-
-#define GET_INT32_ARG(var, index) \
-  int32_t var; \
-  do { \
-    if (!JS_ValueToECMAInt32(cx, argv[index], &(var))) \
-      return JS_FALSE; \
-  } while (0)
-
-#define GET_UINT32_ARG(var, index) \
-  uint32_t var; \
-  do { \
-    if (!JS_ValueToECMAUint32(cx, argv[index], &(var))) \
-      return JS_FALSE; \
-  } while (0)
-
-class CallTexImage2D
-{
-private:
-    nsIDOMWebGLRenderingContext* self;
-    WebGLenum target;
-    WebGLint level;
-    WebGLenum internalformat;
-    WebGLenum format;
-    WebGLenum type;
-
-public:
-    explicit CallTexImage2D(nsIDOMWebGLRenderingContext* aSelf,
-                            WebGLenum aTarget,
-                            WebGLint aLevel,
-                            WebGLenum aInternalformat,
-                            WebGLenum aFormat,
-                            WebGLenum aType)
-        : self(aSelf)
-        , target(aTarget)
-        , level(aLevel)
-        , internalformat(aInternalformat)
-        , format(aFormat)
-        , type(aType)
-    {}
-
-    nsresult DoCallForImageData(WebGLsizei width, WebGLsizei height,
-                                JSObject* pixels, JSContext *cx)
-    {
-        return self->TexImage2D_imageData(target, level, internalformat, width,
-                                          height, 0, format, type, pixels, cx);
-    }
-    nsresult DoCallForElement(mozilla::dom::Element* elt)
-    {
-        return self->TexImage2D_dom(target, level, internalformat, format, type,
-                                    elt);
-    }
-};
-
-class CallTexSubImage2D
-{
-private:
-    nsIDOMWebGLRenderingContext* self;
-    WebGLenum target;
-    WebGLint level;
-    WebGLint xoffset;
-    WebGLint yoffset;
-    WebGLenum format;
-    WebGLenum type;
-
-public:
-    explicit CallTexSubImage2D(nsIDOMWebGLRenderingContext* aSelf,
-                               WebGLenum aTarget,
-                               WebGLint aLevel,
-                               WebGLint aXoffset,
-                               WebGLint aYoffset,
-                               WebGLenum aFormat,
-                               WebGLenum aType)
-
-        : self(aSelf)
-        , target(aTarget)
-        , level(aLevel)
-        , xoffset(aXoffset)
-        , yoffset(aYoffset)
-        , format(aFormat)
-        , type(aType)
-    {}
-
-    nsresult DoCallForImageData(WebGLsizei width, WebGLsizei height,
-                                JSObject* pixels, JSContext *cx)
-    {
-        return self->TexSubImage2D_imageData(target, level, xoffset, yoffset,
-                                             width, height, format, type,
-                                             pixels, cx);
-    }
-    nsresult DoCallForElement(mozilla::dom::Element* elt)
-    {
-        return self->TexSubImage2D_dom(target, level, xoffset, yoffset, format,
-                                       type, elt);
-    }
-};
-
-template<class T>
-static bool
-TexImage2DImageDataOrElement(JSContext* cx, T& self, JS::Value* object)
-{
-    MOZ_ASSERT(object && object->isObject());
-
-    nsGenericElement* elt;
-    xpc_qsSelfRef eltRef;
-    if (NS_SUCCEEDED(xpc_qsUnwrapArg<nsGenericElement>(
-            cx, *object, &elt, &eltRef.ptr, object))) {
-        nsresult rv = self.DoCallForElement(elt);
-        return NS_SUCCEEDED(rv) || xpc_qsThrow(cx, rv);
-    }
-
-    // Failed to interpret object as an Element, now try to interpret it as
-    // ImageData.
-    uint32_t int_width, int_height;
-    JS::Anchor<JSObject*> obj_data;
-    if (!GetImageData(cx, *object, &int_width, &int_height, &obj_data)) {
-        return false;
-    }
-    if (!JS_IsTypedArrayObject(obj_data.get(), cx)) {
-        return xpc_qsThrow(cx, NS_ERROR_FAILURE);
-    }
-
-    nsresult rv = self.DoCallForImageData(int_width, int_height, obj_data.get(), cx);
-    return NS_SUCCEEDED(rv) || xpc_qsThrow(cx, rv);
-}
-
-/*
- * TexImage2D takes:
- *    TexImage2D(uint, int, uint, int, int, int, uint, uint, ArrayBufferView)
- *    TexImage2D(uint, int, uint, uint, uint, nsIDOMElement)
- *    TexImage2D(uint, int, uint, uint, uint, ImageData)
- */
-static JSBool
-nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, unsigned argc, jsval *vp)
-{
-    XPC_QS_ASSERT_CONTEXT_OK(cx);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    nsresult rv;
-
-    nsIDOMWebGLRenderingContext *self;
-    xpc_qsSelfRef selfref;
-    JS::AutoValueRooter tvr(cx);
-    if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nullptr))
-        return JS_FALSE;
-
-    if (argc < 6 || argc == 7 || argc == 8)
-        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-
-    JS::Value* argv = JS_ARGV(cx, vp);
-
-    // arguments common to all cases
-    GET_UINT32_ARG(argv0, 0);
-    GET_INT32_ARG(argv1, 1);
-    GET_UINT32_ARG(argv2, 2);
-
-    if (argc > 5 && argv[5].isObject()) {
-        // implement the variants taking a DOMElement as argv[5]
-        GET_UINT32_ARG(argv3, 3);
-        GET_UINT32_ARG(argv4, 4);
-
-        CallTexImage2D selfCaller(self, argv0, argv1, argv2, argv3, argv4);
-        if (!TexImage2DImageDataOrElement(cx, selfCaller, argv + 5)) {
-            return false;
-        }
-        rv = NS_OK;
-    } else if (argc > 8 && argv[8].isObjectOrNull()) {
-        // here, we allow null !
-        // implement the variants taking a buffer/array as argv[8]
-        GET_INT32_ARG(argv3, 3);
-        GET_INT32_ARG(argv4, 4);
-        GET_INT32_ARG(argv5, 5);
-        GET_UINT32_ARG(argv6, 6);
-        GET_UINT32_ARG(argv7, 7);
-
-        JSObject* argv8 = argv[8].toObjectOrNull();
-
-        // then try to grab either a js::TypedArray, or null
-        if (argv8 == nullptr) {
-            rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
-                                        argv4, argv5, argv6, argv7,
-                                        nullptr, cx);
-        } else if (JS_IsTypedArrayObject(argv8, cx)) {
-            rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
-                                        argv4, argv5, argv6, argv7,
-                                        argv8, cx);
-        } else {
-            xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
-            return JS_FALSE;
-        }
-    } else {
-        xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-        return JS_FALSE;
-    }
-
-    if (NS_FAILED(rv))
-        return xpc_qsThrowMethodFailed(cx, rv, vp);
-
-    *vp = JSVAL_VOID;
-    return JS_TRUE;
-}
-
-/* TexSubImage2D takes:
- *    TexSubImage2D(uint, int, int, int, int, int, uint, uint, ArrayBufferView)
- *    TexSubImage2D(uint, int, int, int, uint, uint, nsIDOMElement)
- *    TexSubImage2D(uint, int, int, int, uint, uint, ImageData)
- */
-static JSBool
-nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, unsigned argc, jsval *vp)
-{
-    XPC_QS_ASSERT_CONTEXT_OK(cx);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    nsresult rv;
-
-    nsIDOMWebGLRenderingContext *self;
-    xpc_qsSelfRef selfref;
-    JS::AutoValueRooter tvr(cx);
-    if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nullptr))
-        return JS_FALSE;
-
-    if (argc < 7 || argc == 8)
-        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-
-    jsval *argv = JS_ARGV(cx, vp);
-
-    // arguments common to all cases
-    GET_UINT32_ARG(argv0, 0);
-    GET_INT32_ARG(argv1, 1);
-    GET_INT32_ARG(argv2, 2);
-    GET_INT32_ARG(argv3, 3);
-
-    if (argc > 6 && !JSVAL_IS_PRIMITIVE(argv[6])) {
-        // implement the variants taking a DOMElement or an ImageData as argv[6]
-        GET_UINT32_ARG(argv4, 4);
-        GET_UINT32_ARG(argv5, 5);
-
-        CallTexSubImage2D selfCaller(self, argv0, argv1, argv2, argv3, argv4, argv5);
-        if (!TexImage2DImageDataOrElement(cx, selfCaller, argv + 6)) {
-            return false;
-        }
-        rv = NS_OK;
-    } else if (argc > 8 && !JSVAL_IS_PRIMITIVE(argv[8])) {
-        // implement the variants taking a buffer/array as argv[8]
-        GET_INT32_ARG(argv4, 4);
-        GET_INT32_ARG(argv5, 5);
-        GET_UINT32_ARG(argv6, 6);
-        GET_UINT32_ARG(argv7, 7);
-
-        JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]);
-        // try to grab a js::TypedArray
-        if (JS_IsTypedArrayObject(argv8, cx)) {
-            rv = self->TexSubImage2D_array(argv0, argv1, argv2, argv3,
-                                           argv4, argv5, argv6, argv7,
-                                           argv8, cx);
-        } else {
-            xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
-            return JS_FALSE;
-        }
-    } else {
-        xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
-        return JS_FALSE;
-    }
-
-    if (NS_FAILED(rv))
-        return xpc_qsThrowMethodFailed(cx, rv, vp);
-
-    *vp = JSVAL_VOID;
-    return JS_TRUE;
-}
--- a/content/canvas/src/Makefile.in
+++ b/content/canvas/src/Makefile.in
@@ -14,17 +14,16 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= content
 LIBRARY_NAME	= gkconcvs_s
 LIBXUL_LIBRARY  = 1
 
 EXPORTS = \
 	CustomQS_Canvas.h \
 	CustomQS_Canvas2D.h \
-	CustomQS_WebGL.h \
 	WebGLContext.h \
 	$(NULL)
 
 EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
   ImageData.h \
   $(NULL)
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -261,25 +261,16 @@ WebGLContext::Invalidate()
         return;
 
     nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
 
     mInvalidated = true;
     mCanvasElement->InvalidateCanvasContent(nullptr);
 }
 
-/* readonly attribute nsIDOMHTMLCanvasElement canvas; */
-NS_IMETHODIMP
-WebGLContext::GetCanvas(nsIDOMHTMLCanvasElement **canvas)
-{
-    NS_IF_ADDREF(*canvas = mCanvasElement);
-
-    return NS_OK;
-}
-
 //
 // nsICanvasRenderingContextInternal
 //
 
 static bool
 GetBoolFromPropertyBag(nsIPropertyBag *bag, const char *propName, bool *boolResult)
 {
     nsCOMPtr<nsIVariant> vv;
@@ -867,28 +858,16 @@ WebGLContext::GetCanvasLayer(nsDisplayLi
     canvasLayer->SetContentFlags(flags);
     canvasLayer->Updated();
 
     mResetLayer = false;
 
     return canvasLayer.forget().get();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetContextAttributes(jsval *aResult)
-{
-    ErrorResult rv;
-    JSObject* obj = GetContextAttributes(rv);
-    if (rv.Failed())
-        return rv.ErrorCode();
-
-    *aResult = JS::ObjectOrNullValue(obj);
-    return NS_OK;
-}
-
 JSObject*
 WebGLContext::GetContextAttributes(ErrorResult &rv)
 {
     if (!IsContextStable())
     {
         return NULL;
     }
 
@@ -998,24 +977,16 @@ bool WebGLContext::IsExtensionSupported(
             break;
         default:
             MOZ_ASSERT(false, "should not get there.");
     }
 
     return isSupported;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
-{
-    *retval = GetExtension(aName);
-    NS_IF_ADDREF(*retval);
-    return NS_OK;
-}
-
 nsIWebGLExtension*
 WebGLContext::GetExtension(const nsAString& aName)
 {
     if (!IsContextStable())
         return nullptr;
 
     if (mDisableExtensions) {
         return nullptr;
@@ -1190,18 +1161,17 @@ WebGLContext::EnsureBackbufferClearedAsN
                                            nsIntRect(0, 0, mWidth, mHeight));
 
     Invalidate();
 }
 
 void
 WebGLContext::DummyFramebufferOperation(const char *info)
 {
-    WebGLenum status;
-    CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER, &status);
+    WebGLenum status = CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
     if (status == LOCAL_GL_FRAMEBUFFER_COMPLETE)
         return;
     else
         return ErrorInvalidFramebufferOperation("%s: incomplete framebuffer", info);
 }
 
 // We use this timer for many things. Here are the things that it is activated for:
 // 1) If a script is using the MOZ_WEBGL_lose_context extension.
@@ -1371,29 +1341,26 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(We
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WebGLContext)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mCanvasElement, nsINode)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mExtensions)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-DOMCI_DATA(WebGLRenderingContext, WebGLContext)
-
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIDOMWebGLRenderingContext)
   NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
   // If the exact way we cast to nsISupports here ever changes, fix our
   // PreCreate hook!
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports,
                                    nsICanvasRenderingContextInternal)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(WebGLBuffer)
 NS_IMPL_RELEASE(WebGLBuffer)
 
 DOMCI_DATA(WebGLBuffer, WebGLBuffer)
 
 NS_INTERFACE_MAP_BEGIN(WebGLBuffer)
@@ -1520,32 +1487,16 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtension)
 NS_INTERFACE_MAP_END 
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLExtension)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLExtension)
 
 DOMCI_DATA(WebGLExtension, WebGLExtension)
 
-/* readonly attribute WebGLsizei drawingBufferWidth; */
-NS_IMETHODIMP
-WebGLContext::GetDrawingBufferWidth(WebGLsizei *aWidth)
-{
-    *aWidth = DrawingBufferWidth();
-    return NS_OK;
-}
-
-/* readonly attribute WebGLsizei drawingBufferHeight; */
-NS_IMETHODIMP
-WebGLContext::GetDrawingBufferHeight(WebGLsizei *aHeight)
-{
-    *aHeight = DrawingBufferHeight();
-    return NS_OK;
-}
-
 /* [noscript] attribute WebGLint location; */
 NS_IMETHODIMP
 WebGLUniformLocation::GetLocation(WebGLint *aLocation)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
@@ -1597,54 +1548,16 @@ WebGLShaderPrecisionFormat::GetRangeMax(
 /* readonly attribute WebGLint precision */
 NS_IMETHODIMP
 WebGLShaderPrecisionFormat::GetPrecision(WebGLint *aPrecision)
 {
     *aPrecision = mPrecision;
     return NS_OK;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetSupportedExtensions(nsIVariant **retval)
-{
-    Nullable< nsTArray<nsString> > extensions;
-    GetSupportedExtensions(extensions);
-
-    if (extensions.IsNull()) {
-        *retval = nullptr;
-        return NS_OK;
-    }
-
-    nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
-    NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
-
-    const nsTArray<nsString>& extList = extensions.Value();
-
-    nsresult rv;
-    if (extList.Length() > 0) {
-        // nsIVariant can't handle SetAsArray with the AString or
-        // DOMString type, so we have to spoon-feed it something it
-        // knows how to handle.
-        nsTArray<const PRUnichar*> exts(extList.Length());
-        for (uint32_t i = 0; i < extList.Length(); ++i) {
-            exts.AppendElement(extList[i].get());
-        }
-        rv = wrval->SetAsArray(nsIDataType::VTYPE_WCHAR_STR, nullptr,
-                               exts.Length(), exts.Elements());
-    } else {
-        rv = wrval->SetAsEmptyArray();
-    }
-    if (NS_FAILED(rv))
-        return rv;
-
-    *retval = wrval.forget().get();
-    return NS_OK;
-
-}
-
 void
 WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
 {
     retval.SetNull();
     if (!IsContextStable())
         return;
     
     if (mDisableExtensions) {
@@ -1663,15 +1576,8 @@ WebGLContext::GetSupportedExtensions(Nul
     }
     if (IsExtensionSupported(WEBGL_lose_context))
         arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
     if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
         arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
     if (IsExtensionSupported(WEBGL_depth_texture))
         arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"));
 }
-
-NS_IMETHODIMP
-WebGLContext::IsContextLost(WebGLboolean *retval)
-{
-    *retval = mContextStatus != ContextStable;
-    return NS_OK;
-}
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -461,16 +461,24 @@ class WebGLContext :
 {
     friend class WebGLMemoryMultiReporterWrapper;
     friend class WebGLExtensionLoseContext;
     friend class WebGLExtensionCompressedTextureS3TC;
     friend class WebGLContextUserData;
     friend class WebGLMemoryPressureObserver;
     friend class WebGLExtensionDepthTexture;
 
+    enum {
+        UNPACK_FLIP_Y_WEBGL = 0x9240,
+        UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
+        CONTEXT_LOST_WEBGL = 0x9242,
+        UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,
+        BROWSER_DEFAULT_WEBGL = 0x9244
+    };
+
 public:
     WebGLContext();
     virtual ~WebGLContext();
 
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext,
                                                            nsIDOMWebGLRenderingContext)
@@ -2992,18 +3000,17 @@ public:
         const WebGLRectangleObject *rect = mColorAttachment.RectangleObject();
         if (!rect ||
             !rect->Width() ||
             !rect->Height())
             return false;
 
         mContext->MakeContextCurrent();
 
-        WebGLenum status;
-        mContext->CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER, &status);
+        WebGLenum status = mContext->CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
         if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE)
             return false;
 
         uint32_t mask = 0;
 
         if (mColorAttachment.HasUninitializedRenderbuffer())
             mask |= LOCAL_GL_COLOR_BUFFER_BIT;
 
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -31,64 +31,21 @@
 #include "mozilla/dom/BindingUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 static bool BaseTypeAndSizeFromUniformType(WebGLenum uType, WebGLenum *baseType, WebGLint *unitSize);
 static WebGLenum InternalFormatForFormatAndType(WebGLenum format, WebGLenum type, bool isGLES2);
 
-/* Helper macros for when we're just wrapping a gl method, so that
- * we can avoid having to type this 500 times.  Note that these MUST
- * NOT BE USED if we need to check any of the parameters.
- */
-
-#define GL_SAME_METHOD_0(glname, name)                               \
-NS_IMETHODIMP WebGLContext::Moz##name() {                            \
-    name();                                                          \
-    return NS_OK;                                                    \
-}
-
-#define GL_SAME_METHOD_1(glname, name, t1)                           \
-NS_IMETHODIMP WebGLContext::Moz##name(t1 a1) {                       \
-    name(a1);                                                        \
-    return NS_OK;                                                    \
-}
-
-#define GL_SAME_METHOD_2(glname, name, t1, t2)                       \
-NS_IMETHODIMP WebGLContext::Moz##name(t1 a1, t2 a2) {                \
-    name(a1, a2);                                                    \
-    return NS_OK;                                                    \
-}
-
-#define GL_SAME_METHOD_3(glname, name, t1, t2, t3)                   \
-NS_IMETHODIMP WebGLContext::Moz##name(t1 a1, t2 a2, t3 a3) {         \
-    name(a1, a2, a3);                                                \
-    return NS_OK;                                                    \
-}
-
-#define GL_SAME_METHOD_4(glname, name, t1, t2, t3, t4)               \
-NS_IMETHODIMP WebGLContext::Moz##name(t1 a1, t2 a2, t3 a3, t4 a4) {  \
-    name(a1, a2, a3, a4);                                            \
-    return NS_OK;                                                    \
-}
-
 //
 //  WebGL API
 //
 
 
-/* void GlActiveTexture (in GLenum texture); */
-NS_IMETHODIMP
-WebGLContext::MozActiveTexture(WebGLenum texture)
-{
-    ActiveTexture(texture);
-    return NS_OK;
-}
-
 void
 WebGLContext::ActiveTexture(WebGLenum texture)
 {
     if (!IsContextStable())
         return;
 
     if (texture < LOCAL_GL_TEXTURE0 ||
         texture >= LOCAL_GL_TEXTURE0 + uint32_t(mGLMaxTextureUnits))
@@ -100,24 +57,16 @@ WebGLContext::ActiveTexture(WebGLenum te
             texture, mGLMaxTextureUnits);
     }
 
     MakeContextCurrent();
     mActiveTexture = texture - LOCAL_GL_TEXTURE0;
     gl->fActiveTexture(texture);
 }
 
-NS_IMETHODIMP
-WebGLContext::AttachShader(nsIWebGLProgram *pobj, nsIWebGLShader *shobj)
-{
-    AttachShader(static_cast<WebGLProgram*>(pobj),
-                 static_cast<WebGLShader*>(shobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::AttachShader(WebGLProgram *program, WebGLShader *shader)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("attachShader: program", program) ||
         !ValidateObject("attachShader: shader", shader))
@@ -129,23 +78,16 @@ WebGLContext::AttachShader(WebGLProgram 
     if (program->HasAttachedShaderOfType(shader->ShaderType()))
         return ErrorInvalidOperation("attachShader: only one of each type of shader may be attached to a program");
 
     if (!program->AttachShader(shader))
         return ErrorInvalidOperation("attachShader: shader is already attached");
 }
 
 
-NS_IMETHODIMP
-WebGLContext::BindAttribLocation(nsIWebGLProgram *pobj, WebGLuint location, const nsAString& name)
-{
-    BindAttribLocation(static_cast<WebGLProgram*>(pobj), location, name);
-    return NS_OK;
-}
-
 void
 WebGLContext::BindAttribLocation(WebGLProgram *prog, WebGLuint location,
                                  const nsAString& name)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("bindAttribLocation: program", prog))
@@ -162,23 +104,16 @@ WebGLContext::BindAttribLocation(WebGLPr
     NS_LossyConvertUTF16toASCII cname(name);
     nsCString mappedName;
     prog->MapIdentifier(cname, &mappedName);
     
     MakeContextCurrent();
     gl->fBindAttribLocation(progname, location, mappedName.get());
 }
 
-NS_IMETHODIMP
-WebGLContext::BindBuffer(WebGLenum target, nsIWebGLBuffer *bobj)
-{
-    BindBuffer(target, static_cast<WebGLBuffer*>(bobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::BindBuffer(WebGLenum target, WebGLBuffer *buf)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("bindBuffer", buf))
         return;
@@ -210,23 +145,16 @@ WebGLContext::BindBuffer(WebGLenum targe
         mBoundElementArrayBuffer = buf;
     }
 
     MakeContextCurrent();
 
     gl->fBindBuffer(target, bufname);
 }
 
-NS_IMETHODIMP
-WebGLContext::BindFramebuffer(WebGLenum target, nsIWebGLFramebuffer *fbobj)
-{
-    BindFramebuffer(target, static_cast<WebGLFramebuffer*>(fbobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::BindFramebuffer(WebGLenum target, WebGLFramebuffer *wfb)
 {
     if (!IsContextStable())
         return;
 
     if (target != LOCAL_GL_FRAMEBUFFER)
         return ErrorInvalidEnum("bindFramebuffer: target must be GL_FRAMEBUFFER");
@@ -246,23 +174,16 @@ WebGLContext::BindFramebuffer(WebGLenum 
         WebGLuint framebuffername = wfb->GLName();
         gl->fBindFramebuffer(target, framebuffername);
         wfb->SetHasEverBeenBound(true);
     }
 
     mBoundFramebuffer = wfb;
 }
 
-NS_IMETHODIMP
-WebGLContext::BindRenderbuffer(WebGLenum target, nsIWebGLRenderbuffer *rbobj)
-{
-    BindRenderbuffer(target, static_cast<WebGLRenderbuffer*>(rbobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::BindRenderbuffer(WebGLenum target, WebGLRenderbuffer *wrb)
 {
     if (!IsContextStable())
         return;
 
     if (target != LOCAL_GL_RENDERBUFFER)
         return ErrorInvalidEnumInfo("bindRenderbuffer: target", target);
@@ -280,23 +201,16 @@ WebGLContext::BindRenderbuffer(WebGLenum
     MakeContextCurrent();
 
     WebGLuint renderbuffername = wrb ? wrb->GLName() : 0;
     gl->fBindRenderbuffer(target, renderbuffername);
 
     mBoundRenderbuffer = wrb;
 }
 
-NS_IMETHODIMP
-WebGLContext::BindTexture(WebGLenum target, nsIWebGLTexture *tobj)
-{
-    BindTexture(target, static_cast<WebGLTexture*>(tobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::BindTexture(WebGLenum target, WebGLTexture *tex)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("bindTexture", tex))
         return;
@@ -316,85 +230,57 @@ WebGLContext::BindTexture(WebGLenum targ
     MakeContextCurrent();
 
     if (tex)
         tex->Bind(target);
     else
         gl->fBindTexture(target, 0 /* == texturename */);
 }
 
-GL_SAME_METHOD_4(BlendColor, BlendColor, WebGLclampf, WebGLclampf, WebGLclampf, WebGLclampf)
-
-NS_IMETHODIMP WebGLContext::MozBlendEquation(WebGLenum mode)
-{
-    BlendEquation(mode);
-    return NS_OK;
-}
-
 void WebGLContext::BlendEquation(WebGLenum mode)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateBlendEquationEnum(mode, "blendEquation: mode"))
         return;
 
     MakeContextCurrent();
     gl->fBlendEquation(mode);
 }
 
-NS_IMETHODIMP WebGLContext::MozBlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha)
-{
-    BlendEquationSeparate(modeRGB, modeAlpha);
-    return NS_OK;
-}
-
 void WebGLContext::BlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateBlendEquationEnum(modeRGB, "blendEquationSeparate: modeRGB") ||
         !ValidateBlendEquationEnum(modeAlpha, "blendEquationSeparate: modeAlpha"))
         return;
 
     MakeContextCurrent();
     gl->fBlendEquationSeparate(modeRGB, modeAlpha);
 }
 
-NS_IMETHODIMP WebGLContext::MozBlendFunc(WebGLenum sfactor, WebGLenum dfactor)
-{
-    BlendFunc(sfactor, dfactor);
-    return NS_OK;
-}
-
 void WebGLContext::BlendFunc(WebGLenum sfactor, WebGLenum dfactor)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateBlendFuncSrcEnum(sfactor, "blendFunc: sfactor") ||
         !ValidateBlendFuncDstEnum(dfactor, "blendFunc: dfactor"))
         return;
 
     if (!ValidateBlendFuncEnumsCompatibility(sfactor, dfactor, "blendFuncSeparate: srcRGB and dstRGB"))
         return;
 
     MakeContextCurrent();
     gl->fBlendFunc(sfactor, dfactor);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozBlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB,
-                                   WebGLenum srcAlpha, WebGLenum dstAlpha)
-{
-    BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-    return NS_OK;
-}
-
 void
 WebGLContext::BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB,
                                 WebGLenum srcAlpha, WebGLenum dstAlpha)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateBlendFuncSrcEnum(srcRGB, "blendFuncSeparate: srcRGB") ||
@@ -433,55 +319,16 @@ GLenum WebGLContext::CheckedBufferData(G
         UpdateWebGLErrorAndClearGLError(&error);
         return error;
     } else {
         gl->fBufferData(target, size, data, usage);
         return LOCAL_GL_NO_ERROR;
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::BufferData(WebGLenum target, const JS::Value& data, GLenum usage,
-                         JSContext* cx)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    if (data.isNull()) {
-        BufferData(target, static_cast<ArrayBuffer*>(nullptr), usage);
-        return NS_OK;
-    }
-
-    if (data.isObject()) {
-        JSObject& dataObj = data.toObject();
-        if (JS_IsArrayBufferObject(&dataObj, cx)) {
-            ArrayBuffer buf(cx, &dataObj);
-            BufferData(target, &buf, usage);
-            return NS_OK;
-        }
-
-        if (JS_IsTypedArrayObject(&dataObj, cx)) {
-            ArrayBufferView view(cx, &dataObj);
-            BufferData(target, view, usage);
-            return NS_OK;
-        }
-
-        ErrorInvalidValue("bufferData: object passed that is not an "
-                          "ArrayBufferView or ArrayBuffer");
-        return NS_OK;
-    }
-
-    MOZ_ASSERT(data.isPrimitive());
-    int32_t size;
-    // ToInt32 cannot fail for primitives.
-    MOZ_ALWAYS_TRUE(JS_ValueToECMAInt32(cx, data, &size));
-    BufferData(target, WebGLsizeiptr(size), usage);
-    return NS_OK;
-}
-
 void
 WebGLContext::BufferData(WebGLenum target, WebGLsizeiptr size,
                          WebGLenum usage)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
 
@@ -593,47 +440,16 @@ WebGLContext::BufferData(WebGLenum targe
     }
 
     boundBuffer->SetByteLength(data.Length());
     boundBuffer->InvalidateCachedMaxElements();
     if (!boundBuffer->CopyDataIfElementArray(data.Data()))
         return ErrorOutOfMemory("bufferData: out of memory");
 }
 
-NS_IMETHODIMP
-WebGLContext::BufferSubData(WebGLenum target, WebGLintptr offset, const JS::Value& data, JSContext *cx)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    if (data.isNull()) {
-        BufferSubData(target, offset, nullptr);
-        return NS_OK;
-    }
-
-    if (!data.isObject()) {
-        return NS_ERROR_FAILURE;
-    }
-
-    JSObject& dataObj = data.toObject();
-    if (JS_IsArrayBufferObject(&dataObj, cx)) {
-        ArrayBuffer buf(cx, &dataObj);
-        BufferSubData(target, offset, &buf);
-        return NS_OK;
-    }
-
-    if (JS_IsTypedArrayObject(&dataObj, cx)) {
-        ArrayBufferView view(cx, &dataObj);
-        BufferSubData(target, offset, view);
-        return NS_OK;
-    }
-
-    return NS_ERROR_FAILURE;
-}
-
 void
 WebGLContext::BufferSubData(GLenum target, WebGLsizeiptr byteOffset,
                             ArrayBuffer *data)
 {
     if (!IsContextStable())
         return;
 
     if (!data) {
@@ -707,23 +523,16 @@ WebGLContext::BufferSubData(WebGLenum ta
     MakeContextCurrent();
 
     boundBuffer->CopySubDataIfElementArray(byteOffset, data.Length(), data.Data());
     boundBuffer->InvalidateCachedMaxElements();
 
     gl->fBufferSubData(target, byteOffset, data.Length(), data.Data());
 }
 
-NS_IMETHODIMP
-WebGLContext::CheckFramebufferStatus(WebGLenum target, WebGLenum *retval)
-{
-    *retval = CheckFramebufferStatus(target);
-    return NS_OK;
-}
-
 WebGLenum
 WebGLContext::CheckFramebufferStatus(WebGLenum target)
 {
     if (!IsContextStable())
     {
         return LOCAL_GL_FRAMEBUFFER_UNSUPPORTED;
     }
 
@@ -741,23 +550,16 @@ WebGLContext::CheckFramebufferStatus(Web
         return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
     if(mBoundFramebuffer->HasIncompleteAttachment())
         return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
     if(mBoundFramebuffer->HasAttachmentsOfMismatchedDimensions())
         return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
     return gl->fCheckFramebufferStatus(target);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozClear(uint32_t mask)
-{
-    Clear(mask);
-    return NS_OK;
-}
-
 void
 WebGLContext::Clear(WebGLbitfield mask)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
 
@@ -788,81 +590,53 @@ WebGLContext::Clear(WebGLbitfield mask)
 
     if (needClearCallHere) {
         gl->fClear(mask);
         mBackbufferClearingStatus = BackbufferClearingStatus::HasBeenDrawnTo;
         Invalidate();
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozClearColor(WebGLfloat r, WebGLfloat g, WebGLfloat b, WebGLfloat a)
-{
-    ClearColor(r, g, b, a);
-    return NS_OK;
-}
-
 void
 WebGLContext::ClearColor(WebGLclampf r, WebGLclampf g,
                          WebGLclampf b, WebGLclampf a)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
     mColorClearValue[0] = r;
     mColorClearValue[1] = g;
     mColorClearValue[2] = b;
     mColorClearValue[3] = a;
     gl->fClearColor(r, g, b, a);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozClearDepth(WebGLfloat v)
-{
-    ClearDepth(v);
-    return NS_OK;
-}
-
 void
 WebGLContext::ClearDepth(WebGLclampf v)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
     mDepthClearValue = v;
     gl->fClearDepth(v);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozClearStencil(WebGLint v)
-{
-    ClearStencil(v);
-    return NS_OK;
-}
-
 void
 WebGLContext::ClearStencil(WebGLint v)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
     mStencilClearValue = v;
     gl->fClearStencil(v);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboolean a)
-{
-    ColorMask(r, g, b, a);
-    return NS_OK;
-}
-
 void
 WebGLContext::ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboolean a)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
     mColorWriteMask[0] = r;
@@ -955,30 +729,16 @@ WebGLContext::CopyTexSubImage2D_base(Web
         GLint   actual_y_plus_height = clamped(y + height, 0, framebufferHeight);
         GLsizei actual_height  = actual_y_plus_height - actual_y;
         GLint   actual_yoffset = yoffset + actual_y - y;
 
         gl->fCopyTexSubImage2D(target, level, actual_xoffset, actual_yoffset, actual_x, actual_y, actual_width, actual_height);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozCopyTexImage2D(WebGLenum target,
-                                WebGLint level,
-                                WebGLenum internalformat,
-                                WebGLint x,
-                                WebGLint y,
-                                WebGLsizei width,
-                                WebGLsizei height,
-                                WebGLint border)
-{
-    CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-    return NS_OK;
-}
-
 void
 WebGLContext::CopyTexImage2D(WebGLenum target,
                              WebGLint level,
                              WebGLenum internalformat,
                              WebGLint x,
                              WebGLint y,
                              WebGLsizei width,
                              WebGLsizei height,
@@ -1078,30 +838,16 @@ WebGLContext::CopyTexImage2D(WebGLenum t
         }          
     } else {
         CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
     }
     
     tex->SetImageInfo(target, level, width, height, internalformat, type);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozCopyTexSubImage2D(WebGLenum target,
-                                   WebGLint level,
-                                   WebGLint xoffset,
-                                   WebGLint yoffset,
-                                   WebGLint x,
-                                   WebGLint y,
-                                   WebGLsizei width,
-                                   WebGLsizei height)
-{
-    CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-    return NS_OK;
-}
-
 void
 WebGLContext::CopyTexSubImage2D(WebGLenum target,
                                 WebGLint level,
                                 WebGLint xoffset,
                                 WebGLint yoffset,
                                 WebGLint x,
                                 WebGLint y,
                                 WebGLsizei width,
@@ -1172,39 +918,25 @@ WebGLContext::CopyTexSubImage2D(WebGLenu
     if (mBoundFramebuffer)
         if (!mBoundFramebuffer->CheckAndInitializeRenderbuffers())
             return ErrorInvalidFramebufferOperation("copyTexSubImage2D: incomplete framebuffer");
 
     return CopyTexSubImage2D_base(target, level, format, xoffset, yoffset, x, y, width, height, true);
 }
 
 
-NS_IMETHODIMP
-WebGLContext::CreateProgram(nsIWebGLProgram **retval)
-{
-    *retval = CreateProgram().get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLProgram>
 WebGLContext::CreateProgram()
 {
     if (!IsContextStable())
         return nullptr;
     nsRefPtr<WebGLProgram> globj = new WebGLProgram(this);
     return globj.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::CreateShader(WebGLenum type, nsIWebGLShader **retval)
-{
-    *retval = CreateShader(type).get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLShader>
 WebGLContext::CreateShader(WebGLenum type)
 {
     if (!IsContextStable())
         return nullptr;
 
     if (type != LOCAL_GL_VERTEX_SHADER &&
         type != LOCAL_GL_FRAGMENT_SHADER)
@@ -1212,43 +944,29 @@ WebGLContext::CreateShader(WebGLenum typ
         ErrorInvalidEnumInfo("createShader: type", type);
         return nullptr;
     }
 
     nsRefPtr<WebGLShader> shader = new WebGLShader(this, type);
     return shader.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozCullFace(WebGLenum face)
-{
-    CullFace(face);
-    return NS_OK;
-}
-
 void
 WebGLContext::CullFace(WebGLenum face)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateFaceEnum(face, "cullFace"))
         return;
 
     MakeContextCurrent();
     gl->fCullFace(face);
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteBuffer(nsIWebGLBuffer *bobj)
-{
-    DeleteBuffer(static_cast<WebGLBuffer*>(bobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteBuffer(WebGLBuffer *buf)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteBuffer", buf))
         return;
@@ -1266,23 +984,16 @@ WebGLContext::DeleteBuffer(WebGLBuffer *
     for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
         if (mAttribBuffers[i].buf == buf)
             mAttribBuffers[i].buf = nullptr;
     }
 
     buf->RequestDelete();
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteFramebuffer(nsIWebGLFramebuffer *fbobj)
-{
-    DeleteFramebuffer(static_cast<WebGLFramebuffer*>(fbobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteFramebuffer(WebGLFramebuffer* fbuf)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteFramebuffer", fbuf))
         return;
@@ -1292,23 +1003,16 @@ WebGLContext::DeleteFramebuffer(WebGLFra
 
     fbuf->RequestDelete();
 
     if (mBoundFramebuffer == fbuf)
         BindFramebuffer(LOCAL_GL_FRAMEBUFFER,
                         static_cast<WebGLFramebuffer*>(nullptr));
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteRenderbuffer(nsIWebGLRenderbuffer *rbobj)
-{
-    DeleteRenderbuffer(static_cast<WebGLRenderbuffer*>(rbobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteRenderbuffer(WebGLRenderbuffer *rbuf)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteRenderbuffer", rbuf))
         return;
@@ -1321,23 +1025,16 @@ WebGLContext::DeleteRenderbuffer(WebGLRe
 
     if (mBoundRenderbuffer == rbuf)
         BindRenderbuffer(LOCAL_GL_RENDERBUFFER,
                          static_cast<WebGLRenderbuffer*>(nullptr));
 
     rbuf->RequestDelete();
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteTexture(nsIWebGLTexture *tobj)
-{
-    DeleteTexture(static_cast<WebGLTexture*>(tobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteTexture(WebGLTexture *tex)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteTexture", tex))
         return;
@@ -1356,149 +1053,99 @@ WebGLContext::DeleteTexture(WebGLTexture
             BindTexture(tex->Target(), static_cast<WebGLTexture*>(nullptr));
         }
     }
     ActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
 
     tex->RequestDelete();
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteProgram(nsIWebGLProgram *pobj)
-{
-    DeleteProgram(static_cast<WebGLProgram*>(pobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteProgram(WebGLProgram *prog)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteProgram", prog))
         return;
 
     if (!prog || prog->IsDeleted())
         return;
 
     prog->RequestDelete();
 }
 
-NS_IMETHODIMP
-WebGLContext::DeleteShader(nsIWebGLShader *sobj)
-{
-    DeleteShader(static_cast<WebGLShader*>(sobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DeleteShader(WebGLShader *shader)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowDeletedOrNull("deleteShader", shader))
         return;
 
     if (!shader || shader->IsDeleted())
         return;
 
     shader->RequestDelete();
 }
 
-NS_IMETHODIMP
-WebGLContext::DetachShader(nsIWebGLProgram *pobj, nsIWebGLShader *shobj)
-{
-    DetachShader(static_cast<WebGLProgram*>(pobj),
-                 static_cast<WebGLShader*>(shobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::DetachShader(WebGLProgram *program, WebGLShader *shader)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("detachShader: program", program) ||
         // it's valid to attempt to detach a deleted shader, since it's
         // still a shader
         !ValidateObjectAllowDeleted("detashShader: shader", shader))
         return;
 
     if (!program->DetachShader(shader))
         return ErrorInvalidOperation("detachShader: shader is not attached");
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDepthFunc(WebGLenum func)
-{
-    DepthFunc(func);
-    return NS_OK;
-}
-
 void
 WebGLContext::DepthFunc(WebGLenum func)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateComparisonEnum(func, "depthFunc"))
         return;
 
     MakeContextCurrent();
     gl->fDepthFunc(func);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDepthMask(WebGLboolean b)
-{
-    DepthMask(b);
-    return NS_OK;
-}
-
 void
 WebGLContext::DepthMask(WebGLboolean b)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
     mDepthWriteMask = b;
     gl->fDepthMask(b);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDepthRange(WebGLclampf zNear, WebGLclampf zFar)
-{
-    DepthRange(zNear, zFar);
-    return NS_OK;
-}
-
 void
 WebGLContext::DepthRange(WebGLfloat zNear, WebGLfloat zFar)
 {
     if (!IsContextStable())
         return;
 
     if (zNear > zFar)
         return ErrorInvalidOperation("depthRange: the near value is greater than the far value!");
 
     MakeContextCurrent();
     gl->fDepthRange(zNear, zFar);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDisableVertexAttribArray(WebGLuint index)
-{
-    DisableVertexAttribArray(index);
-    return NS_OK;
-}
-
 void
 WebGLContext::DisableVertexAttribArray(WebGLuint index)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
 
     if (!ValidateAttribIndex(index, "disableVertexAttribArray"))
@@ -1726,23 +1373,16 @@ WebGLContext::UnbindFakeBlackTextures()
             gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
             gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBoundCubeMapTextures[i]->GLName());
         }
     }
 
     gl->fActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
-{
-    DrawArrays(mode, first, count);
-    return NS_OK;
-}
-
 void
 WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateDrawModeEnum(mode, "drawArrays: mode"))
         return;
@@ -1792,23 +1432,16 @@ WebGLContext::DrawArrays(GLenum mode, We
 
     UndoFakeVertexAttrib0();
     UnbindFakeBlackTextures();
 
     mBackbufferClearingStatus = BackbufferClearingStatus::HasBeenDrawnTo;
     Invalidate();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozDrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, WebGLintptr byteOffset)
-{
-    DrawElements(mode, count, type, byteOffset);
-    return NS_OK;
-}
-
 void
 WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type,
                            WebGLintptr byteOffset)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateDrawModeEnum(mode, "drawElements: mode"))
@@ -1909,22 +1542,16 @@ WebGLContext::DrawElements(WebGLenum mod
 
     UndoFakeVertexAttrib0();
     UnbindFakeBlackTextures();
 
     mBackbufferClearingStatus = BackbufferClearingStatus::HasBeenDrawnTo;
     Invalidate();
 }
 
-NS_IMETHODIMP WebGLContext::MozEnable(WebGLenum cap)
-{
-    Enable(cap);
-    return NS_OK;
-}
-
 void
 WebGLContext::Enable(WebGLenum cap)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateCapabilityEnum(cap, "enable"))
         return;
@@ -1937,22 +1564,16 @@ WebGLContext::Enable(WebGLenum cap)
             mDitherEnabled = 1;
             break;
     }
 
     MakeContextCurrent();
     gl->fEnable(cap);
 }
 
-NS_IMETHODIMP WebGLContext::MozDisable(WebGLenum cap)
-{
-    Disable(cap);
-    return NS_OK;
-}
-
 void
 WebGLContext::Disable(WebGLenum cap)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateCapabilityEnum(cap, "disable"))
         return;
@@ -1965,98 +1586,60 @@ WebGLContext::Disable(WebGLenum cap)
             mDitherEnabled = 0;
             break;
     }
 
     MakeContextCurrent();
     gl->fDisable(cap);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozEnableVertexAttribArray(WebGLuint index)
-{
-    EnableVertexAttribArray(index);
-    return NS_OK;
-}
-
 void
 WebGLContext::EnableVertexAttribArray(WebGLuint index)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
 
     if (!ValidateAttribIndex(index, "enableVertexAttribArray"))
         return;
 
     MakeContextCurrent();
 
     gl->fEnableVertexAttribArray(index);
     mAttribBuffers[index].enabled = true;
 }
 
-NS_IMETHODIMP
-WebGLContext::FramebufferRenderbuffer(WebGLenum target, WebGLenum attachment, WebGLenum rbtarget, nsIWebGLRenderbuffer *rbobj)
-{
-    FramebufferRenderbuffer(target, attachment, rbtarget,
-                            static_cast<WebGLRenderbuffer*>(rbobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::FramebufferRenderbuffer(WebGLenum target, WebGLenum attachment, WebGLenum rbtarget, WebGLRenderbuffer *wrb)
 {
     if (!IsContextStable())
         return;
 
     if (!mBoundFramebuffer)
         return ErrorInvalidOperation("framebufferRenderbuffer: cannot modify framebuffer 0");
 
     return mBoundFramebuffer->FramebufferRenderbuffer(target, attachment, rbtarget, wrb);
 }
 
-NS_IMETHODIMP
-WebGLContext::FramebufferTexture2D(WebGLenum target,
-                                   WebGLenum attachment,
-                                   WebGLenum textarget,
-                                   nsIWebGLTexture *tobj,
-                                   WebGLint level)
-{
-    FramebufferTexture2D(target, attachment, textarget,
-                         static_cast<WebGLTexture*>(tobj), level);
-    return NS_OK;
-}
-
 void
 WebGLContext::FramebufferTexture2D(WebGLenum target,
                                    WebGLenum attachment,
                                    WebGLenum textarget,
                                    WebGLTexture *tobj,
                                    WebGLint level)
 {
     if (!IsContextStable())
         return;
 
     if (mBoundFramebuffer)
         return mBoundFramebuffer->FramebufferTexture2D(target, attachment, textarget, tobj, level);
     else
         return ErrorInvalidOperation("framebufferTexture2D: cannot modify framebuffer 0");
 }
 
-GL_SAME_METHOD_0(Flush, Flush)
-
-GL_SAME_METHOD_0(Finish, Finish)
-
-NS_IMETHODIMP
-WebGLContext::MozFrontFace(WebGLenum mode)
-{
-    FrontFace(mode);
-    return NS_OK;
-}
-
 void
 WebGLContext::FrontFace(WebGLenum mode)
 {
     if (!IsContextStable())
         return;
 
     switch (mode) {
         case LOCAL_GL_CW:
@@ -2065,24 +1648,16 @@ WebGLContext::FrontFace(WebGLenum mode)
         default:
             return ErrorInvalidEnumInfo("frontFace: mode", mode);
     }
 
     MakeContextCurrent();
     gl->fFrontFace(mode);
 }
 
-// returns an object: { size: ..., type: ..., name: ... }
-NS_IMETHODIMP
-WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, uint32_t index, nsIWebGLActiveInfo **retval)
-{
-    *retval = GetActiveAttrib(static_cast<WebGLProgram*>(pobj), index).get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLActiveInfo>
 WebGLContext::GetActiveAttrib(WebGLProgram *prog, uint32_t index)
 {
     if (!IsContextStable())
         return nullptr;
 
     if (!ValidateObject("getActiveAttrib: program", prog))
         return nullptr;
@@ -2107,23 +1682,16 @@ WebGLContext::GetActiveAttrib(WebGLProgr
     nsCString reverseMappedName;
     prog->ReverseMapIdentifier(nsDependentCString(name), &reverseMappedName);
 
     nsRefPtr<WebGLActiveInfo> retActiveInfo =
         new WebGLActiveInfo(attrsize, attrtype, reverseMappedName);
     return retActiveInfo.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozGenerateMipmap(WebGLenum target)
-{
-    GenerateMipmap(target);
-    return NS_OK;
-}
-
 void
 WebGLContext::GenerateMipmap(WebGLenum target)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateTextureTargetEnum(target, "generateMipmap"))
         return;
@@ -2165,23 +1733,16 @@ WebGLContext::GenerateMipmap(WebGLenum t
         gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST_MIPMAP_NEAREST);
         gl->fGenerateMipmap(target);
         gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter());
     } else {
         gl->fGenerateMipmap(target);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, uint32_t index, nsIWebGLActiveInfo **retval)
-{
-    *retval = GetActiveUniform(static_cast<WebGLProgram*>(pobj), index).get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLActiveInfo>
 WebGLContext::GetActiveUniform(WebGLProgram *prog, uint32_t index)
 {
     if (!IsContextStable())
         return nullptr;
 
     if (!ValidateObject("getActiveUniform: program", prog))
         return nullptr;
@@ -2223,47 +1784,16 @@ WebGLContext::GetActiveUniform(WebGLProg
     if (usize > 1 && reverseMappedName.CharAt(reverseMappedName.Length()-1) != ']')
         reverseMappedName.AppendLiteral("[0]");
 
     nsRefPtr<WebGLActiveInfo> retActiveInfo =
         new WebGLActiveInfo(usize, utype, reverseMappedName);
     return retActiveInfo.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetAttachedShaders(nsIWebGLProgram *pobj, nsIVariant **retval)
-{
-    Nullable< nsTArray<WebGLShader*> > arr;
-    GetAttachedShaders(static_cast<WebGLProgram*>(pobj), arr);
-    if (arr.IsNull()) {
-        *retval = nullptr;
-        return NS_OK;
-    }
-
-    nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
-    NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
-
-    if (arr.Value().IsEmpty()) {
-        wrval->SetAsEmptyArray();
-    } else {
-        wrval->SetAsArray(nsIDataType::VTYPE_INTERFACE,
-                          &NS_GET_IID(nsIWebGLShader),
-                          arr.Value().Length(),
-                          const_cast<void*>( // @#$% SetAsArray doesn't accept a const void*
-                              static_cast<const void*>(
-                                  arr.Value().Elements()
-                              )
-                          )
-                          );
-    }
-
-    wrval.forget(retval);
-    return NS_OK;
-}
-
 void
 WebGLContext::GetAttachedShaders(WebGLProgram *prog,
                                  Nullable< nsTArray<WebGLShader*> > &retval)
 {
     retval.SetNull();
     if (!IsContextStable())
         return;
 
@@ -2277,25 +1807,16 @@ WebGLContext::GetAttachedShaders(WebGLPr
         ErrorInvalidValue("getAttachedShaders: invalid program");
     } else if (prog->AttachedShaders().Length() == 0) {
         retval.SetValue().TruncateLength(0);
     } else {
         retval.SetValue().AppendElements(prog->AttachedShaders());
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::GetAttribLocation(nsIWebGLProgram *pobj,
-                                const nsAString& name,
-                                WebGLint *retval)
-{
-    *retval = GetAttribLocation(static_cast<WebGLProgram*>(pobj), name);
-    return NS_OK;
-}
-
 WebGLint
 WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name)
 {
     if (!IsContextStable())
         return -1;
 
     if (!ValidateObject("getAttribLocation: program", prog))
         return -1;
@@ -2308,27 +1829,16 @@ WebGLContext::GetAttribLocation(WebGLPro
     prog->MapIdentifier(cname, &mappedName);
 
     WebGLuint progname = prog->GLName();
 
     MakeContextCurrent();
     return gl->fGetAttribLocation(progname, mappedName.get());
 }
 
-NS_IMETHODIMP
-WebGLContext::GetParameter(uint32_t pname, JSContext* cx, JS::Value *retval)
-{
-    ErrorResult rv;
-    JS::Value v = GetParameter(cx, pname, rv);
-    if (rv.Failed())
-        return rv.ErrorCode();
-    *retval = v;
-    return NS_OK;
-}
-
 static JS::Value
 StringValue(JSContext* cx, const char* chars, ErrorResult& rv)
 {
     JSString* str = JS_NewStringCopyZ(cx, chars);
     if (!str) {
         rv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return JS::NullValue();
     }
@@ -2691,23 +2201,16 @@ WebGLContext::GetParameter(JSContext* cx
 
         default:
             ErrorInvalidEnumInfo("getParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetBufferParameter(WebGLenum target, WebGLenum pname, JS::Value *retval)
-{
-    *retval = GetBufferParameter(target, pname);
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetBufferParameter(WebGLenum target, WebGLenum pname)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (target != LOCAL_GL_ARRAY_BUFFER && target != LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         ErrorInvalidEnumInfo("getBufferParameter: target", target);
@@ -2733,28 +2236,16 @@ WebGLContext::GetBufferParameter(WebGLen
 
         default:
             ErrorInvalidEnumInfo("getBufferParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetFramebufferAttachmentParameter(WebGLenum target, WebGLenum attachment, WebGLenum pname, JSContext* cx, JS::Value *retval)
-{
-    ErrorResult rv;
-    JS::Value v =
-        GetFramebufferAttachmentParameter(cx, target, attachment, pname, rv);
-    if (rv.Failed())
-        return rv.ErrorCode();
-    *retval = v;
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
                                                 WebGLenum target,
                                                 WebGLenum attachment,
                                                 WebGLenum pname,
                                                 ErrorResult& rv)
 {
     if (!IsContextStable())
@@ -2842,23 +2333,16 @@ WebGLContext::GetFramebufferAttachmentPa
                 ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
                 return JS::NullValue();
         }
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetRenderbufferParameter(WebGLenum target, WebGLenum pname, JS::Value *retval)
-{
-    *retval = GetRenderbufferParameter(target, pname);
-    return NS_OK;    
-}
-
 JS::Value
 WebGLContext::GetRenderbufferParameter(WebGLenum target, WebGLenum pname)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (target != LOCAL_GL_RENDERBUFFER) {
         ErrorInvalidEnumInfo("getRenderbufferParameter: target", target);
@@ -2892,78 +2376,50 @@ WebGLContext::GetRenderbufferParameter(W
         }
         default:
             ErrorInvalidEnumInfo("getRenderbufferParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::CreateBuffer(nsIWebGLBuffer **retval)
-{
-    *retval = CreateBuffer().get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLBuffer>
 WebGLContext::CreateBuffer()
 {
     if (!IsContextStable())
         return nullptr;
     nsRefPtr<WebGLBuffer> globj = new WebGLBuffer(this);
     return globj.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::CreateTexture(nsIWebGLTexture **retval)
-{
-    *retval = CreateTexture().get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLTexture>
 WebGLContext::CreateTexture()
 {
     if (!IsContextStable())
         return nullptr;
     nsRefPtr<WebGLTexture> globj = new WebGLTexture(this);
     return globj.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozGetError(WebGLenum *_retval)
-{
-    *_retval = GetError();
-    return NS_OK;
-}
-
 WebGLenum
 WebGLContext::GetError()
 {
     if (mContextStatus == ContextStable) {
         MakeContextCurrent();
         UpdateWebGLErrorAndClearGLError();
     } else if (!mContextLostErrorSet) {
         mWebGLError = LOCAL_GL_CONTEXT_LOST;
         mContextLostErrorSet = true;
     }
 
     WebGLenum err = mWebGLError;
     mWebGLError = LOCAL_GL_NO_ERROR;
     return err;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetProgramParameter(nsIWebGLProgram *pobj, uint32_t pname, JS::Value *retval)
-{
-    *retval = GetProgramParameter(static_cast<WebGLProgram*>(pobj), pname);
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetProgramParameter(WebGLProgram *prog, WebGLenum pname)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog))
         return JS::NullValue();
@@ -3005,23 +2461,16 @@ WebGLContext::GetProgramParameter(WebGLP
 
         default:
             ErrorInvalidEnumInfo("getProgramParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetProgramInfoLog(nsIWebGLProgram *pobj, nsAString& retval)
-{
-    GetProgramInfoLog(static_cast<WebGLProgram*>(pobj), retval);
-    return NS_OK;
-}
-
 void
 WebGLContext::GetProgramInfoLog(WebGLProgram *prog, nsAString& retval)
 {
     nsAutoCString s;
     GetProgramInfoLog(prog, s);
     if (s.IsVoid())
         retval.SetIsVoid(true);
     else
@@ -3170,37 +2619,16 @@ void WebGLContext::TexParameter_base(Web
 
     MakeContextCurrent();
     if (intParamPtr)
         gl->fTexParameteri(target, pname, intParam);
     else
         gl->fTexParameterf(target, pname, floatParam);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozTexParameterf(WebGLenum target, WebGLenum pname, WebGLfloat param)
-{
-    TexParameterf(target, pname, param);
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-WebGLContext::MozTexParameteri(WebGLenum target, WebGLenum pname, WebGLint param)
-{
-    TexParameteri(target, pname, param);
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname, JS::Value *retval)
-{
-    *retval = GetTexParameter(target, pname);
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     MakeContextCurrent();
 
@@ -3235,30 +2663,16 @@ WebGLContext::GetTexParameter(WebGLenum 
 
         default:
             ErrorInvalidEnumInfo("getTexParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-/* any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException); */
-NS_IMETHODIMP
-WebGLContext::GetUniform(nsIWebGLProgram *pobj, nsIWebGLUniformLocation *ploc,
-                         JSContext *cx, JS::Value *retval)
-{
-    ErrorResult rv;
-    JS::Value v = GetUniform(cx, static_cast<WebGLProgram*>(pobj),
-                             static_cast<WebGLUniformLocation*>(ploc), rv);
-    if (rv.Failed())
-        return rv.ErrorCode();
-    *retval = v;
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
                          WebGLUniformLocation *location, ErrorResult& rv)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (!ValidateObject("getUniform: program", prog))
@@ -3382,23 +2796,16 @@ WebGLContext::GetUniform(JSContext* cx, 
             return JS::ObjectOrNullValue(obj);
         }
     }
 
     // Else preserving behavior, but I'm not sure this is correct per spec
     return JS::UndefinedValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetUniformLocation(nsIWebGLProgram *pobj, const nsAString& name, nsIWebGLUniformLocation **retval)
-{
-    *retval = GetUniformLocation(static_cast<WebGLProgram*>(pobj), name).get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLUniformLocation>
 WebGLContext::GetUniformLocation(WebGLProgram *prog, const nsAString& name)
 {
     if (!IsContextStable())
         return nullptr;
 
     if (!ValidateObject("getUniformLocation: program", prog))
         return nullptr;
@@ -3421,28 +2828,16 @@ WebGLContext::GetUniformLocation(WebGLPr
                                        prog,
                                        intlocation,
                                        info);
         NS_ADDREF(loc);
     }
     return loc;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetVertexAttrib(WebGLuint index, WebGLenum pname, JSContext* cx,
-                              JS::Value *retval)
-{
-    ErrorResult rv;
-    JS::Value v = GetVertexAttrib(cx, index, pname, rv);
-    if (rv.Failed())
-        return rv.ErrorCode();
-    *retval = v;
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetVertexAttrib(JSContext* cx, WebGLuint index, WebGLenum pname,
                               ErrorResult& rv)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (!ValidateAttribIndex(index, "getVertexAttrib"))
@@ -3504,24 +2899,16 @@ WebGLContext::GetVertexAttrib(JSContext*
 
         default:
             ErrorInvalidEnumInfo("getVertexAttrib: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-/* GLuint getVertexAttribOffset (in GLuint index, in GLenum pname); */
-NS_IMETHODIMP
-WebGLContext::GetVertexAttribOffset(WebGLuint index, WebGLenum pname, WebGLuint *retval)
-{
-    *retval = GetVertexAttribOffset(index, pname);
-    return NS_OK;
-}
-
 WebGLsizeiptr
 WebGLContext::GetVertexAttribOffset(WebGLuint index, WebGLenum pname)
 {
     if (!IsContextStable())
         return 0;
 
     if (!ValidateAttribIndex(index, "getVertexAttribOffset"))
         return 0;
@@ -3529,23 +2916,16 @@ WebGLContext::GetVertexAttribOffset(WebG
     if (pname != LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER) {
         ErrorInvalidEnum("getVertexAttribOffset: bad parameter");
         return 0;
     }
 
     return mAttribBuffers[index].byteOffset;
 }
 
-NS_IMETHODIMP
-WebGLContext::MozHint(WebGLenum target, WebGLenum mode)
-{
-    Hint(target, mode);
-    return NS_OK;
-}
-
 void
 WebGLContext::Hint(WebGLenum target, WebGLenum mode)
 {
     if (!IsContextStable())
         return;
 
     bool isValid = false;
 
@@ -3560,150 +2940,92 @@ WebGLContext::Hint(WebGLenum target, Web
     }
 
     if (!isValid)
         return ErrorInvalidEnum("hint: invalid hint");
 
     gl->fHint(target, mode);
 }
 
-NS_IMETHODIMP
-WebGLContext::IsBuffer(nsIWebGLBuffer *bobj, WebGLboolean *retval)
-{
-    *retval = IsBuffer(static_cast<WebGLBuffer*>(bobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsBuffer(WebGLBuffer *buffer)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isBuffer", buffer) &&
         !buffer->IsDeleted() &&
         buffer->HasEverBeenBound();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsFramebuffer(nsIWebGLFramebuffer *fbobj, WebGLboolean *retval)
-{
-    *retval = IsFramebuffer(static_cast<WebGLFramebuffer*>(fbobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsFramebuffer(WebGLFramebuffer *fb)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isFramebuffer", fb) &&
         !fb->IsDeleted() &&
         fb->HasEverBeenBound();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsProgram(nsIWebGLProgram *pobj, WebGLboolean *retval)
-{
-    *retval = IsProgram(static_cast<WebGLProgram*>(pobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsProgram(WebGLProgram *prog)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isProgram", prog) && !prog->IsDeleted();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsRenderbuffer(nsIWebGLRenderbuffer *rbobj, WebGLboolean *retval)
-{
-    *retval = IsRenderbuffer(static_cast<WebGLRenderbuffer*>(rbobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsRenderbuffer(WebGLRenderbuffer *rb)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isRenderBuffer", rb) &&
         !rb->IsDeleted() &&
         rb->HasEverBeenBound();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsShader(nsIWebGLShader *sobj, WebGLboolean *retval)
-{
-    *retval = IsShader(static_cast<WebGLShader*>(sobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsShader(WebGLShader *shader)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isShader", shader) &&
         !shader->IsDeleted();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsTexture(nsIWebGLTexture *tobj, WebGLboolean *retval)
-{
-    *retval = IsTexture(static_cast<WebGLTexture*>(tobj));
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsTexture(WebGLTexture *tex)
 {
     if (!IsContextStable())
         return false;
 
     return ValidateObjectAllowDeleted("isTexture", tex) &&
         !tex->IsDeleted() &&
         tex->HasEverBeenBound();
 }
 
-NS_IMETHODIMP
-WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
-{
-    *retval = IsEnabled(cap);
-    return NS_OK;
-}
-
 bool
 WebGLContext::IsEnabled(WebGLenum cap)
 {
     if (!IsContextStable())
         return false;
 
     if (!ValidateCapabilityEnum(cap, "isEnabled"))
         return false;
 
     MakeContextCurrent();
     return gl->fIsEnabled(cap);
 }
 
-GL_SAME_METHOD_1(LineWidth, LineWidth, WebGLfloat)
-
-NS_IMETHODIMP
-WebGLContext::LinkProgram(nsIWebGLProgram *pobj)
-{
-    LinkProgram(static_cast<WebGLProgram*>(pobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::LinkProgram(WebGLProgram *program)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("linkProgram", program))
@@ -3808,23 +3130,16 @@ WebGLContext::LinkProgram(WebGLProgram *
                     GenerateWarning("linkProgram failed, with this log:\n%s\n",
                                     log.get());
                 }
             }
         }
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozPixelStorei(WebGLenum pname, WebGLint param)
-{
-    PixelStorei(pname, param);
-    return NS_OK;
-}
-
 void
 WebGLContext::PixelStorei(WebGLenum pname, WebGLint param)
 {
     if (!IsContextStable())
         return;
 
     switch (pname) {
         case UNPACK_FLIP_Y_WEBGL:
@@ -3853,36 +3168,16 @@ WebGLContext::PixelStorei(WebGLenum pnam
             MakeContextCurrent();
             gl->fPixelStorei(pname, param);
             break;
         default:
             return ErrorInvalidEnumInfo("pixelStorei: parameter", pname);
     }
 }
 
-GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, WebGLfloat, WebGLfloat)
-
-NS_IMETHODIMP
-WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
-                         WebGLenum format, WebGLenum type, const JS::Value& pixelsVal, JSContext *cx)
-{
-    if (!pixelsVal.isObject()) {
-        return NS_ERROR_FAILURE;
-    }
-
-    if (!JS_IsTypedArrayObject(&pixelsVal.toObject(), cx)) {
-        return NS_ERROR_FAILURE;
-    }
-
-    ArrayBufferView pixels(cx, &pixelsVal.toObject());
-    ErrorResult rv;
-    ReadPixels(x, y, width, height, format, type, &pixels, rv);
-    return rv.ErrorCode();
-}
-
 void
 WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width,
                          WebGLsizei height, WebGLenum format,
                          WebGLenum type, ArrayBufferView* pixels,
                          ErrorResult& rv)
 {
     if (!IsContextStable()) {
         return;
@@ -4095,23 +3390,16 @@ WebGLContext::ReadPixels(WebGLint x, Web
             } else {
                 NS_WARNING("Unhandled case, how'd we get here?");
                 return rv.Throw(NS_ERROR_FAILURE);
             }
         }            
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozRenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height)
-{
-    RenderbufferStorage(target, internalformat, width, height);
-    return NS_OK;
-}
-
 void
 WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height)
 {
     if (!IsContextStable())
         return;
 
     if (!mBoundRenderbuffer || !mBoundRenderbuffer->GLName())
         return ErrorInvalidOperation("renderbufferStorage called on renderbuffer 0");
@@ -4179,45 +3467,29 @@ WebGLContext::RenderbufferStorage(WebGLe
     }
 
     mBoundRenderbuffer->SetInternalFormat(internalformat);
     mBoundRenderbuffer->SetInternalFormatForGL(internalformatForGL);
     mBoundRenderbuffer->setDimensions(width, height);
     mBoundRenderbuffer->SetInitialized(false);
 }
 
-GL_SAME_METHOD_2(SampleCoverage, SampleCoverage, WebGLclampf, WebGLboolean)
-
-NS_IMETHODIMP
-WebGLContext::MozScissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
-{
-    Scissor(x, y, width, height);
-    return NS_OK;
-}
-
 void
 WebGLContext::Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
 {
     if (!IsContextStable())
         return;
 
     if (width < 0 || height < 0)
         return ErrorInvalidValue("scissor: negative size");
 
     MakeContextCurrent();
     gl->fScissor(x, y, width, height);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask)
-{
-    StencilFunc(func, ref, mask);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateComparisonEnum(func, "stencilFunc: func"))
         return;
@@ -4226,23 +3498,16 @@ WebGLContext::StencilFunc(WebGLenum func
     mStencilRefBack = ref;
     mStencilValueMaskFront = mask;
     mStencilValueMaskBack = mask;
 
     MakeContextCurrent();
     gl->fStencilFunc(func, ref, mask);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref, WebGLuint mask)
-{
-    StencilFuncSeparate(face, func, ref, mask);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref, WebGLuint mask)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateFaceEnum(face, "stencilFuncSeparate: face") ||
         !ValidateComparisonEnum(func, "stencilFuncSeparate: func"))
@@ -4264,43 +3529,29 @@ WebGLContext::StencilFuncSeparate(WebGLe
             mStencilValueMaskBack = mask;
             break;
     }
 
     MakeContextCurrent();
     gl->fStencilFuncSeparate(face, func, ref, mask);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilMask(WebGLuint mask)
-{
-    StencilMask(mask);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilMask(WebGLuint mask)
 {
     if (!IsContextStable())
         return;
 
     mStencilWriteMaskFront = mask;
     mStencilWriteMaskBack = mask;
 
     MakeContextCurrent();
     gl->fStencilMask(mask);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilMaskSeparate(WebGLenum face, WebGLuint mask)
-{
-    StencilMaskSeparate(face, mask);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilMaskSeparate(WebGLenum face, WebGLuint mask)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateFaceEnum(face, "stencilMaskSeparate: face"))
         return;
@@ -4317,45 +3568,31 @@ WebGLContext::StencilMaskSeparate(WebGLe
             mStencilWriteMaskBack = mask;
             break;
     }
 
     MakeContextCurrent();
     gl->fStencilMaskSeparate(face, mask);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
-{
-    StencilOp(sfail, dpfail, dppass);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateStencilOpEnum(sfail, "stencilOp: sfail") ||
         !ValidateStencilOpEnum(dpfail, "stencilOp: dpfail") ||
         !ValidateStencilOpEnum(dppass, "stencilOp: dppass"))
         return;
 
     MakeContextCurrent();
     gl->fStencilOp(sfail, dpfail, dppass);
 }
 
-NS_IMETHODIMP
-WebGLContext::MozStencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
-{
-    StencilOpSeparate(face, sfail, dpfail, dppass);
-    return NS_OK;
-}
-
 void
 WebGLContext::StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateFaceEnum(face, "stencilOpSeparate: face") ||
         !ValidateStencilOpEnum(sfail, "stencilOpSeparate: sfail") ||
@@ -4434,219 +3671,155 @@ WebGLContext::SurfaceFromElementResultTo
         default:
             NS_ASSERTION(false, "Unsupported image format. Unimplemented.");
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     return NS_OK;
 }
 
-template<JSBool TypedArrayTest(JSObject* obj, JSContext* cx),
-         JSObject* TypedArrayCopy(JSContext* cx, JSObject* src)>
-static JSObject*
-GetTypedArray(JSContext* aCx, const JS::Value& aValue)
-{
-    if (!aValue.isObject()) {
-        return NULL;
-    }
-
-    JSObject& value = aValue.toObject();
-
-    if (TypedArrayTest(&value, aCx)) {
-        return &value;
-    }
-
-    if (JS_IsArrayObject(aCx, &value)) {
-        return TypedArrayCopy(aCx, &value);
-    }
-
-    return NULL;
-}
-
-static JSObject*
-GetFloat32Array(JSContext* aCx, const JS::Value& aValue)
-{
-    return GetTypedArray<JS_IsFloat32Array, JS_NewFloat32ArrayFromArray>(aCx, aValue);
-}
-
 #define OBTAIN_UNIFORM_LOCATION(info)                                   \
     if (!ValidateObjectAllowNull(info, location_object))                \
         return;                                                         \
     if (!location_object)                                               \
         return;                                                         \
     /* the need to check specifically for !mCurrentProgram here is explained in bug 657556 */ \
     if (!mCurrentProgram) \
         return ErrorInvalidOperation("%s: no program is currently bound", info); \
     if (mCurrentProgram != location_object->Program()) \
         return ErrorInvalidOperation("%s: this uniform location doesn't correspond to the current program", info); \
     if (mCurrentProgram->Generation() != location_object->ProgramGeneration())            \
         return ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info); \
     GLint location = location_object->Location();
 
 #define SIMPLE_ARRAY_METHOD_UNIFORM(name, expectedElemSize, arrayType, ptrType) \
-NS_IMETHODIMP                                                                   \
-WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue, \
-                   JSContext* aCx)                                              \
-{                                                                               \
-    JSObject* wa = GetTypedArray<JS_Is ## arrayType ## Array, JS_New ## arrayType ## ArrayFromArray>(aCx, aValue); \
-    if (!wa) {                                                                  \
-        return NS_ERROR_FAILURE;                                                \
-    }                                                                           \
-    arrayType ## Array arr(aCx, wa);                                            \
-    name(static_cast<WebGLUniformLocation*>(aLocation), arr);                   \
-    return NS_OK;                                                               \
-}                                                                               \
 void                                                                            \
 WebGLContext::name##_base(WebGLUniformLocation *location_object,                \
                         uint32_t arrayLength, const ptrType* data) {            \
     if (!IsContextStable()) {                                                   \
         return;                                                                 \
     }                                                                           \
                                                                                 \
     OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
-    int uniformElemSize = location_object->ElementSize();                           \
-    if (expectedElemSize != uniformElemSize) {                                                   \
+    int uniformElemSize = location_object->ElementSize();                       \
+    if (expectedElemSize != uniformElemSize) {                                  \
         return ErrorInvalidOperation(                                           \
             #name ": this function expected a uniform of element size %d,"      \
             " got a uniform of element size %d",                                \
-            expectedElemSize,                                                                \
-            uniformElemSize);                                                       \
+            expectedElemSize,                                                   \
+            uniformElemSize);                                                   \
     }                                                                           \
     const WebGLUniformInfo& info = location_object->Info();                     \
     if (arrayLength == 0 ||                                                     \
-        arrayLength % expectedElemSize)                                                      \
+        arrayLength % expectedElemSize)                                         \
     {                                                                           \
-        return ErrorInvalidValue("%s: expected an array of length a multiple of" \
-                                 " %d, got an array of length %d",              \
+        return ErrorInvalidValue("%s: expected an array of length a multiple"   \
+                                 " of %d, got an array of length %d",           \
                                  #name,                                         \
-                                 expectedElemSize,                                           \
+                                 expectedElemSize,                              \
                                  arrayLength);                                  \
     }                                                                           \
     if (!info.isArray &&                                                        \
-        arrayLength != expectedElemSize) {                                                   \
-        return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
-                                     " (since this uniform is not an array uniform)," \
-                                     " got an array of length %d",              \
-                                 #name,                                         \
-                                 expectedElemSize,                           \
-                                 arrayLength);                                  \
+        arrayLength != expectedElemSize) {                                      \
+        return ErrorInvalidOperation("%s: expected an array of length exactly"  \
+                                     " %d (since this uniform is not an array"  \
+                                     " uniform), got an array of length %d",    \
+                                     #name,                                     \
+                                     expectedElemSize,                          \
+                                     arrayLength);                              \
     }                                                                           \
                                                                                 \
-    uint32_t numElementsToUpload = NS_MIN(info.arraySize, arrayLength/expectedElemSize);     \
+    uint32_t numElementsToUpload =                                              \
+        NS_MIN(info.arraySize, arrayLength / expectedElemSize);                 \
     MakeContextCurrent();                                                       \
-    gl->f##name(location, numElementsToUpload, data);    \
+    gl->f##name(location, numElementsToUpload, data);                           \
 }
 
 #define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim)                                 \
-NS_IMETHODIMP                                                                   \
-WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,         \
-                   const JS::Value& aValue, JSContext* aCx)                     \
-{                                                                               \
-    JSObject* wa = GetFloat32Array(aCx, aValue);                                \
-    if (!wa) {                                                                  \
-        return NS_ERROR_FAILURE;                                                \
-    }                                                                           \
-    Float32Array arr(aCx, wa);                                                  \
-    name(static_cast<WebGLUniformLocation*>(aLocation), aTranspose, arr);       \
-    return NS_OK;                                                               \
-}                                                                               \
 void                                                                            \
 WebGLContext::name##_base(WebGLUniformLocation* location_object,                \
                           WebGLboolean aTranspose, uint32_t arrayLength,        \
                           const float* data)                                    \
 {                                                                               \
-    uint32_t expectedElemSize = (dim)*(dim);                                                     \
+    uint32_t expectedElemSize = (dim)*(dim);                                    \
     if (!IsContextStable()) {                                                   \
         return;                                                                 \
     }                                                                           \
                                                                                 \
     OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
-    uint32_t uniformElemSize = location_object->ElementSize();                           \
-    if (expectedElemSize != uniformElemSize) {                                               \
+    uint32_t uniformElemSize = location_object->ElementSize();                  \
+    if (expectedElemSize != uniformElemSize) {                                  \
         return ErrorInvalidOperation(                                           \
             #name ": this function expected a uniform of element size %d,"      \
             " got a uniform of element size %d",                                \
-            expectedElemSize,                                                            \
-            uniformElemSize);                                                       \
+            expectedElemSize,                                                   \
+            uniformElemSize);                                                   \
     }                                                                           \
     const WebGLUniformInfo& info = location_object->Info();                     \
     if (arrayLength == 0 ||                                                     \
-        arrayLength % expectedElemSize)                                                \
+        arrayLength % expectedElemSize)                                         \
     {                                                                           \
-        return ErrorInvalidValue("%s: expected an array of length a multiple of" \
-                                 " %d, got an array of length %d",              \
+        return ErrorInvalidValue("%s: expected an array of length a multiple"   \
+                                 " of %d, got an array of length %d",           \
                                  #name,                                         \
-                                 expectedElemSize,                                       \
+                                 expectedElemSize,                              \
                                  arrayLength);                                  \
     }                                                                           \
     if (!info.isArray &&                                                        \
-        arrayLength != expectedElemSize) {                                               \
-        return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
-                                     " (since this uniform is not an array uniform)," \
-                                     " got an array of length %d", \
-                                 #name,                                         \
-                                 expectedElemSize,                           \
-                                 arrayLength);                                  \
+        arrayLength != expectedElemSize) {                                      \
+        return ErrorInvalidOperation("%s: expected an array of length exactly"  \
+                                     " %d (since this uniform is not an array"  \
+                                     " uniform), got an array of length %d",    \
+                                     #name,                                     \
+                                     expectedElemSize,                          \
+                                     arrayLength);                              \
     }                                                                           \
     if (aTranspose) {                                                           \
         return ErrorInvalidValue(#name ": transpose must be FALSE as per the "  \
                                  "OpenGL ES 2.0 spec");                         \
     }                                                                           \
                                                                                 \
     MakeContextCurrent();                                                       \
-    uint32_t numElementsToUpload = NS_MIN(info.arraySize, arrayLength/(expectedElemSize));  \
+    uint32_t numElementsToUpload =                                              \
+        NS_MIN(info.arraySize, arrayLength / (expectedElemSize));               \
     gl->f##name(location, numElementsToUpload, false, data); \
 }
 
-#define SIMPLE_METHOD_UNIFORM_1(glname, name, t1)        \
-NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1) {      \
-    name(static_cast<WebGLUniformLocation*>(ploc), a1);                 \
-    return NS_OK;                                                       \
-}                                                                       \
-void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1) { \
-    if (!IsContextStable())                                             \
-        return;                                                         \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    MakeContextCurrent(); gl->f##glname(location, a1);                  \
+#define SIMPLE_METHOD_UNIFORM_1(glname, name, t1)                               \
+void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1) {         \
+    if (!IsContextStable())                                                     \
+        return;                                                                 \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    MakeContextCurrent(); gl->f##glname(location, a1);                          \
 }
 
-#define SIMPLE_METHOD_UNIFORM_2(glname, name, t1, t2)        \
-NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1, t2 a2) {      \
-    name(static_cast<WebGLUniformLocation*>(ploc), a1, a2);             \
-    return NS_OK;                                                       \
-}                                                                       \
-void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1, t2 a2) {\
-    if (!IsContextStable())                                             \
-        return;                                                         \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    MakeContextCurrent(); gl->f##glname(location, a1, a2);              \
+#define SIMPLE_METHOD_UNIFORM_2(glname, name, t1, t2)                           \
+void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1, t2 a2) {  \
+    if (!IsContextStable())                                                     \
+        return;                                                                 \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    MakeContextCurrent(); gl->f##glname(location, a1, a2);                      \
 }
 
-#define SIMPLE_METHOD_UNIFORM_3(glname, name, t1, t2, t3)        \
-NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1, t2 a2, t3 a3) {      \
-    name(static_cast<WebGLUniformLocation*>(ploc), a1, a2, a3);         \
-    return NS_OK;                                                       \
-}                                                                       \
-void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1, t2 a2, t3 a3) {\
-    if (!IsContextStable())                                             \
-        return;                                                         \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    MakeContextCurrent(); gl->f##glname(location, a1, a2, a3);          \
+#define SIMPLE_METHOD_UNIFORM_3(glname, name, t1, t2, t3)                       \
+void WebGLContext::name(WebGLUniformLocation *location_object,                  \
+                        t1 a1, t2 a2, t3 a3) {                                  \
+    if (!IsContextStable())                                                     \
+        return;                                                                 \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    MakeContextCurrent(); gl->f##glname(location, a1, a2, a3);                  \
 }
 
-#define SIMPLE_METHOD_UNIFORM_4(glname, name, t1, t2, t3, t4)        \
-NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1, t2 a2, t3 a3, t4 a4) {      \
-    name(static_cast<WebGLUniformLocation*>(ploc), a1, a2, a3, a4);     \
-    return NS_OK;                                                       \
-}                                                                       \
-void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1, t2 a2, t3 a3, t4 a4) {\
-    if (!IsContextStable())                                             \
-        return;                                                         \
-    OBTAIN_UNIFORM_LOCATION(#name ": location")                         \
-    MakeContextCurrent(); gl->f##glname(location, a1, a2, a3, a4);      \
+#define SIMPLE_METHOD_UNIFORM_4(glname, name, t1, t2, t3, t4)                   \
+void WebGLContext::name(WebGLUniformLocation *location_object,                  \
+                        t1 a1, t2 a2, t3 a3, t4 a4) {                           \
+    if (!IsContextStable())                                                     \
+        return;                                                                 \
+    OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
+    MakeContextCurrent(); gl->f##glname(location, a1, a2, a3, a4);              \
 }
 
 SIMPLE_METHOD_UNIFORM_1(Uniform1i, Uniform1i, WebGLint)
 SIMPLE_METHOD_UNIFORM_2(Uniform2i, Uniform2i, WebGLint, WebGLint)
 SIMPLE_METHOD_UNIFORM_3(Uniform3i, Uniform3i, WebGLint, WebGLint, WebGLint)
 SIMPLE_METHOD_UNIFORM_4(Uniform4i, Uniform4i, WebGLint, WebGLint, WebGLint, WebGLint)
 
 SIMPLE_METHOD_UNIFORM_1(Uniform1f, Uniform1f, WebGLfloat)
@@ -4663,23 +3836,16 @@ SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1fv, 
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 2, Float32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, Float32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, Float32, WebGLfloat)
 
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2)
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3)
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix4fv, 4)
 
-NS_IMETHODIMP
-WebGLContext::MozVertexAttrib1f(uint32_t index, WebGLfloat x0)
-{
-    VertexAttrib1f(index, x0);
-    return NS_OK;
-}
-
 void
 WebGLContext::VertexAttrib1f(WebGLuint index, WebGLfloat x0)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
 
@@ -4690,23 +3856,16 @@ WebGLContext::VertexAttrib1f(WebGLuint i
         mVertexAttrib0Vector[1] = 0;
         mVertexAttrib0Vector[2] = 0;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib1f(index, x0);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozVertexAttrib2f(uint32_t index, WebGLfloat x0, WebGLfloat x1)
-{
-    VertexAttrib2f(index, x0, x1);
-    return NS_OK;
-}
-
 void
 WebGLContext::VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
 
@@ -4717,23 +3876,16 @@ WebGLContext::VertexAttrib2f(WebGLuint i
         mVertexAttrib0Vector[1] = x1;
         mVertexAttrib0Vector[2] = 0;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib2f(index, x0, x1);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozVertexAttrib3f(uint32_t index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2)
-{
-    VertexAttrib3f(index, x0, x1, x2);
-    return NS_OK;
-}
-
 void
 WebGLContext::VertexAttrib3f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
 
@@ -4744,24 +3896,16 @@ WebGLContext::VertexAttrib3f(WebGLuint i
         mVertexAttrib0Vector[1] = x1;
         mVertexAttrib0Vector[2] = x2;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib3f(index, x0, x1, x2);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::MozVertexAttrib4f(uint32_t index, WebGLfloat x0, WebGLfloat x1,
-                                                WebGLfloat x2, WebGLfloat x3)
-{
-    VertexAttrib4f(index, x0, x1, x2, x3);
-    return NS_OK;
-}
-
 void
 WebGLContext::VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1,
                                               WebGLfloat x2, WebGLfloat x3)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
@@ -4774,27 +3918,16 @@ WebGLContext::VertexAttrib4f(WebGLuint i
         mVertexAttrib0Vector[2] = x2;
         mVertexAttrib0Vector[3] = x3;
         if (gl->IsGLES2())
             gl->fVertexAttrib4f(index, x0, x1, x2, x3);
     }
 }
 
 #define SIMPLE_ARRAY_METHOD_NO_COUNT(name, cnt, ptrType)                        \
-NS_IMETHODIMP                                                                   \
-WebGLContext::name(WebGLuint idx, const JS::Value& aValue, JSContext* aCx)      \
-{                                                                               \
-    JSObject* wa = GetFloat32Array(aCx, aValue);                                \
-    if (!wa) {                                                                  \
-        return NS_ERROR_FAILURE;                                                \
-    }                                                                           \
-    Float32Array arr(aCx, wa);                                                  \
-    name(idx, arr);                                                             \
-    return NS_OK;                                                               \
-}                                                                               \
 void                                                                            \
 WebGLContext::name##_base(WebGLuint idx, uint32_t arrayLength,                  \
                           const WebGLfloat* ptr)                                \
 {                                                                               \
     if (!IsContextStable()) {                                                   \
         return;                                                                 \
     }                                                                           \
     if (arrayLength < cnt) {                                                    \
@@ -4815,23 +3948,16 @@ WebGLContext::name##_base(WebGLuint idx,
     }                                                                           \
 }
 
 SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib1fv, 1, WebGLfloat)
 SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib2fv, 2, WebGLfloat)
 SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib3fv, 3, WebGLfloat)
 SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib4fv, 4, WebGLfloat)
 
-NS_IMETHODIMP
-WebGLContext::UseProgram(nsIWebGLProgram *pobj)
-{
-    UseProgram(static_cast<WebGLProgram*>(pobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::UseProgram(WebGLProgram *prog)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
 
     if (!ValidateObjectAllowNull("useProgram", prog))
@@ -4843,23 +3969,16 @@ WebGLContext::UseProgram(WebGLProgram *p
     if (prog && !prog->LinkStatus())
         return ErrorInvalidOperation("useProgram: program was not linked successfully");
 
     gl->fUseProgram(progname);
 
     mCurrentProgram = prog;
 }
 
-NS_IMETHODIMP
-WebGLContext::ValidateProgram(nsIWebGLProgram *pobj)
-{
-    ValidateProgram(static_cast<WebGLProgram*>(pobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::ValidateProgram(WebGLProgram *prog)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("validateProgram", prog))
         return;
@@ -4873,75 +3992,47 @@ WebGLContext::ValidateProgram(WebGLProgr
         return;
     }
 #endif
 
     WebGLuint progname = prog->GLName();
     gl->fValidateProgram(progname);
 }
 
-NS_IMETHODIMP
-WebGLContext::CreateFramebuffer(nsIWebGLFramebuffer **retval)
-{
-    *retval = CreateFramebuffer().get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLFramebuffer>
 WebGLContext::CreateFramebuffer()
 {
     if (!IsContextStable())
         return nullptr;
     nsRefPtr<WebGLFramebuffer> globj = new WebGLFramebuffer(this);
     return globj.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::CreateRenderbuffer(nsIWebGLRenderbuffer **retval)
-{
-    *retval = CreateRenderbuffer().get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLRenderbuffer>
 WebGLContext::CreateRenderbuffer()
 {
     if (!IsContextStable())
         return nullptr;
     nsRefPtr<WebGLRenderbuffer> globj = new WebGLRenderbuffer(this);
     return globj.forget();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozViewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
-{
-    Viewport(x, y, width, height);
-    return NS_OK;
-}
-
 void
 WebGLContext::Viewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
 {
     if (!IsContextStable())
         return;
 
     if (width < 0 || height < 0)
         return ErrorInvalidValue("viewport: negative size");
 
     MakeContextCurrent();
     gl->fViewport(x, y, width, height);
 }
 
-NS_IMETHODIMP
-WebGLContext::CompileShader(nsIWebGLShader *sobj)
-{
-    CompileShader(static_cast<WebGLShader*>(sobj));
-    return NS_OK;
-}
-
 void
 WebGLContext::CompileShader(WebGLShader *shader)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("compileShader", shader))
         return;
@@ -5122,30 +4213,16 @@ WebGLContext::CompileShader(WebGLShader 
         gl->fCompileShader(shadername);
         GLint ok;
         gl->fGetShaderiv(shadername, LOCAL_GL_COMPILE_STATUS, &ok);
         shader->SetCompileStatus(ok);
     }
 #endif
 }
 
-NS_IMETHODIMP
-WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat,
-                                   WebGLsizei width, WebGLsizei height, WebGLint border,
-                                   const JS::Value& pixels, JSContext *cx)
-{
-    if (!pixels.isObject() || !JS_IsTypedArrayObject(&pixels.toObject(), cx)) {
-        return NS_ERROR_FAILURE;
-    }
-
-    ArrayBufferView view(cx, &pixels.toObject());
-    CompressedTexImage2D(target, level, internalformat, width, height, border, view);
-    return NS_OK;
-}
-
 void
 WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat,
                                    WebGLsizei width, WebGLsizei height, WebGLint border,
                                    ArrayBufferView& view)
 {
     if (!IsContextStable()) {
         return;
     }
@@ -5178,31 +4255,16 @@ WebGLContext::CompressedTexImage2D(WebGL
     if (!ValidateCompressedTextureSize(level, internalformat, width, height, byteLength, "compressedTexImage2D")) {
         return;
     }
 
     gl->fCompressedTexImage2D(target, level, internalformat, width, height, border, byteLength, view.Data());
     tex->SetImageInfo(target, level, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE);
 }
 
-NS_IMETHODIMP
-WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset,
-                                      WebGLint yoffset, WebGLsizei width, WebGLsizei height,
-                                      WebGLenum format, const JS::Value& pixels, JSContext *cx)
-{
-    if (!pixels.isObject() || !JS_IsTypedArrayObject(&pixels.toObject(), cx)) {
-        return NS_ERROR_FAILURE;
-    }
-
-    ArrayBufferView view(cx, &pixels.toObject());
-    CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height,
-                            format, view);
-    return NS_OK;
-}
-
 void
 WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset,
                                       WebGLint yoffset, WebGLsizei width, WebGLsizei height,
                                       WebGLenum format, ArrayBufferView& view)
 {
     if (!IsContextStable()) {
         return;
     }
@@ -5280,23 +4342,16 @@ WebGLContext::CompressedTexSubImage2D(We
         }
     }
 
     gl->fCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, byteLength, view.Data());
 
     return;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetShaderParameter(nsIWebGLShader *sobj, WebGLenum pname, JS::Value *retval)
-{
-    *retval = GetShaderParameter(static_cast<WebGLShader*>(sobj), pname);
-    return NS_OK;
-}
-
 JS::Value
 WebGLContext::GetShaderParameter(WebGLShader *shader, WebGLenum pname)
 {
     if (!IsContextStable())
         return JS::NullValue();
 
     if (!ValidateObject("getShaderParameter: shader", shader))
         return JS::NullValue();
@@ -5325,23 +4380,16 @@ WebGLContext::GetShaderParameter(WebGLSh
             break;
         default:
             ErrorInvalidEnumInfo("getShaderParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }
 
-NS_IMETHODIMP
-WebGLContext::GetShaderInfoLog(nsIWebGLShader *sobj, nsAString& retval)
-{
-    GetShaderInfoLog(static_cast<WebGLShader*>(sobj), retval);
-    return NS_OK;
-}
-
 void
 WebGLContext::GetShaderInfoLog(WebGLShader *shader, nsAString& retval)
 {
     nsAutoCString s;
     GetShaderInfoLog(shader, s);
     if (s.IsVoid())
         retval.SetIsVoid(true);
     else
@@ -5367,37 +4415,29 @@ WebGLContext::GetShaderInfoLog(WebGLShad
 
     MakeContextCurrent();
 
     WebGLuint shadername = shader->GLName();
     GLint k = -1;
     gl->fGetShaderiv(shadername, LOCAL_GL_INFO_LOG_LENGTH, &k);
     if (k == -1) {
         // XXX GL Error? should never happen.
-        retval.SetIsVoid(true);
         return;
     }
 
     if (k == 0) {
         retval.Truncate();
         return;
     }
 
     retval.SetCapacity(k);
     gl->fGetShaderInfoLog(shadername, k, &k, (char*) retval.BeginWriting());
     retval.SetLength(k);
 }
 
-NS_IMETHODIMP
-WebGLContext::GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precisiontype, nsIWebGLShaderPrecisionFormat **retval)
-{
-    *retval = GetShaderPrecisionFormat(shadertype, precisiontype).get();
-    return NS_OK;
-}
-
 already_AddRefed<WebGLShaderPrecisionFormat>
 WebGLContext::GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precisiontype)
 {
     if (!IsContextStable())
         return nullptr;
 
     switch (shadertype) {
         case LOCAL_GL_FRAGMENT_SHADER:
@@ -5427,45 +4467,31 @@ WebGLContext::GetShaderPrecisionFormat(W
     gl->fGetShaderPrecisionFormat(shadertype, precisiontype, range, &precision);
 
     WebGLShaderPrecisionFormat *retShaderPrecisionFormat
         = new WebGLShaderPrecisionFormat(range[0], range[1], precision);
     NS_ADDREF(retShaderPrecisionFormat);
     return retShaderPrecisionFormat;
 }
 
-NS_IMETHODIMP
-WebGLContext::GetShaderSource(nsIWebGLShader *sobj, nsAString& retval)
-{
-    GetShaderSource(static_cast<WebGLShader*>(sobj), retval);
-    return NS_OK;
-}
-
 void
 WebGLContext::GetShaderSource(WebGLShader *shader, nsAString& retval)
 {
     if (!IsContextStable())
     {
         retval.SetIsVoid(true);
         return;
     }
 
     if (!ValidateObject("getShaderSource: shader", shader))
         return;
 
     retval.Assign(shader->Source());
 }
 
-NS_IMETHODIMP
-WebGLContext::ShaderSource(nsIWebGLShader *sobj, const nsAString& source)
-{
-    ShaderSource(static_cast<WebGLShader*>(sobj), source);
-    return NS_OK;
-}
-
 void
 WebGLContext::ShaderSource(WebGLShader *shader, const nsAString& source)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("shaderSource: shader", shader))
         return;
@@ -5478,25 +4504,16 @@ WebGLContext::ShaderSource(WebGLShader *
     if (!ValidateGLSLString(cleanSource, "compileShader"))
         return;
 
     shader->SetSource(source);
 
     shader->SetNeedsTranslation();
 }
 
-NS_IMETHODIMP
-WebGLContext::MozVertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type,
-                                     WebGLboolean normalized, WebGLsizei stride,
-                                     WebGLintptr byteOffset)
-{
-    VertexAttribPointer(index, size, type, normalized, stride, byteOffset);
-    return NS_OK;
-}
-
 void
 WebGLContext::VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type,
                                   WebGLboolean normalized, WebGLsizei stride,
                                   WebGLintptr byteOffset)
 {
     InvalidateCachedMinInUseAttribArrayLength();
     if (!IsContextStable())
         return;
@@ -5564,25 +4581,16 @@ WebGLContext::VertexAttribPointer(WebGLu
 
     MakeContextCurrent();
 
     gl->fVertexAttribPointer(index, size, type, normalized,
                              stride,
                              reinterpret_cast<void*>(byteOffset));
 }
 
-NS_IMETHODIMP
-WebGLContext::TexImage2D(int32_t)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    return NS_ERROR_FAILURE;
-}
-
 GLenum WebGLContext::CheckedTexImage2D(GLenum target,
                                        GLint level,
                                        GLenum internalFormat,
                                        GLsizei width,
                                        GLsizei height,
                                        GLint border,
                                        GLenum format,
                                        GLenum type,
@@ -5753,69 +4761,32 @@ WebGLContext::TexImage2D_base(WebGLenum 
     if (error) {
         GenerateWarning("texImage2D generated error %s", ErrorName(error));
         return;
     }
 
     tex->SetImageInfo(target, level, width, height, format, type);
 }
 
-NS_IMETHODIMP
-WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
-                               WebGLsizei width, WebGLsizei height, WebGLint border,
-                               WebGLenum format, WebGLenum type,
-                               JSObject *pixels, JSContext *cx)
-{
-    ErrorResult rv;
-    if (!pixels) {
-        TexImage2D(cx, target, level, internalformat, width, height, border,
-                   format, type, nullptr, rv);
-    } else {
-        ArrayBufferView view(cx, pixels);
-        TexImage2D(cx, target, level, internalformat, width, height, border,
-                   format, type, &view, rv);
-    }
-    return rv.ErrorCode();
-}
-
 void
 WebGLContext::TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
                          WebGLenum internalformat, WebGLsizei width,
                          WebGLsizei height, WebGLint border, WebGLenum format,
                          WebGLenum type, ArrayBufferView *pixels, ErrorResult& rv)
 {
     if (!IsContextStable())
         return;
 
     return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type,
                            pixels ? pixels->Data() : 0,
                            pixels ? pixels->Length() : 0,
                            pixels ? (int)JS_GetTypedArrayType(pixels->Obj(), cx) : -1,
                            WebGLTexelConversions::Auto, false);
 }
 
-NS_IMETHODIMP
-WebGLContext::TexImage2D_imageData(WebGLenum target, WebGLint level, WebGLenum internalformat,
-                                   WebGLsizei width, WebGLsizei height, WebGLint border,
-                                   WebGLenum format, WebGLenum type,
-                                   JSObject *pixels, JSContext *cx)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(pixels, cx), "bad pixels object");
-
-    TexImage2D_base(target, level, internalformat, width, height, 4*width, border, format, type,
-                    pixels ? JS_GetArrayBufferViewData(pixels, cx) : 0,
-                    pixels ? JS_GetArrayBufferViewByteLength(pixels, cx) : 0,
-                    -1,
-                    WebGLTexelConversions::RGBA8, false);
-    return NS_OK;
-}
-
 void
 WebGLContext::TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
                          WebGLenum internalformat, WebGLenum format,
                          WebGLenum type, ImageData* pixels, ErrorResult& rv)
 {
     if (!IsContextStable())
         return;
 
@@ -5827,34 +4798,16 @@ WebGLContext::TexImage2D(JSContext* cx, 
     Uint8ClampedArray arr(cx, pixels->GetDataObject());
     return TexImage2D_base(target, level, internalformat, pixels->GetWidth(),
                            pixels->GetHeight(), 4*pixels->GetWidth(), 0,
                            format, type, arr.Data(), arr.Length(), -1,
                            WebGLTexelConversions::RGBA8, false);
 }
 
 
-NS_IMETHODIMP
-WebGLContext::TexImage2D_dom(WebGLenum target, WebGLint level, WebGLenum internalformat,
-                             WebGLenum format, GLenum type, Element* elt)
-{
-    ErrorResult rv;
-    TexImage2D(NULL, target, level, internalformat, format, type, elt, rv);
-    return rv.ErrorCode();
-}
-
-NS_IMETHODIMP
-WebGLContext::TexSubImage2D(int32_t)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    return NS_ERROR_FAILURE;
-}
-
 void
 WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
                                  WebGLint xoffset, WebGLint yoffset,
                                  WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
                                  WebGLenum format, WebGLenum type,
                                  void *pixels, uint32_t byteLength,
                                  int jsArrayType,
                                  WebGLTexelFormat srcFormat, bool srcPremultiplied)
@@ -5957,35 +4910,16 @@ WebGLContext::TexSubImage2D_base(WebGLen
                     static_cast<const uint8_t*>(pixels), convertedData,
                     actualSrcFormat, srcPremultiplied,
                     dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize);
 
         gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, convertedData);
     }
 }
 
-NS_IMETHODIMP
-WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level,
-                                  WebGLint xoffset, WebGLint yoffset,
-                                  WebGLsizei width, WebGLsizei height,
-                                  WebGLenum format, WebGLenum type,
-                                  JSObject *pixels, JSContext *cx)
-{
-    ErrorResult rv;
-    if (!pixels) {
-        TexSubImage2D(cx, target, level, xoffset, yoffset, width, height,
-                      format, type, nullptr, rv);
-    } else {
-        ArrayBufferView view(cx, pixels);
-        TexSubImage2D(cx, target, level, xoffset, yoffset, width, height,
-                      format, type, &view, rv);
-    }
-    return rv.ErrorCode();
-}
-
 void
 WebGLContext::TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
                             WebGLint xoffset, WebGLint yoffset,
                             WebGLsizei width, WebGLsizei height,
                             WebGLenum format, WebGLenum type,
                             ArrayBufferView* pixels,
                             ErrorResult& rv)
 {
@@ -5997,41 +4931,16 @@ WebGLContext::TexSubImage2D(JSContext* c
 
     return TexSubImage2D_base(target, level, xoffset, yoffset,
                               width, height, 0, format, type,
                               pixels->Data(), pixels->Length(),
                               JS_GetTypedArrayType(pixels->Obj(), cx),
                               WebGLTexelConversions::Auto, false);
 }
 
-NS_IMETHODIMP
-WebGLContext::TexSubImage2D_imageData(WebGLenum target, WebGLint level,
-                                      WebGLint xoffset, WebGLint yoffset,
-                                      WebGLsizei width, WebGLsizei height,
-                                      WebGLenum format, WebGLenum type,
-                                      JSObject *pixels, JSContext *cx)
-{
-    if (!IsContextStable())
-        return NS_OK;
-
-    if (!pixels) {
-        ErrorInvalidValue("texSubImage2D: pixels must not be null!");
-        return NS_OK;
-    }
-
-    NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(pixels, cx), "bad pixels object");
-
-    TexSubImage2D_base(target, level, xoffset, yoffset,
-                       width, height, 4*width, format, type,
-                       JS_GetArrayBufferViewData(pixels, cx), JS_GetArrayBufferViewByteLength(pixels, cx),
-                       -1,
-                       WebGLTexelConversions::RGBA8, false);
-    return NS_OK;
-}
-
 void
 WebGLContext::TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
                             WebGLint xoffset, WebGLint yoffset,
                             WebGLenum format, WebGLenum type, ImageData* pixels,
                             ErrorResult& rv)
 {
     if (!IsContextStable())
         return;
@@ -6043,27 +4952,16 @@ WebGLContext::TexSubImage2D(JSContext* c
     return TexSubImage2D_base(target, level, xoffset, yoffset,
                               pixels->GetWidth(), pixels->GetHeight(),
                               4*pixels->GetWidth(), format, type,
                               arr.Data(), arr.Length(),
                               -1,
                               WebGLTexelConversions::RGBA8, false);
 }
 
-NS_IMETHODIMP
-WebGLContext::TexSubImage2D_dom(WebGLenum target, WebGLint level,
-                                WebGLint xoffset, WebGLint yoffset,
-                                WebGLenum format, WebGLenum type,
-                                Element *elt)
-{
-    ErrorResult rv;
-    TexSubImage2D(NULL, target, level, xoffset, yoffset, format, type, elt, rv);
-    return rv.ErrorCode();
-}
-
 bool
 WebGLContext::LoseContext()
 {
     if (!IsContextStable())
         return false;
 
     ForceLoseContext();
 
--- a/content/canvas/src/WebGLContextNotSupported.cpp
+++ b/content/canvas/src/WebGLContextNotSupported.cpp
@@ -5,17 +5,16 @@
 
 #include "nsIDOMWebGLRenderingContext.h"
 #include "nsDOMClassInfoID.h"
 
 #define DUMMY(func,rtype)  nsresult func (rtype ** aResult) { return NS_ERROR_FAILURE; }
 
 DUMMY(NS_NewCanvasRenderingContextWebGL, nsIDOMWebGLRenderingContext)
 
-DOMCI_DATA(WebGLRenderingContext, void)
 DOMCI_DATA(WebGLBuffer, void)
 DOMCI_DATA(WebGLTexture, void)
 DOMCI_DATA(WebGLProgram, void)
 DOMCI_DATA(WebGLShader, void)
 DOMCI_DATA(WebGLFramebuffer, void)
 DOMCI_DATA(WebGLRenderbuffer, void)
 DOMCI_DATA(WebGLUniformLocation, void)
 DOMCI_DATA(WebGLShaderPrecisionFormat, void)
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1543,18 +1543,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(SimpleGestureEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozTouchEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA_WITH_NAME(MathMLElement, Element, nsElementSH,
                                      ELEMENT_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(WebGLRenderingContext, nsWebGLViewportHandlerSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLBuffer, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLTexture, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLProgram, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLShader, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -4220,20 +4218,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeSelector)
     DOM_CLASSINFO_MAP_ENTRY(nsIInlineEventHandlers)
     DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver,
                                         nsDOMTouchEvent::PrefEnabled())
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(WebGLRenderingContext, nsIDOMWebGLRenderingContext)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMWebGLRenderingContext)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(WebGLBuffer, nsIWebGLBuffer)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLBuffer)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(WebGLTexture, nsIWebGLTexture)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLTexture)
   DOM_CLASSINFO_MAP_END
 
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -1510,41 +1510,9 @@ public:
                        JSObject *globalObj, JSObject **parentObj);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsNewDOMBindingSH<T, BaseType>(aData);
   }
 };
 
-class nsWebGLViewportHandlerSH
-  : public nsNewDOMBindingSH<nsICanvasRenderingContextInternal>
-{
-protected:
-  nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData)
-    : nsNewDOMBindingSH<nsICanvasRenderingContextInternal>(aData)
-  {
-  }
-
-  virtual ~nsWebGLViewportHandlerSH()
-  {
-  }
-
-public:
-  NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) {
-    nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
-    if (NS_SUCCEEDED(rv)) {
-      if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2),
-                               nullptr, nullptr, JSPROP_ENUMERATE))
-      {
-        return NS_ERROR_UNEXPECTED;
-      }
-    }
-    return rv;
-  }
-
-  static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
-  {
-    return new nsWebGLViewportHandlerSH(aData);
-  }
-};
-
 #endif /* nsDOMClassInfo_h___ */
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -442,17 +442,16 @@ DOMCI_CLASS(NotifyAudioAvailableEvent)
 
 DOMCI_CLASS(SimpleGestureEvent)
 
 DOMCI_CLASS(MozTouchEvent)
 
 DOMCI_CLASS(MathMLElement)
 
 // WebGL
-DOMCI_CLASS(WebGLRenderingContext)
 DOMCI_CLASS(WebGLBuffer)
 DOMCI_CLASS(WebGLTexture)
 DOMCI_CLASS(WebGLProgram)
 DOMCI_CLASS(WebGLShader)
 DOMCI_CLASS(WebGLFramebuffer)
 DOMCI_CLASS(WebGLRenderbuffer)
 DOMCI_CLASS(WebGLUniformLocation)
 DOMCI_CLASS(WebGLShaderPrecisionFormat)
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -304,17 +304,16 @@ DOMInterfaces = {
     'headerFile': 'DOMSVGTransformList.h',
     'prefable': True,
     'resultNotAddRefed': [ 'getItem' ]
 }],
 
 'WebGLRenderingContext': {
   'nativeType': 'mozilla::WebGLContext',
   'headerFile': 'WebGLContext.h',
-  'prefable': True,
   'resultNotAddRefed': [ 'canvas', 'getContextAttributes', 'getExtension',
                          'getAttachedShaders' ],
   'implicitJSContext': [ 'texImage2D', 'texSubImage2D' ],
 },
 
 'WebGLUniformLocation': {
    'nativeType': 'mozilla::WebGLUniformLocation',
    'headerFile': 'WebGLContext.h',
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -156,779 +156,16 @@ interface nsIWebGLExtensionCompressedTex
 };
 
 [scriptable, builtinclass, uuid(ef36f000-c1b2-11e1-afa7-0800200c9a66)]
 interface nsIWebGLExtensionDepthTexture : nsIWebGLExtension
 {
   const WebGLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
 };
 
-[scriptable, builtinclass, uuid(a1fdfb76-6a08-4a1a-b0c9-d92ef3357cb9)]
+[builtinclass, uuid(a1fdfb76-6a08-4a1a-b0c9-d92ef3357cb9)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
-  //
-  //  CONSTANTS
-  //
-
-  /* ClearBufferMask */
-  const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;
-  const unsigned long STENCIL_BUFFER_BIT             = 0x00000400;
-  const unsigned long COLOR_BUFFER_BIT               = 0x00004000;
-
-  /* BeginMode */
-  const unsigned long POINTS                         = 0x0000;
-  const unsigned long LINES                          = 0x0001;
-  const unsigned long LINE_LOOP                      = 0x0002;
-  const unsigned long LINE_STRIP                     = 0x0003;
-  const unsigned long TRIANGLES                      = 0x0004;
-  const unsigned long TRIANGLE_STRIP                 = 0x0005;
-  const unsigned long TRIANGLE_FAN                   = 0x0006;
-
-  /* BlendingFactorDest */
-  const unsigned long ZERO                           = 0;
-  const unsigned long ONE                            = 1;
-  const unsigned long SRC_COLOR                      = 0x0300;
-  const unsigned long ONE_MINUS_SRC_COLOR            = 0x0301;
-  const unsigned long SRC_ALPHA                      = 0x0302;
-  const unsigned long ONE_MINUS_SRC_ALPHA            = 0x0303;
-  const unsigned long DST_ALPHA                      = 0x0304;
-  const unsigned long ONE_MINUS_DST_ALPHA            = 0x0305;
-
-  /* BlendingFactorSrc */
-  /*      GL_ZERO */
-  /*      GL_ONE */
-  const unsigned long DST_COLOR                      = 0x0306;
-  const unsigned long ONE_MINUS_DST_COLOR            = 0x0307;
-  const unsigned long SRC_ALPHA_SATURATE             = 0x0308;
-  /*      GL_SRC_ALPHA */
-  /*      GL_ONE_MINUS_SRC_ALPHA */
-  /*      GL_DST_ALPHA */
-  /*      GL_ONE_MINUS_DST_ALPHA */
-
-  /* BlendEquationSeparate */
-  const unsigned long FUNC_ADD                       = 0x8006;
-  const unsigned long BLEND_EQUATION                 = 0x8009;
-  const unsigned long BLEND_EQUATION_RGB             = 0x8009;   /* same as BLEND_EQUATION */
-  const unsigned long BLEND_EQUATION_ALPHA           = 0x883D;
-
-  /* BlendSubtract */
-  const unsigned long FUNC_SUBTRACT                  = 0x800A;
-  const unsigned long FUNC_REVERSE_SUBTRACT          = 0x800B;
-
-  /* Separate Blend Functions */
-  const unsigned long BLEND_DST_RGB                  = 0x80C8;
-  const unsigned long BLEND_SRC_RGB                  = 0x80C9;
-  const unsigned long BLEND_DST_ALPHA                = 0x80CA;
-  const unsigned long BLEND_SRC_ALPHA                = 0x80CB;
-  const unsigned long CONSTANT_COLOR                 = 0x8001;
-  const unsigned long ONE_MINUS_CONSTANT_COLOR       = 0x8002;
-  const unsigned long CONSTANT_ALPHA                 = 0x8003;
-  const unsigned long ONE_MINUS_CONSTANT_ALPHA       = 0x8004;
-  const unsigned long BLEND_COLOR                    = 0x8005;
-
-  /* Buffer Objects */
-  const unsigned long ARRAY_BUFFER                   = 0x8892;
-  const unsigned long ELEMENT_ARRAY_BUFFER           = 0x8893;
-  const unsigned long ARRAY_BUFFER_BINDING           = 0x8894;
-  const unsigned long ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;
-
-  const unsigned long STREAM_DRAW                    = 0x88E0;
-  const unsigned long STATIC_DRAW                    = 0x88E4;
-  const unsigned long DYNAMIC_DRAW                   = 0x88E8;
-
-  const unsigned long BUFFER_SIZE                    = 0x8764;
-  const unsigned long BUFFER_USAGE                   = 0x8765;
-
-  const unsigned long CURRENT_VERTEX_ATTRIB          = 0x8626;
-
-  /* CullFaceMode */
-  const unsigned long FRONT                          = 0x0404;
-  const unsigned long BACK                           = 0x0405;
-  const unsigned long FRONT_AND_BACK                 = 0x0408;
-
-  /* DepthFunction */
-  /*      GL_NEVER */
-  /*      GL_LESS */
-  /*      GL_EQUAL */
-  /*      GL_LEQUAL */
-  /*      GL_GREATER */
-  /*      GL_NOTEQUAL */
-  /*      GL_GEQUAL */
-  /*      GL_ALWAYS */
-
-  /* EnableCap */
-  const unsigned long TEXTURE_2D                     = 0x0DE1;
-  const unsigned long CULL_FACE                      = 0x0B44;
-  const unsigned long BLEND                          = 0x0BE2;
-  const unsigned long DITHER                         = 0x0BD0;
-  const unsigned long STENCIL_TEST                   = 0x0B90;
-  const unsigned long DEPTH_TEST                     = 0x0B71;
-  const unsigned long SCISSOR_TEST                   = 0x0C11;
-  const unsigned long POLYGON_OFFSET_FILL            = 0x8037;
-  const unsigned long SAMPLE_ALPHA_TO_COVERAGE       = 0x809E;
-  const unsigned long SAMPLE_COVERAGE                = 0x80A0;
-
-  /* ErrorCode */
-  const unsigned long NO_ERROR                       = 0;
-  const unsigned long INVALID_ENUM                   = 0x0500;
-  const unsigned long INVALID_VALUE                  = 0x0501;
-  const unsigned long INVALID_OPERATION              = 0x0502;
-  const unsigned long OUT_OF_MEMORY                  = 0x0505;
-
-  /* FrontFaceDirection */
-  const unsigned long CW                             = 0x0900;
-  const unsigned long CCW                            = 0x0901;
-
-  /* GetPName */
-  const unsigned long LINE_WIDTH                     = 0x0B21;
-  const unsigned long ALIASED_POINT_SIZE_RANGE       = 0x846D;
-  const unsigned long ALIASED_LINE_WIDTH_RANGE       = 0x846E;
-  const unsigned long CULL_FACE_MODE                 = 0x0B45;
-  const unsigned long FRONT_FACE                     = 0x0B46;
-  const unsigned long DEPTH_RANGE                    = 0x0B70;
-  const unsigned long DEPTH_WRITEMASK                = 0x0B72;
-  const unsigned long DEPTH_CLEAR_VALUE              = 0x0B73;
-  const unsigned long DEPTH_FUNC                     = 0x0B74;
-  const unsigned long STENCIL_CLEAR_VALUE            = 0x0B91;
-  const unsigned long STENCIL_FUNC                   = 0x0B92;
-  const unsigned long STENCIL_FAIL                   = 0x0B94;
-  const unsigned long STENCIL_PASS_DEPTH_FAIL        = 0x0B95;
-  const unsigned long STENCIL_PASS_DEPTH_PASS        = 0x0B96;
-  const unsigned long STENCIL_REF                    = 0x0B97;
-  const unsigned long STENCIL_VALUE_MASK             = 0x0B93;
-  const unsigned long STENCIL_WRITEMASK              = 0x0B98;
-  const unsigned long STENCIL_BACK_FUNC              = 0x8800;
-  const unsigned long STENCIL_BACK_FAIL              = 0x8801;
-  const unsigned long STENCIL_BACK_PASS_DEPTH_FAIL   = 0x8802;
-  const unsigned long STENCIL_BACK_PASS_DEPTH_PASS   = 0x8803;
-  const unsigned long STENCIL_BACK_REF               = 0x8CA3;
-  const unsigned long STENCIL_BACK_VALUE_MASK        = 0x8CA4;
-  const unsigned long STENCIL_BACK_WRITEMASK         = 0x8CA5;
-  // This is defined using a scriptable helper in nsDOMClassInfo.h,
-  // because otherwise the case conflicts with the viewport()
-  // method.  WebIDL is case-sensitive, but our current IDL parser
-  // is not.  Once this is fixed, the WebGL context can go back to
-  // using nsDOMGenericSH instead of nsWebGLViewportHandlerSH.
-  // It is not visible to non-JS languages, but the constant value
-  // can just be used.
-  //const unsigned long VIEWPORT                       = 0x0BA2;
-  const unsigned long SCISSOR_BOX                    = 0x0C10;
-  /*      GL_SCISSOR_TEST */
-  const unsigned long COLOR_CLEAR_VALUE              = 0x0C22;
-  const unsigned long COLOR_WRITEMASK                = 0x0C23;
-  const unsigned long UNPACK_ALIGNMENT               = 0x0CF5;
-  const unsigned long PACK_ALIGNMENT                 = 0x0D05;
-  const unsigned long MAX_TEXTURE_SIZE               = 0x0D33;
-  const unsigned long MAX_VIEWPORT_DIMS              = 0x0D3A;
-  const unsigned long SUBPIXEL_BITS                  = 0x0D50;
-  const unsigned long RED_BITS                       = 0x0D52;
-  const unsigned long GREEN_BITS                     = 0x0D53;
-  const unsigned long BLUE_BITS                      = 0x0D54;
-  const unsigned long ALPHA_BITS                     = 0x0D55;
-  const unsigned long DEPTH_BITS                     = 0x0D56;
-  const unsigned long STENCIL_BITS                   = 0x0D57;
-  const unsigned long POLYGON_OFFSET_UNITS           = 0x2A00;
-  /*      GL_POLYGON_OFFSET_FILL */
-  const unsigned long POLYGON_OFFSET_FACTOR          = 0x8038;
-  const unsigned long TEXTURE_BINDING_2D             = 0x8069;
-  const unsigned long SAMPLE_BUFFERS                 = 0x80A8;
-  const unsigned long SAMPLES                        = 0x80A9;
-  const unsigned long SAMPLE_COVERAGE_VALUE          = 0x80AA;
-  const unsigned long SAMPLE_COVERAGE_INVERT         = 0x80AB;
-
-  /* GetTextureParameter */
-  /*      GL_TEXTURE_MAG_FILTER */
-  /*      GL_TEXTURE_MIN_FILTER */
-  /*      GL_TEXTURE_WRAP_S */
-  /*      GL_TEXTURE_WRAP_T */
-
-  const unsigned long NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
-  const unsigned long COMPRESSED_TEXTURE_FORMATS     = 0x86A3;
-
-  /* HintMode */
-  const unsigned long DONT_CARE                      = 0x1100;
-  const unsigned long FASTEST                        = 0x1101;
-  const unsigned long NICEST                         = 0x1102;
-
-  /* HintTarget */
-  const unsigned long GENERATE_MIPMAP_HINT            = 0x8192;
-
-  /* DataType */
-  const unsigned long BYTE                           = 0x1400;
-  const unsigned long UNSIGNED_BYTE                  = 0x1401;
-  const unsigned long SHORT                          = 0x1402;
-  const unsigned long UNSIGNED_SHORT                 = 0x1403;
-  const unsigned long INT                            = 0x1404;
-  const unsigned long UNSIGNED_INT                   = 0x1405;
-  const unsigned long FLOAT                          = 0x1406;
-
-  /* PixelFormat */
-  const unsigned long DEPTH_COMPONENT                = 0x1902;
-  const unsigned long ALPHA                          = 0x1906;
-  const unsigned long RGB                            = 0x1907;
-  const unsigned long RGBA                           = 0x1908;
-  const unsigned long LUMINANCE                      = 0x1909;
-  const unsigned long LUMINANCE_ALPHA                = 0x190A;
-
-  /* PixelType */
-  /*      GL_UNSIGNED_BYTE */
-  const unsigned long UNSIGNED_SHORT_4_4_4_4         = 0x8033;
-  const unsigned long UNSIGNED_SHORT_5_5_5_1         = 0x8034;
-  const unsigned long UNSIGNED_SHORT_5_6_5           = 0x8363;
-
-  /* Shaders */
-  const unsigned long FRAGMENT_SHADER                  = 0x8B30;
-  const unsigned long VERTEX_SHADER                    = 0x8B31;
-  const unsigned long MAX_VERTEX_ATTRIBS               = 0x8869;
-  const unsigned long MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
-  const unsigned long MAX_VARYING_VECTORS              = 0x8DFC;
-  const unsigned long MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
-  const unsigned long MAX_VERTEX_TEXTURE_IMAGE_UNITS   = 0x8B4C;
-  const unsigned long MAX_TEXTURE_IMAGE_UNITS          = 0x8872;
-  const unsigned long MAX_FRAGMENT_UNIFORM_VECTORS     = 0x8DFD;
-  const unsigned long SHADER_TYPE                      = 0x8B4F;
-  const unsigned long DELETE_STATUS                    = 0x8B80;
-  const unsigned long LINK_STATUS                      = 0x8B82;
-  const unsigned long VALIDATE_STATUS                  = 0x8B83;
-  const unsigned long ATTACHED_SHADERS                 = 0x8B85;
-  const unsigned long ACTIVE_UNIFORMS                  = 0x8B86;
-  const unsigned long ACTIVE_ATTRIBUTES                = 0x8B89;
-  const unsigned long SHADING_LANGUAGE_VERSION         = 0x8B8C;
-  const unsigned long CURRENT_PROGRAM                  = 0x8B8D;
-
-  /* StencilFunction */
-  const unsigned long NEVER                          = 0x0200;
-  const unsigned long LESS                           = 0x0201;
-  const unsigned long EQUAL                          = 0x0202;
-  const unsigned long LEQUAL                         = 0x0203;
-  const unsigned long GREATER                        = 0x0204;
-  const unsigned long NOTEQUAL                       = 0x0205;
-  const unsigned long GEQUAL                         = 0x0206;
-  const unsigned long ALWAYS                         = 0x0207;
-
-  /* StencilOp */
-  /*      GL_ZERO */
-  const unsigned long KEEP                           = 0x1E00;
-  const unsigned long REPLACE                        = 0x1E01;
-  const unsigned long INCR                           = 0x1E02;
-  const unsigned long DECR                           = 0x1E03;
-  const unsigned long INVERT                         = 0x150A;
-  const unsigned long INCR_WRAP                      = 0x8507;
-  const unsigned long DECR_WRAP                      = 0x8508;
-
-  /* StringName */
-  const unsigned long VENDOR                         = 0x1F00;
-  const unsigned long RENDERER                       = 0x1F01;
-  const unsigned long VERSION                        = 0x1F02;
-  const unsigned long EXTENSIONS                     = 0x1F03;
-
-  /* TextureMagFilter */
-  const unsigned long NEAREST                        = 0x2600;
-  const unsigned long LINEAR                         = 0x2601;
-
-  /* TextureMinFilter */
-  /*      GL_NEAREST */
-  /*      GL_LINEAR */
-  const unsigned long NEAREST_MIPMAP_NEAREST         = 0x2700;
-  const unsigned long LINEAR_MIPMAP_NEAREST          = 0x2701;
-  const unsigned long NEAREST_MIPMAP_LINEAR          = 0x2702;
-  const unsigned long LINEAR_MIPMAP_LINEAR           = 0x2703;
-
-  /* TextureParameterName */
-  const unsigned long TEXTURE_MAG_FILTER             = 0x2800;
-  const unsigned long TEXTURE_MIN_FILTER             = 0x2801;
-  const unsigned long TEXTURE_WRAP_S                 = 0x2802;
-  const unsigned long TEXTURE_WRAP_T                 = 0x2803;
-
-  /* TextureTarget */
-  /*      GL_TEXTURE_2D */
-  const unsigned long TEXTURE                        = 0x1702;
-
-  const unsigned long TEXTURE_CUBE_MAP               = 0x8513;
-  const unsigned long TEXTURE_BINDING_CUBE_MAP       = 0x8514;
-  const unsigned long TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515;
-  const unsigned long TEXTURE_CUBE_MAP_NEGATIVE_X    = 0x8516;
-  const unsigned long TEXTURE_CUBE_MAP_POSITIVE_Y    = 0x8517;
-  const unsigned long TEXTURE_CUBE_MAP_NEGATIVE_Y    = 0x8518;
-  const unsigned long TEXTURE_CUBE_MAP_POSITIVE_Z    = 0x8519;
-  const unsigned long TEXTURE_CUBE_MAP_NEGATIVE_Z    = 0x851A;
-  const unsigned long MAX_CUBE_MAP_TEXTURE_SIZE      = 0x851C;
-
-  /* TextureUnit */
-  const unsigned long TEXTURE0                       = 0x84C0;
-  const unsigned long TEXTURE1                       = 0x84C1;
-  const unsigned long TEXTURE2                       = 0x84C2;
-  const unsigned long TEXTURE3                       = 0x84C3;
-  const unsigned long TEXTURE4                       = 0x84C4;
-  const unsigned long TEXTURE5                       = 0x84C5;
-  const unsigned long TEXTURE6                       = 0x84C6;
-  const unsigned long TEXTURE7                       = 0x84C7;
-  const unsigned long TEXTURE8                       = 0x84C8;
-  const unsigned long TEXTURE9                       = 0x84C9;
-  const unsigned long TEXTURE10                      = 0x84CA;
-  const unsigned long TEXTURE11                      = 0x84CB;
-  const unsigned long TEXTURE12                      = 0x84CC;
-  const unsigned long TEXTURE13                      = 0x84CD;
-  const unsigned long TEXTURE14                      = 0x84CE;
-  const unsigned long TEXTURE15                      = 0x84CF;
-  const unsigned long TEXTURE16                      = 0x84D0;
-  const unsigned long TEXTURE17                      = 0x84D1;
-  const unsigned long TEXTURE18                      = 0x84D2;
-  const unsigned long TEXTURE19                      = 0x84D3;
-  const unsigned long TEXTURE20                      = 0x84D4;
-  const unsigned long TEXTURE21                      = 0x84D5;
-  const unsigned long TEXTURE22                      = 0x84D6;
-  const unsigned long TEXTURE23                      = 0x84D7;
-  const unsigned long TEXTURE24                      = 0x84D8;
-  const unsigned long TEXTURE25                      = 0x84D9;
-  const unsigned long TEXTURE26                      = 0x84DA;
-  const unsigned long TEXTURE27                      = 0x84DB;
-  const unsigned long TEXTURE28                      = 0x84DC;
-  const unsigned long TEXTURE29                      = 0x84DD;
-  const unsigned long TEXTURE30                      = 0x84DE;
-  const unsigned long TEXTURE31                      = 0x84DF;
-  const unsigned long ACTIVE_TEXTURE                 = 0x84E0;
-
-  /* TextureWrapMode */
-  const unsigned long REPEAT                         = 0x2901;
-  const unsigned long CLAMP_TO_EDGE                  = 0x812F;
-  const unsigned long MIRRORED_REPEAT                = 0x8370;
-
-  /* Uniform Types */
-  const unsigned long FLOAT_VEC2                     = 0x8B50;
-  const unsigned long FLOAT_VEC3                     = 0x8B51;
-  const unsigned long FLOAT_VEC4                     = 0x8B52;
-  const unsigned long INT_VEC2                       = 0x8B53;
-  const unsigned long INT_VEC3                       = 0x8B54;
-  const unsigned long INT_VEC4                       = 0x8B55;
-  const unsigned long BOOL                           = 0x8B56;
-  const unsigned long BOOL_VEC2                      = 0x8B57;
-  const unsigned long BOOL_VEC3                      = 0x8B58;
-  const unsigned long BOOL_VEC4                      = 0x8B59;
-  const unsigned long FLOAT_MAT2                     = 0x8B5A;
-  const unsigned long FLOAT_MAT3                     = 0x8B5B;
-  const unsigned long FLOAT_MAT4                     = 0x8B5C;
-  const unsigned long SAMPLER_2D                     = 0x8B5E;
-  const unsigned long SAMPLER_CUBE                   = 0x8B60;
-
-  /* Vertex Arrays */
-  const unsigned long VERTEX_ATTRIB_ARRAY_ENABLED        = 0x8622;
-  const unsigned long VERTEX_ATTRIB_ARRAY_SIZE           = 0x8623;
-  const unsigned long VERTEX_ATTRIB_ARRAY_STRIDE         = 0x8624;
-  const unsigned long VERTEX_ATTRIB_ARRAY_TYPE           = 0x8625;
-  const unsigned long VERTEX_ATTRIB_ARRAY_NORMALIZED     = 0x886A;
-  const unsigned long VERTEX_ATTRIB_ARRAY_POINTER        = 0x8645;
-  const unsigned long VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
-
-  /* Shader Source */
-  const unsigned long COMPILE_STATUS                 = 0x8B81;
-  const unsigned long SHADER_COMPILER                = 0x8DFA;
-
-  /* Shader Precision-Specified Types */
-  const unsigned long LOW_FLOAT                      = 0x8DF0;
-  const unsigned long MEDIUM_FLOAT                   = 0x8DF1;
-  const unsigned long HIGH_FLOAT                     = 0x8DF2;
-  const unsigned long LOW_INT                        = 0x8DF3;
-  const unsigned long MEDIUM_INT                     = 0x8DF4;
-  const unsigned long HIGH_INT                       = 0x8DF5;
-
-  /* Framebuffer Object. */
-  const unsigned long FRAMEBUFFER                    = 0x8D40;
-  const unsigned long RENDERBUFFER                   = 0x8D41;
-
-  const unsigned long RGBA4                          = 0x8056;
-  const unsigned long RGB5_A1                        = 0x8057;
-  const unsigned long RGB565                         = 0x8D62;
-  const unsigned long DEPTH_COMPONENT16              = 0x81A5;
-  const unsigned long STENCIL_INDEX                  = 0x1901;
-  const unsigned long STENCIL_INDEX8                 = 0x8D48;
-  const unsigned long DEPTH_STENCIL                  = 0x84F9;
-
-  const unsigned long RENDERBUFFER_WIDTH             = 0x8D42;
-  const unsigned long RENDERBUFFER_HEIGHT            = 0x8D43;
-  const unsigned long RENDERBUFFER_INTERNAL_FORMAT   = 0x8D44;
-  const unsigned long RENDERBUFFER_RED_SIZE          = 0x8D50;
-  const unsigned long RENDERBUFFER_GREEN_SIZE        = 0x8D51;
-  const unsigned long RENDERBUFFER_BLUE_SIZE         = 0x8D52;
-  const unsigned long RENDERBUFFER_ALPHA_SIZE        = 0x8D53;
-  const unsigned long RENDERBUFFER_DEPTH_SIZE        = 0x8D54;
-  const unsigned long RENDERBUFFER_STENCIL_SIZE      = 0x8D55;
-
-  const unsigned long FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           = 0x8CD0;
-  const unsigned long FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           = 0x8CD1;
-  const unsigned long FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         = 0x8CD2;
-  const unsigned long FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
-
-  const unsigned long COLOR_ATTACHMENT0              = 0x8CE0;
-  const unsigned long DEPTH_ATTACHMENT               = 0x8D00;
-  const unsigned long STENCIL_ATTACHMENT             = 0x8D20;
-  const unsigned long DEPTH_STENCIL_ATTACHMENT       = 0x821A;
-
-  const unsigned long NONE                           = 0;
-
-  const unsigned long FRAMEBUFFER_COMPLETE                      = 0x8CD5;
-  const unsigned long FRAMEBUFFER_INCOMPLETE_ATTACHMENT         = 0x8CD6;
-  const unsigned long FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
-  const unsigned long FRAMEBUFFER_INCOMPLETE_DIMENSIONS         = 0x8CD9;
-  const unsigned long FRAMEBUFFER_UNSUPPORTED                   = 0x8CDD;
-
-  const unsigned long FRAMEBUFFER_BINDING            = 0x8CA6;
-  const unsigned long RENDERBUFFER_BINDING           = 0x8CA7;
-  const unsigned long MAX_RENDERBUFFER_SIZE          = 0x84E8;
-
-  const unsigned long INVALID_FRAMEBUFFER_OPERATION  = 0x0506;
-
-  const unsigned long UNPACK_FLIP_Y_WEBGL            = 0x9240;
-  const unsigned long UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
-  const unsigned long CONTEXT_LOST_WEBGL             = 0x9242;
-  const unsigned long UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
-  const unsigned long BROWSER_DEFAULT_WEBGL          = 0x9244;
-
-  //
-  //  ATTRIBUTES
-  //
-  readonly attribute nsIDOMHTMLCanvasElement canvas;
-
-  //
-  //  METHODS
-  //
-  jsval getContextAttributes();
-
-  [binaryname(MozActiveTexture)]
-  void activeTexture(in WebGLenum texture);
-
-  void attachShader([optional] in nsIWebGLProgram program, [optional] in nsIWebGLShader shader);
-  void bindAttribLocation(in nsIWebGLProgram program, in WebGLuint index, in DOMString name);
-  void bindBuffer(in WebGLenum target, in nsIWebGLBuffer buffer);
-  void bindFramebuffer(in WebGLenum target, in nsIWebGLFramebuffer framebuffer);
-  void bindRenderbuffer(in WebGLenum target, in nsIWebGLRenderbuffer renderbuffer);
-  void bindTexture(in WebGLenum target, in nsIWebGLTexture texture);
-
-  [binaryname(MozBlendColor)]
-  void blendColor(in WebGLclampf red, in WebGLclampf green, in WebGLclampf blue, in WebGLclampf alpha);
-
-  [binaryname(MozBlendEquation)]
-  void blendEquation(in WebGLenum mode);
-
-  [binaryname(MozBlendEquationSeparate)]
-  void blendEquationSeparate(in WebGLenum modeRGB, in WebGLenum modeAlpha);
-
-  [binaryname(MozBlendFunc)]
-  void blendFunc(in WebGLenum sfactor, in WebGLenum dfactor);
-
-  [binaryname(MozBlendFuncSeparate)]
-  void blendFuncSeparate(in WebGLenum srcRGB, in WebGLenum dstRGB, in WebGLenum srcAlpha, in WebGLenum dstAlpha);
-
-  // Modified: void glBufferData(WebGLenum target, long size, const void* data, WebGLenum usage);
-  [implicit_jscontext] void bufferData(in WebGLenum target, in jsval data, in WebGLenum usage);
-
-  [implicit_jscontext] void bufferSubData(in WebGLenum target, in WebGLintptr offset, in jsval data);
-
-  WebGLenum checkFramebufferStatus(in WebGLenum target);
-
-  [binaryname(MozClear)]
-  void clear(in WebGLbitfield mask);
-
-  [binaryname(MozClearColor)]
-  void clearColor(in WebGLclampf red, in WebGLclampf green, in WebGLclampf blue, in WebGLclampf alpha);
-
-  [binaryname(MozClearDepth)]
-  void clearDepth(in WebGLclampf depth);
-
-  [binaryname(MozClearStencil)]
-  void clearStencil(in WebGLint s);
-
-  [binaryname(MozColorMask)]
-  void colorMask(in WebGLboolean red, in WebGLboolean green, in WebGLboolean blue, in WebGLboolean alpha);
-
-  void compileShader([optional] in nsIWebGLShader shader);
-
-  [implicit_jscontext] void compressedTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
-                            in WebGLsizei width, in WebGLsizei height, in WebGLint border,
-                            in jsval pixels);
-
-  [implicit_jscontext] void compressedTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
-                               in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
-                               in WebGLenum format, in jsval pixels);
-
-  [binaryname(MozCopyTexImage2D)]
-  void copyTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat, 
-                      in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height, in WebGLint border);
-
-  [binaryname(MozCopyTexSubImage2D)]
-  void copyTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset, in WebGLint yoffset, 
-                         in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height);
-
-  nsIWebGLBuffer createBuffer();
-  nsIWebGLProgram createProgram();
-  nsIWebGLFramebuffer createFramebuffer();
-  nsIWebGLRenderbuffer createRenderbuffer();
-  nsIWebGLShader createShader(in WebGLenum type);
-  nsIWebGLTexture createTexture();
-
-  [binaryname(MozCullFace)]
-  void cullFace(in WebGLenum mode);
-
-  void deleteBuffer(in nsIWebGLBuffer buffer);
-  void deleteProgram(in nsIWebGLProgram program);
-  void deleteFramebuffer(in nsIWebGLFramebuffer framebuffer);
-  void deleteRenderbuffer(in nsIWebGLRenderbuffer renderbuffer);
-  void deleteShader(in nsIWebGLShader shader);
-  void deleteTexture(in nsIWebGLTexture texture);
-
-  [binaryname(MozDepthFunc)]
-  void depthFunc(in WebGLenum func);
-
-  [binaryname(MozDepthMask)]
-  void depthMask(in WebGLboolean flag);
-
-  [binaryname(MozDepthRange)]
-  void depthRange(in WebGLclampf zNear, in WebGLclampf zFar);
-
-  void detachShader(in nsIWebGLProgram program, in nsIWebGLShader shader);
-
-  [binaryname(MozDisable)]
-  void disable(in WebGLenum cap);
-
-  [binaryname(MozDisableVertexAttribArray)]
-  void disableVertexAttribArray(in WebGLuint index);
-
-  [binaryname(MozDrawArrays)]
-  void drawArrays(in WebGLenum mode, in WebGLint first, in WebGLsizei count);
-
-  // Modified: void glDrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, const void* indices);
-  [binaryname(MozDrawElements)]
-  void drawElements(in WebGLenum mode, in WebGLsizei count, in WebGLenum type, in WebGLintptr offset);
-
-  [binaryname(MozEnable)]
-  void enable(in WebGLenum cap);
-
-  [binaryname(MozEnableVertexAttribArray)]
-  void enableVertexAttribArray(in WebGLuint index);
-
-  [binaryname(MozFinish)]
-  void finish();
-
-  [binaryname(MozFlush)]
-  void flush();
-
-  void framebufferRenderbuffer(in WebGLenum target, in WebGLenum attachment, in WebGLenum renderbuffertarget, 
-                               in nsIWebGLRenderbuffer renderbuffer);
-  void framebufferTexture2D(in WebGLenum target, in WebGLenum attachment, in WebGLenum textarget, 
-                            in nsIWebGLTexture texture, in WebGLint level);
-
-  [binaryname(MozFrontFace)]
-  void frontFace(in WebGLenum mode);
-
-  [binaryname(MozGenerateMipmap)]
-  void generateMipmap(in WebGLenum target);
-
-  nsIWebGLActiveInfo getActiveAttrib(in nsIWebGLProgram program, in uint32_t index);
-  nsIWebGLActiveInfo getActiveUniform(in nsIWebGLProgram program, in uint32_t index);
-
-  nsIVariant getAttachedShaders(in nsIWebGLProgram program);
-
-  WebGLint getAttribLocation(in nsIWebGLProgram program, in DOMString name);
-
-  [implicit_jscontext] jsval
-  getParameter(in WebGLenum pname);
-
-  // Modified: void glGetBufferParameteriv(WebGLenum target, WebGLenum pname, WebGLint* params);
-  jsval getBufferParameter(in WebGLenum target, in WebGLenum pname);
-
-  [binaryname(MozGetError)]
-  WebGLenum getError();
-
-  // Modified: void glGetFramebufferAttachmentParameteriv(WebGLenum target, WebGLenum attachment, WebGLenum pname, WebGLint* params);
-  [implicit_jscontext] jsval
-  getFramebufferAttachmentParameter(in WebGLenum target, in WebGLenum attachment, in WebGLenum pname);
-
-  // Modified: void glGetProgramiv(nsIWebGLProgram program, WebGLenum pname, WebGLint* params);
-  jsval getProgramParameter(in nsIWebGLProgram program, in WebGLenum pname);
-
-  // Modified: void glGetProgramInfoLog(WebGLuint program, WebGLsizei bufsize, WebGLsizei* length, char* infolog);
-  DOMString getProgramInfoLog(in nsIWebGLProgram program);
-
-  // Modified: void glGetRenderbufferParameteriv(WebGLenum target, WebGLenum pname, WebGLint* params);
-  //nsIWebGLIntArray getRenderbufferParameteriv(in WebGLenum target, in WebGLenum pname);
-  jsval getRenderbufferParameter(in WebGLenum target, in WebGLenum pname);
-
-  jsval getShaderParameter(in nsIWebGLShader shader, in WebGLenum pname);
-
-  // Modified: void glGetShaderInfoLog(WebGLuint shader, WebGLsizei bufsize, WebGLsizei* length, char* infolog);
-  DOMString getShaderInfoLog(in nsIWebGLShader shader);
-
-  nsIWebGLShaderPrecisionFormat getShaderPrecisionFormat(in WebGLenum shadertype, in WebGLenum precisiontype);
-
-  DOMString getShaderSource(in nsIWebGLShader shader);
-
-  jsval getTexParameter(in WebGLenum target, in WebGLenum pname);
-
-  [implicit_jscontext]
-  jsval getUniform(in nsIWebGLProgram program, in nsIWebGLUniformLocation location);
-
-  nsIWebGLUniformLocation getUniformLocation (in nsIWebGLProgram program, in DOMString name);
-
-  [implicit_jscontext] jsval
-  getVertexAttrib(in WebGLuint index, in WebGLenum pname);
-
-  // TBD
-  // void glGetVertexAttribPointerv(WebGLuint index, WebGLenum pname, void** pointer);
-  WebGLuint getVertexAttribOffset(in WebGLuint index, in WebGLenum pname);
-
-  [binaryname(MozHint)]
-  void hint(in WebGLenum target, in WebGLenum mode);
-
-  WebGLboolean isBuffer(in nsIWebGLBuffer buffer);
-  WebGLboolean isFramebuffer(in nsIWebGLFramebuffer framebuffer);
-  WebGLboolean isProgram(in nsIWebGLProgram program);
-  WebGLboolean isRenderbuffer(in nsIWebGLRenderbuffer renderbuffer);
-  WebGLboolean isShader(in nsIWebGLShader shader);
-  WebGLboolean isTexture(in nsIWebGLTexture texture);
-
-  WebGLboolean isEnabled(in WebGLenum cap);
-
-  [binaryname(MozLineWidth)]
-  void lineWidth(in WebGLfloat width);
-
-  void linkProgram([optional] in nsIWebGLProgram program);
-
-  [binaryname(MozPixelStorei)]
-  void pixelStorei(in WebGLenum pname, in WebGLint param);
-
-  [binaryname(MozPolygonOffset)]
-  void polygonOffset(in WebGLfloat factor, in WebGLfloat units);
-
-  [implicit_jscontext] void readPixels(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
-                  in WebGLenum format, in WebGLenum type, in jsval pixels);
-
-  //void glReleaseShaderCompiler();
-
-  [binaryname(MozRenderbufferStorage)]
-  void renderbufferStorage(in WebGLenum target, in WebGLenum internalformat, in WebGLsizei width, in WebGLsizei height);
-
-  [binaryname(MozSampleCoverage)]
-  void sampleCoverage(in WebGLclampf value, in WebGLboolean invert);
-
-  [binaryname(MozScissor)]
-  void scissor(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height);
-
-  // Modified: void glShaderSource(WebGLuint shader, WebGLsizei count, const char** string, const WebGLint* length);
-  void shaderSource([optional] in nsIWebGLShader shader, [optional] in DOMString source);
-
-  [binaryname(MozStencilFunc)]
-  void stencilFunc(in WebGLenum func, in WebGLint ref, in WebGLuint mask);
-
-  [binaryname(MozStencilFuncSeparate)]
-  void stencilFuncSeparate(in WebGLenum face, in WebGLenum func, in WebGLint ref, in WebGLuint mask);
-
-  [binaryname(MozStencilMask)]
-  void stencilMask(in WebGLuint mask);
-
-  [binaryname(MozStencilMaskSeparate)]
-  void stencilMaskSeparate(in WebGLenum face, in WebGLuint mask);
-
-  [binaryname(MozStencilOp)]
-  void stencilOp(in WebGLenum fail, in WebGLenum zfail, in WebGLenum zpass);
-
-  [binaryname(MozStencilOpSeparate)]
-  void stencilOpSeparate(in WebGLenum face, in WebGLenum fail, in WebGLenum zfail, in WebGLenum zpass);
-
-  void texImage2D([optional] in long dummy);
-  [noscript,implicit_jscontext] void texImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
-                                   in WebGLsizei width, in WebGLsizei height,
-                                   in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
-  [noscript,implicit_jscontext] void texImage2D_imageData(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
-                                   in WebGLsizei width, in WebGLsizei height,
-                                   in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
-
-  // HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
-  [noscript] void texImage2D_dom(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
-                                 in WebGLenum format, in WebGLenum type, in Element element);
-
-  void texSubImage2D([optional] in long dummy);
-  [noscript,implicit_jscontext] void texSubImage2D_array(in WebGLenum target, in WebGLint level,
-                                      in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
-                                      in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
-  [noscript,implicit_jscontext] void texSubImage2D_imageData(in WebGLenum target, in WebGLint level,
-                                      in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
-                                      in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
-  // HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
-  [noscript] void texSubImage2D_dom(in WebGLenum target, in WebGLint level,
-                                    in WebGLint xoffset, in WebGLint yoffset, in WebGLenum format, in WebGLenum type,
-                                    in Element element);
-
-  // Modified: This replaces glTexParameterf, glTexParameterfv, glTexParameteri and glTexParameteriv
-  [binaryname(MozTexParameterf)]
-  void texParameterf(in WebGLenum target, in WebGLenum pname, in WebGLfloat param);
-
-  [binaryname(MozTexParameteri)]
-  void texParameteri(in WebGLenum target, in WebGLenum pname, in WebGLint param);
-  //void glTexParameter(in WebGLenum target, in WebGLenum pname, in nsIWebGLArray params);
-
-  // Modified: All the glUniform*v forms below are modified by replacing 'count' and 'v' with a nsIWebGLArray
-  void uniform1f (in nsIWebGLUniformLocation location, in WebGLfloat x);
-  void uniform1i (in nsIWebGLUniformLocation location, in WebGLint x);
-  void uniform2f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y);
-  void uniform2i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y);
-  void uniform3f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z);
-  void uniform3i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y, in WebGLint z);
-  void uniform4f (in nsIWebGLUniformLocation location, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z, in WebGLfloat w);
-  void uniform4i (in nsIWebGLUniformLocation location, in WebGLint x, in WebGLint y, in WebGLint z, in WebGLint w);
-
-  [implicit_jscontext] void uniform1fv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform1iv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform2fv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform2iv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform3fv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform3iv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform4fv(in nsIWebGLUniformLocation location, in jsval v);
-  [implicit_jscontext] void uniform4iv(in nsIWebGLUniformLocation location, in jsval v);
-
-  [implicit_jscontext] void uniformMatrix2fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
-  [implicit_jscontext] void uniformMatrix3fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
-  [implicit_jscontext] void uniformMatrix4fv(in nsIWebGLUniformLocation location, in boolean transpose, in jsval value);
-
-  // Added API using top entry from the passed nsIWebGLMatrixStack
-  //ZZ void glUniformMatrix(in WebGLint location, in WebGLboolean transpose, in nsIWebGLMatrixStack value);
-
-  void useProgram(in nsIWebGLProgram program);
-  void validateProgram(in nsIWebGLProgram program);
-
-  // Modified: All the glVertexAttrib*v forms below are modified by replacing 'values' with a WebGLJSObjectPtr
-  [binaryname(MozVertexAttrib1f)]
-  void vertexAttrib1f(in WebGLuint indx, in WebGLfloat x);
-
-  [binaryname(MozVertexAttrib2f)]
-  void vertexAttrib2f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y);
-
-  [binaryname(MozVertexAttrib3f)]
-  void vertexAttrib3f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z);
-
-  [binaryname(MozVertexAttrib4f)]
-  void vertexAttrib4f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z, in WebGLfloat w);
-
-  [implicit_jscontext] void vertexAttrib1fv(in WebGLuint indx, in jsval values);
-  [implicit_jscontext] void vertexAttrib2fv(in WebGLuint indx, in jsval values);
-  [implicit_jscontext] void vertexAttrib3fv(in WebGLuint indx, in jsval values);
-  [implicit_jscontext] void vertexAttrib4fv(in WebGLuint indx, in jsval values);
-
-  // size is number of elements per attrib; offset, stride are in bytes
-  [binaryname(MozVertexAttribPointer)]
-  void vertexAttribPointer(in WebGLuint idx, in WebGLint size, in WebGLenum type, in WebGLboolean normalized, in WebGLsizei stride, in WebGLintptr offset);
-
-  [binaryname(MozViewport)]
-  void viewport(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height);
-
   // get an underlying GL parameter, without any WebGL intervention.
   // Most useful for querying GL_VENDOR/GL_RENDERER for identifying
   // the underlying renderer to the user.
   [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname);
-
-  // extensions
-  nsIWebGLExtension getExtension(in DOMString name);
-
-  nsIVariant getSupportedExtensions();
-  WebGLboolean isContextLost();
-
-  readonly attribute WebGLsizei drawingBufferWidth;
-  readonly attribute WebGLsizei drawingBufferHeight;
 };
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -424,21 +424,16 @@ members = [
     '-nsIXMLHttpRequest.getAllResponseHeaders',
     '-nsIXMLHttpRequest.getResponseHeader',
     '-nsIXMLHttpRequest.setRequestHeader',
     '-nsIXMLHttpRequest.overrideMimeType',
     # nsIXMLHttpRequestUpload doesn't live in its own IDL file, so
     # can't be quickstubbed
     '-nsIXMLHttpRequest.upload',
 
-    # webgl
-    'nsIDOMWebGLRenderingContext.*',
-    # getContextAttributes is directly manipulating its return value
-    '-nsIDOMWebGLRenderingContext.getContextAttributes',
-
     # Audio
     'nsIDOMNotifyAudioAvailableEvent.frameBuffer',
     'nsIDOMNotifyAudioAvailableEvent.time',
     'nsIDOMHTMLAudioElement.mozWriteAudio',
 
     # dom/indexedDB
     'nsIIDBCursor.*',
     'nsIIDBCursorWithValue.*',
@@ -522,17 +517,16 @@ customIncludes = [
     'nsGenericHTMLElement.h',
     'nsSVGStylableElement.h',
     'nsHTMLDocument.h',
     'nsDOMQS.h',
     'mozilla/dom/ImageData.h'
     ]
 
 customQuickStubs = [
-    'CustomQS_WebGL.h',
     'CustomQS_Canvas2D.h'
     ]
 
 customReturnInterfaces = [
     'nsIDOMCanvasPattern',
     'nsIDOMCanvasGradient',
     'nsIDOMImageData'
     ]
@@ -958,19 +952,16 @@ customMethodCalls = {
     'nsIDOMWindow_GetOnmouseleave' : {
         'thisType' : 'nsIDOMWindow',
         'unwrapThisFailureFatal' : False
         },
     'nsIDOMWindow_SetOnmouseleave' : {
         'thisType' : 'nsIDOMWindow',
         'unwrapThisFailureFatal' : False
         },
-    # WebGL
-    'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
-    'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
     # Canvas 2D
     'nsIDOMCanvasRenderingContext2D_CreateImageData': CUSTOM_QS,
     'nsIDOMCanvasRenderingContext2D_PutImageData': CUSTOM_QS,
     # Nasty hack to make the ordering of |arc| and |arcTo| correct.
     # |arc| is not traceable because it has an optional argument.
     'nsIDOMCanvasRenderingContext2D_ArcTo' : { 'traceable' : False },
 
     'nsIDOMImageData_GetWidth': {