b=621571; fix webgl is-object test; r=vlad,a=b
authorVladimir Vukicevic <vladimir@pobox.com>
Mon, 27 Dec 2010 12:04:58 -0800
changeset 59689 8f8b1db55800a150d11fecf9063c5d7fd16fa4b4
parent 59688 eaa44c83914fdf9d6c9807ee80ad40716186c65a
child 59690 e9aa8f38d75e527bc6d58d09e19d2f2e75042436
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersvlad, b
bugs621571
milestone2.0b9pre
b=621571; fix webgl is-object test; r=vlad,a=b
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -2395,63 +2395,87 @@ WebGLContext::Hint(WebGLenum target, Web
 {
     return ErrorInvalidEnum("hint: invalid hint");
 }
 
 NS_IMETHODIMP
 WebGLContext::IsBuffer(nsIWebGLBuffer *bobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    *retval = CanGetConcreteObject<WebGLBuffer>("isBuffer", bobj, 0, &isDeleted) && !isDeleted;
-
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLBuffer>("isBuffer", bobj, &obj, 0, &isDeleted) && !isDeleted;
+    if (ok) {
+        MakeContextCurrent();
+        ok = gl->fIsBuffer(obj);
+    }
+
+    *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsFramebuffer(nsIWebGLFramebuffer *fbobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    *retval = CanGetConcreteObject<WebGLFramebuffer>("isFramebuffer", fbobj, 0, &isDeleted) && !isDeleted;
-
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLFramebuffer>("isFramebuffer", fbobj, &obj, 0, &isDeleted) && !isDeleted;
+    if (ok) {
+        MakeContextCurrent();
+        ok = gl->fIsFramebuffer(obj);
+    }
+
+    *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsProgram(nsIWebGLProgram *pobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
     *retval = CanGetConcreteObject<WebGLProgram>("isProgram", pobj, 0, &isDeleted) && !isDeleted;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsRenderbuffer(nsIWebGLRenderbuffer *rbobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    *retval = CanGetConcreteObject<WebGLRenderbuffer>("isRenderBuffer", rbobj, 0, &isDeleted) && !isDeleted;
-
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLRenderbuffer>("isRenderBuffer", rbobj, &obj, 0, &isDeleted) && !isDeleted;
+    if (ok) {
+        MakeContextCurrent();
+        ok = gl->fIsRenderbuffer(obj);
+    }
+
+    *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsShader(nsIWebGLShader *sobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
     *retval = CanGetConcreteObject<WebGLShader>("isShader", sobj, 0, &isDeleted) && !isDeleted;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsTexture(nsIWebGLTexture *tobj, WebGLboolean *retval)
 {
     PRBool isDeleted;
-    *retval = CanGetConcreteObject<WebGLTexture>("isTexture", tobj, 0, &isDeleted) && !isDeleted;
-
+    WebGLuint obj;
+    PRBool ok = GetGLName<WebGLTexture>("isTexture", tobj, &obj, 0, &isDeleted) && !isDeleted;
+    if (ok) {
+        MakeContextCurrent();
+        ok = gl->fIsTexture(obj);
+    }
+
+    *retval = ok;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
 {
     *retval = 0;