b=612334; fix webgl invalid-passed-params test; r=bjacob
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 16 Nov 2010 20:33:04 -0800
changeset 57636 929ce36f005b860fb411d84cf9d13b2d30665e7d
parent 57635 25faa99c8fbeb5e1196adc8e6da3975b6aff0883
child 57637 9d379645288791c6362235ab8698bd52ca5b260a
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbjacob
bugs612334
milestone2.0b8pre
b=612334; fix webgl invalid-passed-params test; r=bjacob
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -534,16 +534,21 @@ WebGLContext::CheckFramebufferStatus(Web
 NS_IMETHODIMP
 WebGLContext::Clear(PRUint32 mask)
 {
     MakeContextCurrent();
 
     if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeRenderbuffers())
         return NS_OK;
 
+    PRUint32 m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
+    if (mask != m) {
+        return ErrorInvalidValue("clear: invalid mask bits");
+    }
+
     gl->fClear(mask);
     Invalidate();
 
     return NS_OK;
 }
 
 GL_SAME_METHOD_4(ClearColor, ClearColor, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat)