There are several WebGL entry points which currently synthesize an INVALID_OPERATION error when receiving a null WebGLObject. These include bindAttribLocation, compileShader, detachShader, getActiveAttrib, getActiveUniform, getProgramParameter, getProgramInfoLog, getShaderParameter, getShaderInfoLog, getShaderSource, getUniform, getUniformLocation, linkProgram, and shaderSource. These should be changed to synthesize INVALID_VALUE in this case instead, because that is the semantically correct OpenGL error and matches the specification for the uniform[Matrix]* APIs.
Created attachment 52896 [details] patch
In all of these cases, we need to split out the test against 0 from the other tests like whether the object came from this context. Those should continue to synthesize INVALID_OPERATION. I suggest adding a private helper function like bool validateWebGLObject(CanvasObject*) which does the test against 0 and synthesizes INVALID_VALUE if so, and which checks that the context is ourselves and synthesizes INVALID_OPERATION if not. Then all of the call sites can be refactored to just "if (!validateWebGLObject(...)) return [false];"
Created attachment 52920 [details] revised patch : responding to Ken Russell's review
Comment on attachment 52920 [details] revised patch : responding to Ken Russell's review This looks great. Thanks for doing this cleanup.
Comment on attachment 52920 [details] revised patch : responding to Ken Russell's review Clearing flags on attachment: 52920 Committed r57324: <http://trac.webkit.org/changeset/57324>
All reviewed patches have been landed. Closing bug.