Bug 37047 - Passing null WebGLObjects should synthesize INVALID_VALUE error
Summary: Passing null WebGLObjects should synthesize INVALID_VALUE error
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Zhenyao Mo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-02 15:11 PDT by Kenneth Russell
Modified: 2010-04-09 03:37 PDT (History)
5 users (show)

See Also:


Attachments
patch (19.43 KB, patch)
2010-04-08 14:40 PDT, Zhenyao Mo
no flags Details | Formatted Diff | Diff
revised patch : responding to Ken Russell's review (17.72 KB, patch)
2010-04-08 17:22 PDT, Zhenyao Mo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2010-04-02 15:11:32 PDT
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.
Comment 1 Zhenyao Mo 2010-04-08 14:40:12 PDT
Created attachment 52896 [details]
patch
Comment 2 Kenneth Russell 2010-04-08 15:39:48 PDT
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];"
Comment 3 Zhenyao Mo 2010-04-08 17:22:31 PDT
Created attachment 52920 [details]
revised patch : responding to Ken Russell's review
Comment 4 Kenneth Russell 2010-04-08 17:42:47 PDT
Comment on attachment 52920 [details]
revised patch : responding to Ken Russell's review

This looks great. Thanks for doing this cleanup.
Comment 5 WebKit Commit Bot 2010-04-09 03:37:27 PDT
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>
Comment 6 WebKit Commit Bot 2010-04-09 03:37:32 PDT
All reviewed patches have been landed.  Closing bug.