Backout
authorKyle Huey <khuey@kylehuey.com>
Fri, 11 Feb 2011 23:08:16 -0500
changeset 62449 033e22fe2d64d0bbd248f983e373f46ac4218060
parent 62441 0f7eea1692b24ddbac1d488e7d7bb7f69a2c3b0c
child 62450 80211f053c460974302e5ee1375386bb086a2f0b
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
milestone2.0b12pre
Backout
content/canvas/src/WebGLContext.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextValidate.cpp
content/canvas/test/webgl/failing_tests_linux.txt
content/canvas/test/webgl/failing_tests_mac.txt
content/canvas/test/webgl/failing_tests_windows.txt
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
gfx/src/X11Util.cpp
gfx/src/X11Util.h
gfx/thebes/GLContext.cpp
gfx/thebes/GLContext.h
gfx/thebes/GLContextProviderGLX.cpp
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -888,39 +888,8 @@ WebGLActiveInfo::GetType(WebGLenum *aTyp
 
 /* readonly attribute DOMString name; */
 NS_IMETHODIMP
 WebGLActiveInfo::GetName(nsAString & aName)
 {
     aName = mName;
     return NS_OK;
 }
-
-NS_IMETHODIMP
-WebGLContext::GetSupportedExtensions(nsIVariant **retval)
-{
-    nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
-    NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
-
-    nsTArray<const char *> extList;
-
-    /* no extensions to add to extList */
-
-    nsresult rv;
-    if (extList.Length() > 0) {
-        rv = wrval->SetAsArray(nsIDataType::VTYPE_CHAR_STR, nsnull,
-                               extList.Length(), &extList[0]);
-    } else {
-        rv = wrval->SetAsEmptyArray();
-    }
-    if (NS_FAILED(rv))
-        return rv;
-
-    *retval = wrval.forget().get();
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-WebGLContext::GetExtension(const nsAString& aName, nsISupports **retval)
-{
-    *retval = nsnull;
-    return NS_OK;
-}
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -661,17 +661,17 @@ class WebGLBuffer :
     public WebGLZeroingObject,
     public WebGLContextBoundObject
 {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(WEBGLBUFFER_PRIVATE_IID)
 
     WebGLBuffer(WebGLContext *context, WebGLuint name) :
         WebGLContextBoundObject(context),
-        mName(name), mDeleted(PR_FALSE), mHasEverBeenBound(PR_FALSE),
+        mName(name), mDeleted(PR_FALSE),
         mByteLength(0), mTarget(LOCAL_GL_NONE), mData(nsnull)
     { }
 
     ~WebGLBuffer() {
         Delete();
     }
 
     void Delete() {
@@ -682,18 +682,16 @@ public:
         free(mData);
         mData = nsnull;
 
         mDeleted = PR_TRUE;
         mByteLength = 0;
     }
 
     PRBool Deleted() const { return mDeleted; }
-    PRBool HasEverBeenBound() { return mHasEverBeenBound; }
-    void SetHasEverBeenBound(PRBool x) { mHasEverBeenBound = x; }
     GLuint GLName() const { return mName; }
     GLuint ByteLength() const { return mByteLength; }
     GLenum Target() const { return mTarget; }
     const void *Data() const { return mData; }
 
     void SetByteLength(GLuint byteLength) { mByteLength = byteLength; }
     void SetTarget(GLenum target) { mTarget = target; }
 
@@ -761,25 +759,24 @@ public:
       }
     }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBGLBUFFER
 protected:
     WebGLuint mName;
     PRBool mDeleted;
-    PRBool mHasEverBeenBound;
     GLuint mByteLength;
     GLenum mTarget;
 
     PRUint8 mCachedMaxUbyteElement;
     PRBool mHasCachedMaxUbyteElement;
     PRUint16 mCachedMaxUshortElement;
     PRBool mHasCachedMaxUshortElement;
-
+    
     void* mData; // in the case of an Element Array Buffer, we keep a copy.
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(WebGLBuffer, WEBGLBUFFER_PRIVATE_IID)
 
 #define WEBGLTEXTURE_PRIVATE_IID \
     {0x4c19f189, 0x1f86, 0x4e61, {0x96, 0x21, 0x0a, 0x11, 0xda, 0x28, 0x10, 0xdd}}
 class WebGLTexture :
@@ -788,17 +785,17 @@ class WebGLTexture :
     public WebGLRectangleObject,
     public WebGLContextBoundObject
 {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(WEBGLTEXTURE_PRIVATE_IID)
 
     WebGLTexture(WebGLContext *context, WebGLuint name) :
         WebGLContextBoundObject(context),
-        mDeleted(PR_FALSE), mHasEverBeenBound(PR_FALSE), mName(name),
+        mDeleted(PR_FALSE), mName(name),
         mTarget(0),
         mMinFilter(LOCAL_GL_NEAREST_MIPMAP_LINEAR),
         mMagFilter(LOCAL_GL_LINEAR),
         mWrapS(LOCAL_GL_REPEAT),
         mWrapT(LOCAL_GL_REPEAT),
         mFacesCount(0),
         mMaxLevelWithCustomImages(0),
         mHaveGeneratedMipmap(PR_FALSE),
@@ -809,29 +806,26 @@ public:
     void Delete() {
         if (mDeleted)
             return;
         ZeroOwners();
         mDeleted = PR_TRUE;
     }
 
     PRBool Deleted() { return mDeleted; }
-    PRBool HasEverBeenBound() { return mHasEverBeenBound; }
-    void SetHasEverBeenBound(PRBool x) { mHasEverBeenBound = x; }
     WebGLuint GLName() { return mName; }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBGLTEXTURE
 
 protected:
     friend class WebGLContext;
     friend class WebGLFramebuffer;
 
     PRBool mDeleted;
-    PRBool mHasEverBeenBound;
     WebGLuint mName;
 
     // we store information about the various images that are part of
     // this texture (cubemap faces, mipmap levels)
 
     struct ImageInfo {
         ImageInfo() : mWidth(0), mHeight(0), mFormat(0), mType(0), mIsDefined(PR_FALSE) {}
         PRBool operator==(const ImageInfo& a) const {
@@ -926,17 +920,17 @@ public:
         mFakeBlackStatus = DontKnowIfNeedFakeBlack;
         mContext->SetDontKnowIfNeedFakeBlack();
     }
 
     void Bind(WebGLenum aTarget) {
         // this function should only be called by bindTexture().
         // it assumes that the GL context is already current.
 
-        PRBool firstTimeThisTextureIsBound = !mHasEverBeenBound;
+        PRBool firstTimeThisTextureIsBound = mTarget == 0;
 
         if (!firstTimeThisTextureIsBound && aTarget != mTarget) {
             mContext->ErrorInvalidOperation("bindTexture: this texture has already been bound to a different target");
             // very important to return here before modifying texture state! This was the place when I lost a whole day figuring
             // very strange 'invalid write' crashes.
             return;
         }
 
@@ -950,18 +944,16 @@ public:
             SetDontKnowIfNeedFakeBlack();
 
             // thanks to the WebKit people for finding this out: GL_TEXTURE_WRAP_R is not
             // present in GLES 2, but is present in GL and it seems as if for cube maps
             // we need to set it to GL_CLAMP_TO_EDGE to get the expected GLES behavior.
             if (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP && !mContext->gl->IsGLES2())
                 mContext->gl->fTexParameteri(mTarget, LOCAL_GL_TEXTURE_WRAP_R, LOCAL_GL_CLAMP_TO_EDGE);
         }
-
-        mHasEverBeenBound = PR_TRUE;
     }
 
     void SetImageInfo(WebGLenum aTarget, WebGLint aLevel,
                       WebGLsizei aWidth, WebGLsizei aHeight,
                       WebGLenum aFormat = 0, WebGLenum aType = 0) {
         size_t face = 0;
         if (aTarget == LOCAL_GL_TEXTURE_2D) {
             if (mTarget != LOCAL_GL_TEXTURE_2D) return;
@@ -1388,45 +1380,42 @@ class WebGLRenderbuffer :
 {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(WEBGLRENDERBUFFER_PRIVATE_IID)
 
     WebGLRenderbuffer(WebGLContext *context, WebGLuint name, WebGLuint secondBufferName = 0) :
         WebGLContextBoundObject(context),
         mName(name),
         mInternalFormat(0),
-        mDeleted(PR_FALSE), mHasEverBeenBound(PR_FALSE), mInitialized(PR_FALSE)
+        mDeleted(PR_FALSE), mInitialized(PR_FALSE)
     { }
 
     void Delete() {
         if (mDeleted)
             return;
         ZeroOwners();
         mDeleted = PR_TRUE;
     }
     PRBool Deleted() const { return mDeleted; }
-    PRBool HasEverBeenBound() { return mHasEverBeenBound; }
-    void SetHasEverBeenBound(PRBool x) { mHasEverBeenBound = x; }
     WebGLuint GLName() const { return mName; }
 
     PRBool Initialized() const { return mInitialized; }
     void SetInitialized(PRBool aInitialized) { mInitialized = aInitialized; }
 
     WebGLenum InternalFormat() const { return mInternalFormat; }
     void SetInternalFormat(WebGLenum aInternalFormat) { mInternalFormat = aInternalFormat; }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBGLRENDERBUFFER
 
 protected:
     WebGLuint mName;
     WebGLenum mInternalFormat;
 
     PRBool mDeleted;
-    PRBool mHasEverBeenBound;
     PRBool mInitialized;
 
     friend class WebGLFramebuffer;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(WebGLRenderbuffer, WEBGLRENDERBUFFER_PRIVATE_IID)
 
 class WebGLFramebufferAttachment
@@ -1521,32 +1510,30 @@ class WebGLFramebuffer :
     public WebGLRectangleObject,
     public WebGLContextBoundObject
 {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(WEBGLFRAMEBUFFER_PRIVATE_IID)
 
     WebGLFramebuffer(WebGLContext *context, WebGLuint name) :
         WebGLContextBoundObject(context),
-        mName(name), mDeleted(PR_FALSE), mHasEverBeenBound(PR_FALSE),
+        mName(name), mDeleted(PR_FALSE),
         mColorAttachment(LOCAL_GL_COLOR_ATTACHMENT0),
         mDepthAttachment(LOCAL_GL_DEPTH_ATTACHMENT),
         mStencilAttachment(LOCAL_GL_STENCIL_ATTACHMENT),
         mDepthStencilAttachment(LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
     { }
 
     void Delete() {
         if (mDeleted)
             return;
         ZeroOwners();
         mDeleted = PR_TRUE;
     }
     PRBool Deleted() { return mDeleted; }
-    PRBool HasEverBeenBound() { return mHasEverBeenBound; }
-    void SetHasEverBeenBound(PRBool x) { mHasEverBeenBound = x; }
     WebGLuint GLName() { return mName; }
 
     nsresult FramebufferRenderbuffer(WebGLenum target,
                                      WebGLenum attachment,
                                      WebGLenum rbtarget,
                                      nsIWebGLRenderbuffer *rbobj)
     {
         WebGLuint renderbuffername;
@@ -1827,17 +1814,16 @@ protected:
         if (wasScissorTestEnabled)
             mContext->gl->fEnable(LOCAL_GL_DITHER);
         else
             mContext->gl->fDisable(LOCAL_GL_SCISSOR_TEST);
     }
 
     WebGLuint mName;
     PRPackedBool mDeleted;
-    PRBool mHasEverBeenBound;
 
     // we only store pointers to attached renderbuffers, not to attached textures, because
     // we will only need to initialize renderbuffers. Textures are already initialized.
     WebGLFramebufferAttachment mColorAttachment,
                                mDepthAttachment,
                                mStencilAttachment,
                                mDepthStencilAttachment;
 };
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -206,17 +206,16 @@ WebGLContext::BindBuffer(WebGLenum targe
     } else {
         return ErrorInvalidEnumInfo("BindBuffer: target", target);
     }
 
     if (!isNull) {
         if ((buf->Target() != LOCAL_GL_NONE) && (target != buf->Target()))
             return ErrorInvalidOperation("BindBuffer: buffer already bound to a different target");
         buf->SetTarget(target);
-        buf->SetHasEverBeenBound(PR_TRUE);
     }
 
     MakeContextCurrent();
 
     gl->fBindBuffer(target, bufname);
 
     return NS_OK;
 }
@@ -235,17 +234,16 @@ WebGLContext::BindFramebuffer(WebGLenum 
         return NS_OK;
 
     MakeContextCurrent();
 
     if (isNull) {
         gl->fBindFramebuffer(target, gl->GetOffscreenFBO());
     } else {
         gl->fBindFramebuffer(target, framebuffername);
-        wfb->SetHasEverBeenBound(PR_TRUE);
     }
 
     mBoundFramebuffer = wfb;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -256,19 +254,16 @@ WebGLContext::BindRenderbuffer(WebGLenum
     WebGLRenderbuffer *wrb;
 
     if (target != LOCAL_GL_RENDERBUFFER)
         return ErrorInvalidEnumInfo("bindRenderbuffer: target", target);
 
     if (!GetConcreteObjectAndGLName("bindRenderBuffer", rbobj, &wrb, &renderbuffername, &isNull))
         return NS_OK;
 
-    if (!isNull)
-        wrb->SetHasEverBeenBound(PR_TRUE);
-
     MakeContextCurrent();
 
     gl->fBindRenderbuffer(target, renderbuffername);
 
     mBoundRenderbuffer = wrb;
 
     return NS_OK;
 }
@@ -486,19 +481,16 @@ WebGLContext::BufferSubData_buf(GLenum t
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundElementArrayBuffer;
     } else {
         return ErrorInvalidEnumInfo("bufferSubData: target", target);
     }
 
-    if (byteOffset < 0)
-        return ErrorInvalidValue("bufferSubData: negative offset");
-
     if (!boundBuffer)
         return ErrorInvalidOperation("BufferData: no buffer bound!");
 
     CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + wb->byteLength;
     if (!checked_neededByteLength.valid())
         return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
 
     if (checked_neededByteLength.value() > boundBuffer->ByteLength())
@@ -523,19 +515,16 @@ WebGLContext::BufferSubData_array(WebGLe
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundElementArrayBuffer;
     } else {
         return ErrorInvalidEnumInfo("bufferSubData: target", target);
     }
 
-    if (byteOffset < 0)
-        return ErrorInvalidValue("bufferSubData: negative offset");
-
     if (!boundBuffer)
         return ErrorInvalidOperation("BufferData: no buffer bound!");
 
     CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + wa->byteLength;
     if (!checked_neededByteLength.valid())
         return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
 
     if (checked_neededByteLength.value() > boundBuffer->ByteLength())
@@ -1673,40 +1662,48 @@ WebGLContext::GetParameter(PRUint32 pnam
         case LOCAL_GL_MAX_TEXTURE_SIZE:
         case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
         case LOCAL_GL_SAMPLE_BUFFERS:
         case LOCAL_GL_SAMPLES:
         case LOCAL_GL_MAX_VERTEX_ATTRIBS:
         case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
         case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
         case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS:
+        case LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+        case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+        case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
         case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
         case LOCAL_GL_RED_BITS:
         case LOCAL_GL_GREEN_BITS:
         case LOCAL_GL_BLUE_BITS:
         case LOCAL_GL_ALPHA_BITS:
         case LOCAL_GL_DEPTH_BITS:
         case LOCAL_GL_STENCIL_BITS:
         {
             GLint i = 0;
             gl->fGetIntegerv(pname, &i);
             wrval->SetAsInt32(i);
         }
             break;
 
-        case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
-            wrval->SetAsInt32(mGLMaxVertexUniformVectors);
-            break;
-
-        case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
-            wrval->SetAsInt32(mGLMaxFragmentUniformVectors);
-            break;
-
         case LOCAL_GL_MAX_VARYING_VECTORS:
-            wrval->SetAsInt32(mGLMaxVaryingVectors);
+        {
+            if (gl->IsGLES2()) {
+                GLint i = 0;
+                gl->fGetIntegerv(pname, &i);
+                wrval->SetAsInt32(i);
+            } else {
+                // since this pname is absent from desktop OpenGL, we have to implement it by hand.
+                // The formula below comes from the public_webgl list, "problematic GetParameter pnames" thread
+                GLint i = 0, j = 0;
+                gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &i);
+                gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &j);
+                wrval->SetAsInt32(PR_MIN(i,j)/4);
+            }
+        }
             break;
 
         case LOCAL_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
             wrval->SetAsInt32(0);
             break;
         case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
             wrval->SetAsEmpty(); // the spec says we must return null
             break;
@@ -2535,102 +2532,106 @@ WebGLContext::Hint(WebGLenum target, Web
 {
     return ErrorInvalidEnum("hint: invalid hint");
 }
 
 NS_IMETHODIMP
 WebGLContext::IsBuffer(nsIWebGLBuffer *bobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    WebGLuint buffername;
-    WebGLBuffer *buffer;
-    PRBool ok = GetConcreteObjectAndGLName("isBuffer", bobj, &buffer, &buffername, nsnull, &isDeleted) && 
-                !isDeleted &&
-                buffer->HasEverBeenBound();
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLBuffer>("isBuffer", bobj, &obj, 0, &isDeleted) && !isDeleted;
     if (ok) {
         MakeContextCurrent();
-        ok = gl->fIsBuffer(buffername);
+        ok = gl->fIsBuffer(obj);
     }
 
     *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsFramebuffer(nsIWebGLFramebuffer *fbobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    WebGLuint fbname;
-    WebGLFramebuffer *fb;
-    PRBool ok = GetConcreteObjectAndGLName("isFramebuffer", fbobj, &fb, &fbname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                fb->HasEverBeenBound();
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLFramebuffer>("isFramebuffer", fbobj, &obj, 0, &isDeleted) && !isDeleted;
     if (ok) {
         MakeContextCurrent();
-        ok = gl->fIsFramebuffer(fbname);
+        ok = gl->fIsFramebuffer(obj);
     }
 
     *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsProgram(nsIWebGLProgram *pobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
     WebGLProgram *prog = nsnull;
-    PRBool ok = GetConcreteObject("isProgram", pobj, &prog, nsnull, &isDeleted, PR_FALSE) &&
-                !isDeleted;
-
-    *retval = ok;
+    PRBool ok = GetConcreteObject("isProgram", pobj, &prog, 0, &isDeleted, PR_FALSE);
+    if (!ok) {
+        *retval = PR_FALSE;
+        return NS_OK;
+    }
+
+    if (isDeleted) {
+        *retval = PR_FALSE;
+    } else {
+        *retval = PR_TRUE;
+    }
+
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsRenderbuffer(nsIWebGLRenderbuffer *rbobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    WebGLuint rbname;
-    WebGLRenderbuffer *rb;
-    PRBool ok = GetConcreteObjectAndGLName("isRenderBuffer", rbobj, &rb, &rbname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                rb->HasEverBeenBound();
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLRenderbuffer>("isRenderBuffer", rbobj, &obj, 0, &isDeleted) && !isDeleted;
     if (ok) {
         MakeContextCurrent();
-        ok = gl->fIsRenderbuffer(rbname);
+        ok = gl->fIsRenderbuffer(obj);
     }
 
     *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsShader(nsIWebGLShader *sobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
     WebGLShader *shader = nsnull;
-    PRBool ok = GetConcreteObject("isShader", sobj, &shader, nsnull, &isDeleted, PR_FALSE) &&
-                !isDeleted;
-
-    *retval = ok;
+    PRBool ok = GetConcreteObject("isShader", sobj, &shader, 0, &isDeleted, PR_FALSE);
+    if (!ok) {
+        *retval = PR_FALSE;
+        return NS_OK;
+    }
+
+    if (isDeleted) {
+        *retval = PR_FALSE;
+    } else {
+        *retval = PR_TRUE;
+    }
+
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsTexture(nsIWebGLTexture *tobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    WebGLuint texname;
-    WebGLTexture *tex;
-    PRBool ok = GetConcreteObjectAndGLName("isTexture", tobj, &tex, &texname, nsnull, &isDeleted) &&
-                !isDeleted &&
-                tex->HasEverBeenBound();
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLTexture>("isTexture", tobj, &obj, 0, &isDeleted) && !isDeleted;
     if (ok) {
         MakeContextCurrent();
-        ok = gl->fIsTexture(texname);
+        ok = gl->fIsTexture(obj);
     }
 
     *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
@@ -4343,8 +4344,15 @@ int mozilla::GetWebGLTexelFormat(GLenum 
             case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
                 return WebGLTexelFormat::RGB565;
             default:
                 NS_ASSERTION(PR_FALSE, "Coding mistake?! Should never reach this point.");
                 return WebGLTexelFormat::Generic;
         }
     }
 }
+
+NS_IMETHODIMP
+WebGLContext::GetExtension(const nsAString& aName, nsISupports **retval)
+{
+    *retval = nsnull;
+    return NS_OK;
+}
--- a/content/canvas/src/WebGLContextValidate.cpp
+++ b/content/canvas/src/WebGLContextValidate.cpp
@@ -435,32 +435,27 @@ WebGLContext::InitAndValidateGL()
     mBoundCubeMapTextures.SetLength(mGLMaxTextureUnits);
 
     gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize);
     gl->fGetIntegerv(LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE, (GLint*) &mGLMaxCubeMapTextureSize);
 
     gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxTextureImageUnits);
     gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint*) &mGLMaxVertexTextureImageUnits);
 
-    if (gl->HasES2Compatibility()) {
+    if (gl->IsGLES2()) {
         gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint*) &mGLMaxFragmentUniformVectors);
         gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint*) &mGLMaxVertexUniformVectors);
         gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, (GLint*) &mGLMaxVaryingVectors);
     } else {
         gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, (GLint*) &mGLMaxFragmentUniformVectors);
         mGLMaxFragmentUniformVectors /= 4;
         gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS, (GLint*) &mGLMaxVertexUniformVectors);
         mGLMaxVertexUniformVectors /= 4;
-
-        // The formula below comes from the public_webgl list, "problematic GetParameter pnames" thread
-        GLint maxVertexOutputComponents = 0,
-              maxFragmentInputComponents = 0;
-        gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &maxVertexOutputComponents);
-        gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &maxFragmentInputComponents);
-        mGLMaxVaryingVectors = PR_MIN(maxVertexOutputComponents, maxFragmentInputComponents) / 4;
+        gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_FLOATS, (GLint*) &mGLMaxVaryingVectors);
+        mGLMaxVaryingVectors /= 4;
     }
 
 #if 0
     // Leaving this code in here, even though it's ifdef'd out, for
     // when we support more than 1 color attachment.
     gl->fGetIntegerv(LOCAL_GL_MAX_COLOR_ATTACHMENTS, (GLint*) &val);
 #else
     // Always 1 for GLES2
--- a/content/canvas/test/webgl/failing_tests_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -1,7 +1,9 @@
 conformance/context-attributes.html
 conformance/gl-enum-tests.html
 conformance/gl-get-active-attribute.html
+conformance/gl-get-calls.html
 conformance/gl-uniform-bool.html
 conformance/gl-vertexattribpointer.html
 conformance/glsl-2types-of-textures-on-same-unit.html
+conformance/is-object.html
 conformance/uninitialized-test.html
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -1,7 +1,8 @@
 conformance/canvas-test.html
 conformance/canvas-test.html
 conformance/context-attributes.html
 conformance/gl-enum-tests.html
+conformance/gl-get-calls.html
 conformance/gl-object-get-calls.html
 conformance/gl-vertexattribpointer.html
 conformance/texture-npot.html
--- a/content/canvas/test/webgl/failing_tests_windows.txt
+++ b/content/canvas/test/webgl/failing_tests_windows.txt
@@ -1,7 +1,8 @@
 conformance/context-attributes.html
 conformance/gl-enum-tests.html
 conformance/gl-get-active-attribute.html
 conformance/gl-uniform-bool.html
 conformance/gl-vertexattribpointer.html
 conformance/glsl-2types-of-textures-on-same-unit.html
+conformance/is-object.html
 conformance/tex-image-and-sub-image-2d-with-array-buffer-view.html
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -128,17 +128,17 @@ interface nsIWebGLActiveInfo : nsISuppor
 
 [scriptable, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
 interface nsIWebGLUniformLocation : nsISupports
 {
     [noscript] attribute WebGLint location;
 };
 
 
-[scriptable, uuid(7cb54577-df8d-40bf-b7bb-2ddec3600a2c)]
+[scriptable, uuid(2f21ca21-9720-4eee-ad94-27eefe4f72dc)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
   //
   //  CONSTANTS
   //
 
   /* ClearBufferMask */
   const unsigned long DEPTH_BUFFER_BIT               = 0x00000100;
@@ -831,11 +831,10 @@ interface nsIDOMWebGLRenderingContext : 
   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
-  nsIVariant getSupportedExtensions();
   nsISupports getExtension(in DOMString name);
 };
--- a/gfx/src/X11Util.cpp
+++ b/gfx/src/X11Util.cpp
@@ -41,23 +41,21 @@
 
 namespace mozilla {
 
 ScopedXErrorHandler::ErrorEvent* ScopedXErrorHandler::sXErrorPtr;
 
 int
 ScopedXErrorHandler::ErrorHandler(Display *, XErrorEvent *ev)
 {
-    // only record the error if no error was previously recorded.
-    // this means that in case of multiple errors, it's the first error that we report.
-    if (!sXErrorPtr->mError.error_code)
-      sXErrorPtr->mError = *ev;
+    sXErrorPtr->mError = *ev;
     return 0;
 }
 
+
 ScopedXErrorHandler::ScopedXErrorHandler()
 {
     // let sXErrorPtr point to this object's mXError object, but don't reset this mXError object!
     // think of the case of nested ScopedXErrorHandler's.
     mOldXErrorPtr = sXErrorPtr;
     sXErrorPtr = &mXError;
     mOldErrorHandler = XSetErrorHandler(ErrorHandler);
 }
@@ -67,22 +65,17 @@ ScopedXErrorHandler::~ScopedXErrorHandle
     sXErrorPtr = mOldXErrorPtr;
     XSetErrorHandler(mOldErrorHandler);
 }
 
 bool
 ScopedXErrorHandler::SyncAndGetError(Display *dpy, XErrorEvent *ev)
 {
     XSync(dpy, False);
-    return GetError(ev);
-}
-
-bool
-ScopedXErrorHandler::GetError(XErrorEvent *ev)
-{
     bool retval = mXError.mError.error_code != 0;
     if (ev)
         *ev = mXError.mError;
     mXError = ErrorEvent(); // reset
     return retval;
 }
 
+
 } // namespace mozilla
--- a/gfx/src/X11Util.h
+++ b/gfx/src/X11Util.h
@@ -153,27 +153,19 @@ public:
 
     static int
     ErrorHandler(Display *, XErrorEvent *ev);
 
     ScopedXErrorHandler();
 
     ~ScopedXErrorHandler();
 
-    /** \returns true if a X error occurred since the last time this method was called on this ScopedXErrorHandler object,
-     *           or since the creation of this ScopedXErrorHandler object if this method was never called on it.
+    /** \returns true if a X error occurred since the last time this method was called on this ScopedXErrorHandler object.
      *
-     * \param ev this optional parameter, if set, will be filled with the XErrorEvent object. If multiple errors occurred,
-     *           the first one will be returned.
+     * \param ev this optional parameter, if set, will be filled with the XErrorEvent object
      */
     bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nsnull);
+};
 
-    /** Like SyncAndGetError, but does not sync. Faster, but only reliably catches errors in synchronous calls.
-     *
-     * \param ev this optional parameter, if set, will be filled with the XErrorEvent object. If multiple errors occurred,
-     *           the first one will be returned.
-     */
-    bool GetError(XErrorEvent *ev = nsnull);
-};
 
 } // namespace mozilla
 
 #endif  // mozilla_X11Util_h
--- a/gfx/thebes/GLContext.cpp
+++ b/gfx/thebes/GLContext.cpp
@@ -318,48 +318,49 @@ GLContext::InitWithPrefix(const char *pr
           { mIsGLES2 ? NULL : "UnmapBuffer", NULL } },
 
         { NULL, { NULL } },
 
     };
 
     mInitialized = LoadSymbols(&symbols[0], trygl, prefix);
 
-    const char *glVendorString;
+    if (mInitialized) {
+        InitExtensions();
+
+        NS_ASSERTION(!IsExtensionSupported(GLContext::ARB_pixel_buffer_object) ||
+                     (mSymbols.fMapBuffer && mSymbols.fUnmapBuffer),
+                     "ARB_pixel_buffer_object supported without glMapBuffer/UnmapBuffer being available!");
 
-    if (mInitialized) {
-        glVendorString = (const char *)fGetString(LOCAL_GL_VENDOR);
+        GLint v[4];
+
+        fGetIntegerv(LOCAL_GL_SCISSOR_BOX, v);
+        mScissorStack.AppendElement(nsIntRect(v[0], v[1], v[2], v[3]));
+
+        fGetIntegerv(LOCAL_GL_VIEWPORT, v);
+        mViewportStack.AppendElement(nsIntRect(v[0], v[1], v[2], v[3]));
+
+        const char *glVendorString = (const char *)fGetString(LOCAL_GL_VENDOR);
         const char *vendorMatchStrings[VendorOther] = {
                 "Intel",
                 "NVIDIA",
                 "ATI",
                 "Qualcomm"
         };
+
+        fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
+
         mVendor = VendorOther;
         for (int i = 0; i < VendorOther; ++i) {
             if (DoesVendorStringMatch(glVendorString, vendorMatchStrings[i])) {
                 mVendor = i;
                 break;
             }
         }
 
-#ifdef MOZ_X11
-        // bug 629265: block NVIDIA 260.19 on X11
-        if (mVendor == VendorNVIDIA &&
-            strstr((const char *)fGetString(LOCAL_GL_VERSION), "260.19") &&
-            !PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
-        {
-            printf_stderr("[GLX] NVIDIA driver version 260.19 is blacklisted because of many crash reports (see bug 629265), "
-                          "define the MOZ_GLX_IGNORE_BLACKLIST environment variable to bypass this.\n");
-            mInitialized = PR_FALSE;
-        }
-#endif
-    }
-
-    if (mInitialized) {
 #ifdef DEBUG
         static bool once = false;
         if (!once) {
             const char *vendors[VendorOther] = {
                 "Intel",
                 "NVIDIA",
                 "ATI",
                 "Qualcomm"
@@ -370,32 +371,16 @@ GLContext::InitWithPrefix(const char *pr
                 printf_stderr("OpenGL vendor ('%s') recognized as: %s\n",
                               glVendorString, vendors[mVendor]);
             } else {
                 printf_stderr("OpenGL vendor ('%s') unrecognized\n", glVendorString);
             }
         }
 #endif
 
-        InitExtensions();
-
-        NS_ASSERTION(!IsExtensionSupported(GLContext::ARB_pixel_buffer_object) ||
-                     (mSymbols.fMapBuffer && mSymbols.fUnmapBuffer),
-                     "ARB_pixel_buffer_object supported without glMapBuffer/UnmapBuffer being available!");
-
-        GLint v[4];
-
-        fGetIntegerv(LOCAL_GL_SCISSOR_BOX, v);
-        mScissorStack.AppendElement(nsIntRect(v[0], v[1], v[2], v[3]));
-
-        fGetIntegerv(LOCAL_GL_VIEWPORT, v);
-        mViewportStack.AppendElement(nsIntRect(v[0], v[1], v[2], v[3]));
-
-        fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
-
         UpdateActualFormat();
     }
 
 #ifdef DEBUG
     if (PR_GetEnv("MOZ_GL_DEBUG"))
         mDebugMode |= DebugEnabled;
 
     // enables extra verbose output, informing of the start and finish of every GL call.
@@ -428,17 +413,16 @@ static const char *sExtensionNames[] = {
     "GL_OES_texture_npot",
     "GL_OES_depth_texture",
     "GL_OES_packed_depth_stencil",
     "GL_IMG_read_format",
     "GL_EXT_read_format_bgra",
     "GL_APPLE_client_storage",
     "GL_ARB_texture_non_power_of_two",
     "GL_ARB_pixel_buffer_object",
-    "GL_ARB_ES2_compatibility",
     NULL
 };
 
 void
 GLContext::InitExtensions()
 {
     MakeCurrent();
     const GLubyte *extensions = fGetString(LOCAL_GL_EXTENSIONS);
--- a/gfx/thebes/GLContext.h
+++ b/gfx/thebes/GLContext.h
@@ -504,26 +504,19 @@ public:
      */
     virtual PRBool IsDoubleBuffered() { return PR_FALSE; }
 
     /**
      * If this context is the GLES2 API, returns TRUE.
      * This means that various GLES2 restrictions might be in effect (modulo
      * extensions).
      */
-    PRBool IsGLES2() const {
+    PRBool IsGLES2() {
         return mIsGLES2;
     }
-    
-    /**
-     * Returns PR_TRUE if either this is the GLES2 API, or had the GL_ARB_ES2_compatibility extension
-     */
-    PRBool HasES2Compatibility() const {
-        return mIsGLES2 || IsExtensionSupported(ARB_ES2_compatibility);
-    }
 
     enum {
         VendorIntel,
         VendorNVIDIA,
         VendorATI,
         VendorQualcomm,
         VendorOther
     };
@@ -847,21 +840,20 @@ public:
         OES_texture_npot,
         OES_depth_texture,
         OES_packed_depth_stencil,
         IMG_read_format,
         EXT_read_format_bgra,
         APPLE_client_storage,
         ARB_texture_non_power_of_two,
         ARB_pixel_buffer_object,
-        ARB_ES2_compatibility,
         Extensions_Max
     };
 
-    PRBool IsExtensionSupported(GLExtensions aKnownExtension) const {
+    PRBool IsExtensionSupported(GLExtensions aKnownExtension) {
         return mAvailableExtensions[aKnownExtension];
     }
 
     // Shared code for GL extensions and GLX extensions.
     static PRBool ListHasExtension(const GLubyte *extensions,
                                    const char *extension);
 
     GLint GetMaxTextureSize() { return mMaxTextureSize; }
@@ -925,20 +917,16 @@ protected:
                 values[i] = false;
         }
 
         bool& operator[](size_t index) {
             NS_ASSERTION(index < setlen, "out of range");
             return values[index];
         }
 
-        const bool& operator[](size_t index) const {
-            return const_cast<ExtensionBitset*>(this)->operator[](index);
-        }
-
         bool values[setlen];
     };
     ExtensionBitset<Extensions_Max> mAvailableExtensions;
 
     // Clear to transparent black, with 0 depth and stencil,
     // while preserving current ClearColor etc. values.
     // Useful for resizing offscreen buffers.
     void ClearSafely();
--- a/gfx/thebes/GLContextProviderGLX.cpp
+++ b/gfx/thebes/GLContextProviderGLX.cpp
@@ -159,52 +159,30 @@ GLXLibrary::EnsureInitialized()
 
     if (!LibrarySymbolLoader::LoadSymbols(mOGLLibrary, &symbols[0])) {
         NS_WARNING("Couldn't find required entry point in OpenGL shared library");
         return PR_FALSE;
     }
 
     Display *display = DefaultXDisplay();
     int screen = DefaultScreen(display);
-    const char *vendor;
-    const char *serverVersionStr;
-    const char *extensionsStr;
-
-    // this scope is covered by a ScopedXErrorHandler to catch X errors in GLX calls,
-    // see bug 632867 comment 3: Mesa versions up to 7.10 cause a BadLength error during the first GLX call
-    // when the server GLX version < 1.3.
-    {
-        ScopedXErrorHandler xErrorHandler;
-
-        if (!xQueryVersion(display, &gGLXMajorVersion, &gGLXMinorVersion)) {
-            gGLXMajorVersion = 0;
-            gGLXMinorVersion = 0;
-            return PR_FALSE;
-        }
+    if (!xQueryVersion(display, &gGLXMajorVersion, &gGLXMinorVersion)) {
+        gGLXMajorVersion = 0;
+        gGLXMinorVersion = 0;
+        return PR_FALSE;
+    }
 
-        vendor = xQueryServerString(display, screen, GLX_VENDOR);
-        serverVersionStr = xQueryServerString(display, screen, GLX_VERSION);
+    const char *vendor = xQueryServerString(display, screen, GLX_VENDOR);
+    const char *serverVersionStr = xQueryServerString(display, screen, GLX_VERSION);
 
-        if (strcmp(vendor, "NVIDIA Corporation") &&
-            !PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
-        {
-          printf("[GLX] your GL driver is currently blocked. If you would like to bypass this, "
-                  "define the MOZ_GLX_IGNORE_BLACKLIST environment variable.\n");
-          return nsnull;
-        }
+    if (!GLXVersionCheck(1, 1))
+        // Not possible to query for extensions.
+        return PR_FALSE;
 
-        if (!GLXVersionCheck(1, 1))
-            // Not possible to query for extensions.
-            return PR_FALSE;
-
-        extensionsStr = xQueryExtensionsString(display, screen);
-
-        if (xErrorHandler.GetError())
-          return PR_FALSE;
-    }
+    const char *extensionsStr = xQueryExtensionsString(display, screen);
 
     LibrarySymbolLoader::SymLoadStruct *sym13;
     if (!GLXVersionCheck(1, 3)) {
         // Even if we don't have 1.3, we might have equivalent extensions
         // (as on the Intel X server).
         if (!HasExtension(extensionsStr, "GLX_SGIX_fbconfig")) {
             return PR_FALSE;
         }
@@ -251,35 +229,42 @@ public:
                     Display *display,
                     GLXDrawable drawable,
                     GLXFBConfig cfg,
                     XVisualInfo *vinfo,
                     GLContextGLX *shareContext,
                     PRBool deleteDrawable,
                     gfxXlibSurface *pixmap = nsnull)
     {
+        const char *glxVendorString = sGLXLibrary.xQueryServerString(display, DefaultScreen(display), GLX_VENDOR);
+        if (strcmp(glxVendorString, "NVIDIA Corporation") &&
+            !PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
+        {
+          printf("[GLX] currently only allowing the NVIDIA proprietary driver, as other drivers are giving too many crashes. "
+                 "To bypass this, define the MOZ_GLX_IGNORE_BLACKLIST environment variable.\n");
+          return nsnull;
+        }
+
         int db = 0, err;
         err = sGLXLibrary.xGetFBConfigAttrib(display, cfg,
                                              GLX_DOUBLEBUFFER, &db);
         if (GLX_BAD_ATTRIBUTE != err) {
 #ifdef DEBUG
             printf("[GLX] FBConfig is %sdouble-buffered\n", db ? "" : "not ");
 #endif
         }
 
         GLXContext context;
         nsRefPtr<GLContextGLX> glContext;
-        bool error;
+        bool error = false;
 
         ScopedXErrorHandler xErrorHandler;
 
 TRY_AGAIN_NO_SHARING:
 
-        error = false;
-
         context = sGLXLibrary.xCreateNewContext(display,
                                                 cfg,
                                                 GLX_RGBA_TYPE,
                                                 shareContext ? shareContext->mContext : NULL,
                                                 True);
 
         if (context) {
             glContext = new GLContextGLX(format,
@@ -291,27 +276,33 @@ TRY_AGAIN_NO_SHARING:
                                         db,
                                         pixmap);
             if (!glContext->Init())
                 error = true;
         } else {
             error = true;
         }
 
-        error |= xErrorHandler.SyncAndGetError(display);
-
-        if (error) {
-            if (shareContext) {
+        if (shareContext) {
+            if (error || xErrorHandler.SyncAndGetError(display)) {
                 shareContext = nsnull;
                 goto TRY_AGAIN_NO_SHARING;
             }
+        }
 
-            NS_WARNING("Failed to create GLXContext!");
-            glContext = nsnull; // note: this must be done while the graceful X error handler is set,
-                                // because glxMakeCurrent can give a GLXBadDrawable error
+        // at this point, if shareContext != null, we know there's no error.
+        // it's important to minimize the number of XSyncs for startup performance.
+        if (!shareContext) {
+            if (error || // earlier recorded error
+                xErrorHandler.SyncAndGetError(display))
+            {
+                NS_WARNING("Failed to create GLXContext!");
+                glContext = nsnull; // note: this must be done while the graceful X error handler is set,
+                                    // because glxMakeCurrent can give a GLXBadDrawable error
+            }
         }
 
         return glContext.forget();
     }
 
     ~GLContextGLX()
     {
         MarkDestroyed();