[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

cmarrin at apple.com cmarrin at apple.com
Wed Apr 7 23:55:23 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b6483fd2381cf00768220fd3f456718fecaf3fe1
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 24 20:04:23 2009 +0000

            Change get... calls to latest spec
            https://bugs.webkit.org/show_bug.cgi?id=30091
    
            Removed old versions of get calls on WebGLRenderingContext and
            added new ones per spec returning "any". New code simplifies
            GraphicsContext3D and fixes previously unimplemented routines.
            Added custom JS and V8 bindings. Added exhaustive test case
            exercising all new code paths. Updated preexisting test cases for
            new APIs. Fixed preexisting bugs in WebKit's and Chrome's WebGL
            implementations.
    
            Ran WebGL layout tests in WebKit (clean) and Chrome (couple of
            preexisting known failures) and manual WebGL tests in both
            browsers.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51348 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6c73ba0..4b4c266 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,58 @@
+2009-11-23  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Change get... calls to latest spec
+        https://bugs.webkit.org/show_bug.cgi?id=30091
+
+        Removed old versions of get calls on WebGLRenderingContext and
+        added new ones per spec returning "any". New code simplifies
+        GraphicsContext3D and fixes previously unimplemented routines.
+        Added custom JS and V8 bindings. Added exhaustive test case
+        exercising all new code paths. Updated preexisting test cases for
+        new APIs. Fixed preexisting bugs in WebKit's and Chrome's WebGL
+        implementations.
+
+        Ran WebGL layout tests in WebKit (clean) and Chrome (couple of
+        preexisting known failures) and manual WebGL tests in both
+        browsers.
+        
+        Two of the tests fail on various hardware and were modified. See
+        
+            https://bugs.webkit.org/show_bug.cgi?id=31842
+            https://bugs.webkit.org/show_bug.cgi?id=31843
+
+        Test: fast/canvas/webgl/gl-object-get-calls.html
+
+        * fast/canvas/webgl/gl-get-calls-expected.txt:
+        * fast/canvas/webgl/gl-get-calls.html:
+        * fast/canvas/webgl/gl-object-get-calls-expected.txt: Added.
+        * fast/canvas/webgl/gl-object-get-calls.html: Added.
+        * fast/canvas/webgl/incorrect-context-object-behaviour-expected.txt:
+        * fast/canvas/webgl/null-object-behaviour-expected.txt:
+        * fast/canvas/webgl/resources/boolUniformShader.vert: Added.
+        * fast/canvas/webgl/resources/floatUniformShader.vert: Added.
+        * fast/canvas/webgl/resources/intUniformShader.vert: Added.
+        * fast/canvas/webgl/resources/matUniformShader.vert: Added.
+        * fast/canvas/webgl/resources/noopUniformShader.frag: Added.
+        * fast/canvas/webgl/resources/utils3d.js:
+        (initWebGL):
+        (loadShader):
+        (Framerate.prototype.snapshot):
+        * fast/canvas/webgl/resources/webgl-test.js:
+        (loadProgram):
+        (loadStandardVertexShader):
+        (loadVertexShader):
+        (loadStandardFragmentShader):
+        (loadFragmentShader):
+        * fast/canvas/webgl/script-tests/gl-object-get-calls.js: Added.
+        * fast/canvas/webgl/script-tests/incorrect-context-object-behaviour.js:
+        * fast/canvas/webgl/script-tests/null-object-behaviour.js:
+        * fast/canvas/webgl/triangle.html:
+        * fast/js/resources/js-test-pre.js:
+        (shouldBeNonZero):
+        (shouldBeNonNull):
+
 2009-11-24  Dmitry Titov  <dimich at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt b/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt
index a93fc6b..ad80582 100644
--- a/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt
@@ -13,60 +13,57 @@ Context contains getError
 PASS context contains getError
 
 Check default values
-PASS context.getInteger(context.ACTIVE_TEXTURE) is context.TEXTURE0
-PASS context.getInteger(context.ALIASED_LINE_WIDTH_RANGE) is 1
-PASS context.getInteger(context.ALIASED_POINT_SIZE_RANGE) is 1
-PASS context.getInteger(context.ARRAY_BUFFER_BINDING) is 0
-PASS context.getInteger(context.BLEND) is 0
-PASS context.getInteger(context.BLEND_COLOR) is 0
-PASS context.getInteger(context.BLEND_DST_ALPHA) is 0
-PASS context.getInteger(context.BLEND_DST_RGB) is 0
-PASS context.getInteger(context.BLEND_EQUATION_ALPHA) is context.FUNC_ADD
-PASS context.getInteger(context.BLEND_EQUATION_RGB) is context.FUNC_ADD
-PASS context.getInteger(context.BLEND_SRC_ALPHA) is 1
-PASS context.getInteger(context.BLEND_SRC_RGB) is 1
-PASS context.getInteger(context.COLOR_CLEAR_VALUE) is 0
-PASS context.getInteger(context.COLOR_WRITEMASK) is 1
-PASS context.getInteger(context.CULL_FACE) is 0
-PASS context.getInteger(context.CULL_FACE_MODE) is context.BACK
-PASS context.getInteger(context.CURRENT_PROGRAM) is 0
-PASS context.getInteger(context.DEPTH_FUNC) is context.LESS
-PASS context.getInteger(context.DEPTH_RANGE) is 0
-PASS context.getInteger(context.DEPTH_TEST) is 0
-PASS context.getInteger(context.DEPTH_WRITEMASK) is 1
-PASS context.getInteger(context.DITHER) is 1
-PASS context.getInteger(context.ELEMENT_ARRAY_BUFFER_BINDING) is 0
-PASS context.getInteger(context.FRONT_FACE) is context.CCW
-PASS context.getInteger(context.GENERATE_MIPMAP_HINT) is context.DONT_CARE
-PASS context.getInteger(context.LINE_WIDTH) is 1
-PASS context.getInteger(context.POLYGON_OFFSET_FACTOR) is 0
-PASS context.getInteger(context.POLYGON_OFFSET_FILL) is 0
-PASS context.getInteger(context.POLYGON_OFFSET_UNITS) is 0
-PASS context.getInteger(context.RENDERBUFFER_BINDING_EXT) is 0
-PASS context.getInteger(context.SAMPLE_COVERAGE_INVERT) is 0
-PASS context.getInteger(context.SAMPLE_COVERAGE_VALUE) is 1
-PASS context.getInteger(context.SCISSOR_BOX) is 0
-PASS context.getInteger(context.SCISSOR_TEST) is 0
-PASS context.getInteger(context.STENCIL_BACK_FAIL) is context.KEEP
-PASS context.getInteger(context.STENCIL_BACK_FUNC) is context.ALWAYS
-PASS context.getInteger(context.STENCIL_BACK_PASS_DEPTH_FAIL) is context.KEEP
-PASS context.getInteger(context.STENCIL_BACK_PASS_DEPTH_PASS) is context.KEEP
-PASS context.getInteger(context.STENCIL_BACK_REF) is 0
-PASS context.getInteger(context.STENCIL_BACK_VALUE_MASK) is -1
-PASS context.getInteger(context.STENCIL_BACK_WRITEMASK) is -1
-PASS context.getInteger(context.STENCIL_BITS) is 0
-PASS context.getInteger(context.STENCIL_CLEAR_VALUE) is 0
-PASS context.getInteger(context.STENCIL_FAIL) is context.KEEP
-PASS context.getInteger(context.STENCIL_FUNC) is context.ALWAYS
-PASS context.getInteger(context.STENCIL_PASS_DEPTH_FAIL) is context.KEEP
-PASS context.getInteger(context.STENCIL_PASS_DEPTH_PASS) is context.KEEP
-PASS context.getInteger(context.STENCIL_REF) is 0
-PASS context.getInteger(context.STENCIL_TEST) is 0
-PASS context.getInteger(context.STENCIL_VALUE_MASK) is -1
-PASS context.getInteger(context.STENCIL_WRITEMASK) is -1
-PASS context.getInteger(context.TEXTURE_BINDING_2D) is 0
-PASS context.getInteger(context.TEXTURE_BINDING_CUBE_MAP) is 0
-PASS context.getInteger(context.VIEWPORT) is 0
+PASS context.getParameter(context.ACTIVE_TEXTURE) is context.TEXTURE0
+PASS (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] == 1) || (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[1] == 1) is true
+PASS (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] == 1) || (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[1] == 1) is true
+PASS context.getParameter(context.ARRAY_BUFFER_BINDING) is null
+PASS context.getParameter(context.BLEND) is false
+PASS context.getParameter(context.BLEND_COLOR) is [0, 0, 0, 0]
+PASS context.getParameter(context.BLEND_DST_ALPHA) is 0
+PASS context.getParameter(context.BLEND_DST_RGB) is 0
+PASS context.getParameter(context.BLEND_EQUATION_ALPHA) is context.FUNC_ADD
+PASS context.getParameter(context.BLEND_EQUATION_RGB) is context.FUNC_ADD
+PASS context.getParameter(context.BLEND_SRC_ALPHA) is 1
+PASS context.getParameter(context.BLEND_SRC_RGB) is 1
+PASS context.getParameter(context.COLOR_CLEAR_VALUE) is [0, 0, 0, 0]
+PASS context.getParameter(context.COLOR_WRITEMASK) is [1, 1, 1, 1]
+PASS context.getParameter(context.CULL_FACE) is false
+PASS context.getParameter(context.CULL_FACE_MODE) is context.BACK
+PASS context.getParameter(context.CURRENT_PROGRAM) is null
+PASS context.getParameter(context.DEPTH_FUNC) is context.LESS
+PASS context.getParameter(context.DEPTH_RANGE) is [0, 1]
+PASS context.getParameter(context.DEPTH_TEST) is false
+PASS context.getParameter(context.DEPTH_WRITEMASK) is true
+PASS context.getParameter(context.DITHER) is true
+PASS context.getParameter(context.ELEMENT_ARRAY_BUFFER_BINDING) is null
+PASS context.getParameter(context.FRONT_FACE) is context.CCW
+PASS context.getParameter(context.GENERATE_MIPMAP_HINT) is context.DONT_CARE
+PASS context.getParameter(context.LINE_WIDTH) is 1
+PASS context.getParameter(context.POLYGON_OFFSET_FACTOR) is 0
+PASS context.getParameter(context.POLYGON_OFFSET_FILL) is false
+PASS context.getParameter(context.POLYGON_OFFSET_UNITS) is 0
+PASS context.getParameter(context.RENDERBUFFER_BINDING) is null
+PASS context.getParameter(context.SAMPLE_COVERAGE_INVERT) is false
+PASS context.getParameter(context.SAMPLE_COVERAGE_VALUE) is 1
+PASS context.getParameter(context.SCISSOR_BOX)[0] is 0
+PASS context.getParameter(context.SCISSOR_BOX)[1] is 0
+PASS context.getParameter(context.SCISSOR_TEST) is false
+PASS context.getParameter(context.STENCIL_BACK_FAIL) is context.KEEP
+PASS context.getParameter(context.STENCIL_BACK_FUNC) is context.ALWAYS
+PASS context.getParameter(context.STENCIL_BACK_PASS_DEPTH_FAIL) is context.KEEP
+PASS context.getParameter(context.STENCIL_BACK_PASS_DEPTH_PASS) is context.KEEP
+PASS context.getParameter(context.STENCIL_BACK_REF) is 0
+PASS context.getParameter(context.STENCIL_BITS) is 0
+PASS context.getParameter(context.STENCIL_CLEAR_VALUE) is 0
+PASS context.getParameter(context.STENCIL_FAIL) is context.KEEP
+PASS context.getParameter(context.STENCIL_FUNC) is context.ALWAYS
+PASS context.getParameter(context.STENCIL_PASS_DEPTH_FAIL) is context.KEEP
+PASS context.getParameter(context.STENCIL_PASS_DEPTH_PASS) is context.KEEP
+PASS context.getParameter(context.STENCIL_REF) is 0
+PASS context.getParameter(context.STENCIL_TEST) is false
+PASS context.getParameter(context.TEXTURE_BINDING_2D) is null
+PASS context.getParameter(context.TEXTURE_BINDING_CUBE_MAP) is null
+PASS context.getParameter(context.VIEWPORT) is [0, 0, 2, 2]
 
 PASS successfullyParsed is true
 
diff --git a/LayoutTests/fast/canvas/webgl/gl-get-calls.html b/LayoutTests/fast/canvas/webgl/gl-get-calls.html
index c549c3e..8613ac5 100644
--- a/LayoutTests/fast/canvas/webgl/gl-get-calls.html
+++ b/LayoutTests/fast/canvas/webgl/gl-get-calls.html
@@ -7,7 +7,7 @@
 <body>
 <div id="description"></div>
 <div id="console"></div>
-<canvas id="canvas"> </canvas>
+<canvas id="canvas" width="2" height="2"> </canvas>
 
 <script>
 
@@ -38,60 +38,63 @@ else {
 
     debug("");
     debug("Check default values");
-    shouldBe('context.getInteger(context.ACTIVE_TEXTURE)', 'context.TEXTURE0');
-    shouldBe('context.getInteger(context.ALIASED_LINE_WIDTH_RANGE)', '1');
-    shouldBe('context.getInteger(context.ALIASED_POINT_SIZE_RANGE)', '1');
-    shouldBe('context.getInteger(context.ARRAY_BUFFER_BINDING)', '0');
-    shouldBe('context.getInteger(context.BLEND)', '0');
-    shouldBe('context.getInteger(context.BLEND_COLOR)', '0');
-    shouldBe('context.getInteger(context.BLEND_DST_ALPHA)', '0');
-    shouldBe('context.getInteger(context.BLEND_DST_RGB)', '0');
-    shouldBe('context.getInteger(context.BLEND_EQUATION_ALPHA)', 'context.FUNC_ADD');
-    shouldBe('context.getInteger(context.BLEND_EQUATION_RGB)', 'context.FUNC_ADD');
-    shouldBe('context.getInteger(context.BLEND_SRC_ALPHA)', '1');
-    shouldBe('context.getInteger(context.BLEND_SRC_RGB)', '1');
-    shouldBe('context.getInteger(context.COLOR_CLEAR_VALUE)', '0');
-    shouldBe('context.getInteger(context.COLOR_WRITEMASK)', '1');
-    shouldBe('context.getInteger(context.CULL_FACE)', '0');
-    shouldBe('context.getInteger(context.CULL_FACE_MODE)', 'context.BACK');
-    shouldBe('context.getInteger(context.CURRENT_PROGRAM)', '0');
-    shouldBe('context.getInteger(context.DEPTH_FUNC)', 'context.LESS');
-    shouldBe('context.getInteger(context.DEPTH_RANGE)', '0');
-    shouldBe('context.getInteger(context.DEPTH_TEST)', '0');
-    shouldBe('context.getInteger(context.DEPTH_WRITEMASK)', '1');
-    shouldBe('context.getInteger(context.DITHER)', '1');
-    shouldBe('context.getInteger(context.ELEMENT_ARRAY_BUFFER_BINDING)', '0');
-    shouldBe('context.getInteger(context.FRONT_FACE)', 'context.CCW');
-    shouldBe('context.getInteger(context.GENERATE_MIPMAP_HINT)', 'context.DONT_CARE');
-    shouldBe('context.getInteger(context.LINE_WIDTH)', '1');
-    shouldBe('context.getInteger(context.POLYGON_OFFSET_FACTOR)', '0');
-    shouldBe('context.getInteger(context.POLYGON_OFFSET_FILL)', '0');
-    shouldBe('context.getInteger(context.POLYGON_OFFSET_UNITS)', '0');
-    shouldBe('context.getInteger(context.RENDERBUFFER_BINDING_EXT)', '0');
-    shouldBe('context.getInteger(context.SAMPLE_COVERAGE_INVERT)', '0');
-    shouldBe('context.getInteger(context.SAMPLE_COVERAGE_VALUE)', '1');
-    shouldBe('context.getInteger(context.SCISSOR_BOX)', '0');
-    shouldBe('context.getInteger(context.SCISSOR_TEST)', '0');
-    shouldBe('context.getInteger(context.STENCIL_BACK_FAIL)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_BACK_FUNC)', 'context.ALWAYS');
-    shouldBe('context.getInteger(context.STENCIL_BACK_PASS_DEPTH_FAIL)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_BACK_PASS_DEPTH_PASS)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_BACK_REF)', '0');
-    shouldBe('context.getInteger(context.STENCIL_BACK_VALUE_MASK)', '-1');
-    shouldBe('context.getInteger(context.STENCIL_BACK_WRITEMASK)', '-1');
-    shouldBe('context.getInteger(context.STENCIL_BITS)', '0');
-    shouldBe('context.getInteger(context.STENCIL_CLEAR_VALUE)', '0');
-    shouldBe('context.getInteger(context.STENCIL_FAIL)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_FUNC)', 'context.ALWAYS');
-    shouldBe('context.getInteger(context.STENCIL_PASS_DEPTH_FAIL)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_PASS_DEPTH_PASS)', 'context.KEEP');
-    shouldBe('context.getInteger(context.STENCIL_REF)', '0');
-    shouldBe('context.getInteger(context.STENCIL_TEST)', '0');
-    shouldBe('context.getInteger(context.STENCIL_VALUE_MASK)', '-1');
-    shouldBe('context.getInteger(context.STENCIL_WRITEMASK)', '-1');
-    shouldBe('context.getInteger(context.TEXTURE_BINDING_2D)', '0');
-    shouldBe('context.getInteger(context.TEXTURE_BINDING_CUBE_MAP)', '0');
-    shouldBe('context.getInteger(context.VIEWPORT)', '0');
+    shouldBe('context.getParameter(context.ACTIVE_TEXTURE)', 'context.TEXTURE0');
+    shouldBe('(context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] == 1) || (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[1] == 1)', 'true');
+    shouldBe('(context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] == 1) || (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[1] == 1)', 'true');
+    shouldBe('context.getParameter(context.ARRAY_BUFFER_BINDING)', 'null');
+    shouldBe('context.getParameter(context.BLEND)', 'false');
+    shouldBe('context.getParameter(context.BLEND_COLOR)', '[0, 0, 0, 0]');
+    shouldBe('context.getParameter(context.BLEND_DST_ALPHA)', '0');
+    shouldBe('context.getParameter(context.BLEND_DST_RGB)', '0');
+    shouldBe('context.getParameter(context.BLEND_EQUATION_ALPHA)', 'context.FUNC_ADD');
+    shouldBe('context.getParameter(context.BLEND_EQUATION_RGB)', 'context.FUNC_ADD');
+    shouldBe('context.getParameter(context.BLEND_SRC_ALPHA)', '1');
+    shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1');
+    shouldBe('context.getParameter(context.COLOR_CLEAR_VALUE)', '[0, 0, 0, 0]');
+    shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[1, 1, 1, 1]');
+    shouldBe('context.getParameter(context.CULL_FACE)', 'false');
+    shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK');
+    shouldBe('context.getParameter(context.CURRENT_PROGRAM)', 'null');
+    shouldBe('context.getParameter(context.DEPTH_FUNC)', 'context.LESS');
+    shouldBe('context.getParameter(context.DEPTH_RANGE)', '[0, 1]');
+    shouldBe('context.getParameter(context.DEPTH_TEST)', 'false');
+    shouldBe('context.getParameter(context.DEPTH_WRITEMASK)', 'true');
+    shouldBe('context.getParameter(context.DITHER)', 'true');
+    shouldBe('context.getParameter(context.ELEMENT_ARRAY_BUFFER_BINDING)', 'null');
+    shouldBe('context.getParameter(context.FRONT_FACE)', 'context.CCW');
+    shouldBe('context.getParameter(context.GENERATE_MIPMAP_HINT)', 'context.DONT_CARE');
+    shouldBe('context.getParameter(context.LINE_WIDTH)', '1');
+    shouldBe('context.getParameter(context.POLYGON_OFFSET_FACTOR)', '0');
+    shouldBe('context.getParameter(context.POLYGON_OFFSET_FILL)', 'false');
+    shouldBe('context.getParameter(context.POLYGON_OFFSET_UNITS)', '0');
+    shouldBe('context.getParameter(context.RENDERBUFFER_BINDING)', 'null');
+    shouldBe('context.getParameter(context.SAMPLE_COVERAGE_INVERT)', 'false');
+    shouldBe('context.getParameter(context.SAMPLE_COVERAGE_VALUE)', '1');
+    shouldBe('context.getParameter(context.SCISSOR_BOX)[0]', '0');
+    shouldBe('context.getParameter(context.SCISSOR_BOX)[1]', '0');
+    shouldBe('context.getParameter(context.SCISSOR_TEST)', 'false');
+    shouldBe('context.getParameter(context.STENCIL_BACK_FAIL)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_BACK_FUNC)', 'context.ALWAYS');
+    shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_FAIL)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_PASS)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_BACK_REF)', '0');
+    
+    // FIXME: Current WebKit implementation returns the wrong value (https://bugs.webkit.org/show_bug.cgi?id=31842)
+    //shouldBe('context.getParameter(context.STENCIL_BACK_VALUE_MASK)', '0xFFFFFFFF');
+    //shouldBe('context.getParameter(context.STENCIL_BACK_WRITEMASK)', '0xFFFFFFFF');
+    shouldBe('context.getParameter(context.STENCIL_BITS)', '0');
+    shouldBe('context.getParameter(context.STENCIL_CLEAR_VALUE)', '0');
+    shouldBe('context.getParameter(context.STENCIL_FAIL)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_FUNC)', 'context.ALWAYS');
+    shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_FAIL)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_PASS)', 'context.KEEP');
+    shouldBe('context.getParameter(context.STENCIL_REF)', '0');
+    shouldBe('context.getParameter(context.STENCIL_TEST)', 'false');
+    //shouldBe('context.getParameter(context.STENCIL_VALUE_MASK)', '0xFFFFFFFF');
+    //shouldBe('context.getParameter(context.STENCIL_WRITEMASK)', '0xFFFFFFFF');
+    shouldBe('context.getParameter(context.TEXTURE_BINDING_2D)', 'null');
+    shouldBe('context.getParameter(context.TEXTURE_BINDING_CUBE_MAP)', 'null');
+    shouldBe('context.getParameter(context.VIEWPORT)', '[0, 0, 2, 2]');
 }
 
 debug("");
diff --git a/LayoutTests/fast/canvas/webgl/incorrect-context-object-behaviour-expected.txt b/LayoutTests/fast/canvas/webgl/incorrect-context-object-behaviour-expected.txt
index 777d091..2b94908 100644
--- a/LayoutTests/fast/canvas/webgl/incorrect-context-object-behaviour-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/incorrect-context-object-behaviour-expected.txt
@@ -17,17 +17,12 @@ PASS contextA.bindRenderbuffer(contextA.RENDERBUFFER, renderBufferB) threw excep
 PASS contextA.bindTexture(contextA.TEXTURE_2D, textureB) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.framebufferRenderbuffer(contextA.FRAMEBUFFER, contextA.DEPTH_ATTACHMENT, contextA.RENDERBUFFER, renderBufferB) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.framebufferTexture2D(contextA.FRAMEBUFFER, contextA.COLOR_ATTACHMENT0, contextA.TEXTURE_2D, textureB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getProgrami(programB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getProgramiv(programB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS contextA.getProgramParameter(programB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.getProgramInfoLog(programB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getShaderi(shaderB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getShaderiv(shaderB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS contextA.getShaderParameter(shaderB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.getShaderInfoLog(shaderB, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.getShaderSource(shaderB) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getUniformf(programB, locationA) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getUniformfv(programB, locationA) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getUniformi(programB, locationA) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS contextA.getUniformiv(programB, locationA) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS contextA.getUniform(programB, locationA) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS contextA.getUniformLocation(programB, 'u_modelViewProjMatrix') threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS successfullyParsed is true
 
diff --git a/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt b/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
index 1db44bf..be50669 100644
--- a/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
@@ -18,17 +18,12 @@ PASS context.bindRenderbuffer(context.RENDERBUFFER, 0) is undefined.
 PASS context.bindTexture(context.TEXTURE_2D, 0) is undefined.
 PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) is undefined.
 PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) is undefined.
-PASS context.getProgrami(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getProgramiv(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS context.getProgramParameter(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS context.getProgramInfoLog(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getShaderi(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getShaderiv(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS context.getShaderParameter(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS context.getShaderInfoLog(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS context.getShaderSource(undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getUniformf(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getUniformfv(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getUniformi(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS context.getUniformiv(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS context.getUniform(undefined, 0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS context.getUniformLocation(undefined, 'foo') threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS successfullyParsed is true
 
diff --git a/LayoutTests/fast/canvas/webgl/resources/utils3d.js b/LayoutTests/fast/canvas/webgl/resources/utils3d.js
index de42174..09f7430 100644
--- a/LayoutTests/fast/canvas/webgl/resources/utils3d.js
+++ b/LayoutTests/fast/canvas/webgl/resources/utils3d.js
@@ -51,7 +51,7 @@ function initWebGL(canvasName, vshader, fshader, attribs, clearColor, clearDepth
     gl.linkProgram(gl.program);
 
     // Check the link status
-    var linked = gl.getProgrami(gl.program, gl.LINK_STATUS);
+    var linked = gl.getProgramParameter(gl.program, gl.LINK_STATUS);
     if (!linked) {
         // something went wrong with the link
         var error = gl.getProgramInfoLog (gl.program);
@@ -113,7 +113,7 @@ function loadShader(ctx, shaderId)
     ctx.compileShader(shader);
 
     // Check the compile status
-    var compiled = ctx.getShaderi(shader, ctx.COMPILE_STATUS);
+    var compiled = ctx.getShaderParameter(shader, ctx.COMPILE_STATUS);
     if (!compiled) {
         // Something went wrong during compilation; get the error
         var error = ctx.getShaderInfoLog(shader);
@@ -536,4 +536,3 @@ Framerate.prototype.snapshot = function()
         this.renderTime = newTime;
     }
 }
-
diff --git a/LayoutTests/fast/canvas/webgl/resources/webgl-test.js b/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
index f68a434..3623e75 100644
--- a/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
+++ b/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
@@ -24,16 +24,32 @@ function loadStandardProgram(context) {
     return program;
 }
 
+function loadProgram(context, vertexShaderPath, fragmentShaderPath) {
+    var program = context.createProgram();
+    context.attachShader(program, loadVertexShader(context, vertexShaderPath));
+    context.attachShader(program, loadFragmentShader(context, fragmentShaderPath));
+    context.linkProgram(program);
+    return program;
+}
+
 function loadStandardVertexShader(context) {
+    return loadVertexShader(context, "resources/vertexShader.vert");
+}
+
+function loadVertexShader(context, path) {
     var vertexShader = context.createShader(context.VERTEX_SHADER);
-    context.shaderSource(vertexShader, getShaderSource("resources/vertexShader.vert"));
+    context.shaderSource(vertexShader, getShaderSource(path));
     context.compileShader(vertexShader);
     return vertexShader;
 }
 
 function loadStandardFragmentShader(context) {
+    return loadFragmentShader(context, "resources/fragmentShader.frag");
+}
+
+function loadFragmentShader(context, path) {
     var fragmentShader = context.createShader(context.FRAGMENT_SHADER);
-    context.shaderSource(fragmentShader, getShaderSource("resources/fragmentShader.frag"));
+    context.shaderSource(fragmentShader, getShaderSource(path));
     context.compileShader(fragmentShader);
     return fragmentShader;
 }
diff --git a/LayoutTests/fast/canvas/webgl/script-tests/incorrect-context-object-behaviour.js b/LayoutTests/fast/canvas/webgl/script-tests/incorrect-context-object-behaviour.js
index c81d7b9..cf1f5a1 100644
--- a/LayoutTests/fast/canvas/webgl/script-tests/incorrect-context-object-behaviour.js
+++ b/LayoutTests/fast/canvas/webgl/script-tests/incorrect-context-object-behaviour.js
@@ -31,17 +31,12 @@ shouldThrow("contextA.bindRenderbuffer(contextA.RENDERBUFFER, renderBufferB)");
 shouldThrow("contextA.bindTexture(contextA.TEXTURE_2D, textureB)");
 shouldThrow("contextA.framebufferRenderbuffer(contextA.FRAMEBUFFER, contextA.DEPTH_ATTACHMENT, contextA.RENDERBUFFER, renderBufferB)");
 shouldThrow("contextA.framebufferTexture2D(contextA.FRAMEBUFFER, contextA.COLOR_ATTACHMENT0, contextA.TEXTURE_2D, textureB, 0)");
-shouldThrow("contextA.getProgrami(programB, 0)");
-shouldThrow("contextA.getProgramiv(programB, 0)");
+shouldThrow("contextA.getProgramParameter(programB, 0)");
 shouldThrow("contextA.getProgramInfoLog(programB, 0)");
-shouldThrow("contextA.getShaderi(shaderB, 0)");
-shouldThrow("contextA.getShaderiv(shaderB, 0)");
+shouldThrow("contextA.getShaderParameter(shaderB, 0)");
 shouldThrow("contextA.getShaderInfoLog(shaderB, 0)");
 shouldThrow("contextA.getShaderSource(shaderB)");
-shouldThrow("contextA.getUniformf(programB, locationA)");
-shouldThrow("contextA.getUniformfv(programB, locationA)");
-shouldThrow("contextA.getUniformi(programB, locationA)");
-shouldThrow("contextA.getUniformiv(programB, locationA)");
+shouldThrow("contextA.getUniform(programB, locationA)");
 shouldThrow("contextA.getUniformLocation(programB, 'u_modelViewProjMatrix')");
 
 successfullyParsed = true;
diff --git a/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js b/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
index 47b23d2..1fddb0e 100644
--- a/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
+++ b/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
@@ -20,17 +20,12 @@ shouldBeUndefined("context.bindRenderbuffer(context.RENDERBUFFER, 0)");
 shouldBeUndefined("context.bindTexture(context.TEXTURE_2D, 0)");
 shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
 shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
-shouldThrow("context.getProgrami(undefined, 0)");
-shouldThrow("context.getProgramiv(undefined, 0)");
+shouldThrow("context.getProgramParameter(undefined, 0)");
 shouldThrow("context.getProgramInfoLog(undefined, 0)");
-shouldThrow("context.getShaderi(undefined, 0)");
-shouldThrow("context.getShaderiv(undefined, 0)");
+shouldThrow("context.getShaderParameter(undefined, 0)");
 shouldThrow("context.getShaderInfoLog(undefined, 0)");
 shouldThrow("context.getShaderSource(undefined)");
-shouldThrow("context.getUniformf(undefined, 0)");
-shouldThrow("context.getUniformfv(undefined, 0)");
-shouldThrow("context.getUniformi(undefined, 0)");
-shouldThrow("context.getUniformiv(undefined, 0)");
+shouldThrow("context.getUniform(undefined, 0)");
 shouldThrow("context.getUniformLocation(undefined, 'foo')");
 
 successfullyParsed = true;
diff --git a/LayoutTests/fast/canvas/webgl/triangle.html b/LayoutTests/fast/canvas/webgl/triangle.html
index 3c29121..57852e7 100644
--- a/LayoutTests/fast/canvas/webgl/triangle.html
+++ b/LayoutTests/fast/canvas/webgl/triangle.html
@@ -64,11 +64,11 @@
             var offset = (15*50+20) * 4;
             for (var i = 0; i < 10; ++i)
                 if (buf[offset+i*4] != 255 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
-                    fail(20, 15, buf, "(255,0,0,255)");
+                    fail(20 + i, 15, buf, "(255,0,0,255)");
                     return;
                 }
             // Last line should be all black
-            offset = (49*50) * 4
+            offset = (49*50) * 4;
             for (var i = 0; i < 50; ++i)
                 if (buf[offset+i*4] != 0 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
                     fail(i, 49, buf, "(0,0,0,255)");
diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js
index a393a3e..b91812f 100644
--- a/LayoutTests/fast/js/resources/js-test-pre.js
+++ b/LayoutTests/fast/js/resources/js-test-pre.js
@@ -159,6 +159,42 @@ function shouldEvaluateTo(actual, expected) {
   }
 }
 
+function shouldBeNonZero(_a)
+{
+  var exception;
+  var _av;
+  try {
+     _av = eval(_a);
+  } catch (e) {
+     exception = e;
+  }
+
+  if (exception)
+    testFailed(_a + " should be non-zero. Threw exception " + exception);
+  else if (_av != 0)
+    testPassed(_a + " is non-zero.");
+  else
+    testFailed(_a + " should be non-zero. Was " + _av);
+}
+
+function shouldBeNonNull(_a)
+{
+  var exception;
+  var _av;
+  try {
+     _av = eval(_a);
+  } catch (e) {
+     exception = e;
+  }
+
+  if (exception)
+    testFailed(_a + " should be non-null. Threw exception " + exception);
+  else if (_av != null)
+    testPassed(_a + " is non-null.");
+  else
+    testFailed(_a + " should be non-null. Was " + _av);
+}
+
 function shouldBeUndefined(_a)
 {
   var exception;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a432a83..d41d4e0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,138 @@
+2009-11-23  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Change get... calls to latest spec
+        https://bugs.webkit.org/show_bug.cgi?id=30091
+
+        Removed old versions of get calls on WebGLRenderingContext and
+        added new ones per spec returning "any". New code simplifies
+        GraphicsContext3D and fixes previously unimplemented routines.
+        Added custom JS and V8 bindings. Added exhaustive test case
+        exercising all new code paths. Updated preexisting test cases for
+        new APIs. Fixed preexisting bugs in WebKit's and Chrome's WebGL
+        implementations.
+
+        Ran WebGL layout tests in WebKit (clean) and Chrome (couple of
+        preexisting known failures) and manual WebGL tests in both
+        browsers.
+
+        Test: fast/canvas/webgl/gl-object-get-calls.html
+
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSWebGLRenderingContextCustom.cpp:
+        (WebCore::toJS):
+        (WebCore::):
+        (WebCore::getObjectParameter):
+        (WebCore::getProgramParameterHelper):
+        (WebCore::JSWebGLRenderingContext::getBufferParameter):
+        (WebCore::JSWebGLRenderingContext::getFramebufferAttachmentParameter):
+        (WebCore::JSWebGLRenderingContext::getParameter):
+        (WebCore::JSWebGLRenderingContext::getProgramParameter):
+        (WebCore::JSWebGLRenderingContext::getRenderbufferParameter):
+        (WebCore::JSWebGLRenderingContext::getShaderParameter):
+        (WebCore::JSWebGLRenderingContext::getTexParameter):
+        (WebCore::JSWebGLRenderingContext::getUniform):
+        (WebCore::JSWebGLRenderingContext::getVertexAttrib):
+        * bindings/v8/custom/V8CustomBinding.h:
+        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+        (WebCore::toV8):
+        (WebCore::):
+        (WebCore::getObjectParameter):
+        (WebCore::getProgramParameter):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * html/canvas/CanvasObject.cpp:
+        (WebCore::CanvasObject::CanvasObject):
+        (WebCore::CanvasObject::setObject):
+        (WebCore::CanvasObject::deleteObject):
+        * html/canvas/CanvasObject.h:
+        * html/canvas/WebGLBuffer.cpp:
+        (WebCore::WebGLBuffer::create):
+        (WebCore::WebGLBuffer::WebGLBuffer):
+        * html/canvas/WebGLBuffer.h:
+        * html/canvas/WebGLGetInfo.cpp: Added.
+        (WebCore::WebGLGetInfo::WebGLGetInfo):
+        (WebCore::WebGLGetInfo::~WebGLGetInfo):
+        (WebCore::WebGLGetInfo::getType):
+        (WebCore::WebGLGetInfo::getBool):
+        (WebCore::WebGLGetInfo::getFloat):
+        (WebCore::WebGLGetInfo::getLong):
+        (WebCore::WebGLGetInfo::getString):
+        (WebCore::WebGLGetInfo::getUnsignedLong):
+        (WebCore::WebGLGetInfo::getWebGLBuffer):
+        (WebCore::WebGLGetInfo::getWebGLFloatArray):
+        (WebCore::WebGLGetInfo::getWebGLFramebuffer):
+        (WebCore::WebGLGetInfo::getWebGLIntArray):
+        (WebCore::WebGLGetInfo::getWebGLProgram):
+        (WebCore::WebGLGetInfo::getWebGLRenderbuffer):
+        (WebCore::WebGLGetInfo::getWebGLTexture):
+        (WebCore::WebGLGetInfo::getWebGLUnsignedByteArray):
+        * html/canvas/WebGLGetInfo.h: Added.
+        (WebCore::WebGLGetInfo::):
+        * html/canvas/WebGLRenderbuffer.cpp:
+        (WebCore::WebGLRenderbuffer::create):
+        (WebCore::WebGLRenderbuffer::WebGLRenderbuffer):
+        * html/canvas/WebGLRenderbuffer.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLStateRestorer::WebGLStateRestorer):
+        (WebCore::WebGLStateRestorer::~WebGLStateRestorer):
+        (WebCore::WebGLRenderingContext::WebGLRenderingContext):
+        (WebCore::WebGLRenderingContext::activeTexture):
+        (WebCore::WebGLRenderingContext::bindBuffer):
+        (WebCore::WebGLRenderingContext::bindFramebuffer):
+        (WebCore::WebGLRenderingContext::bindRenderbuffer):
+        (WebCore::WebGLRenderingContext::bindTexture):
+        (WebCore::WebGLRenderingContext::getBufferParameter):
+        (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
+        (WebCore::WebGLRenderingContext::getParameter):
+        (WebCore::WebGLRenderingContext::getProgramParameter):
+        (WebCore::WebGLRenderingContext::getProgramInfoLog):
+        (WebCore::WebGLRenderingContext::getRenderbufferParameter):
+        (WebCore::WebGLRenderingContext::getShaderParameter):
+        (WebCore::WebGLRenderingContext::getShaderInfoLog):
+        (WebCore::WebGLRenderingContext::getShaderSource):
+        (WebCore::WebGLRenderingContext::getString):
+        (WebCore::WebGLRenderingContext::getTexParameter):
+        (WebCore::WebGLRenderingContext::getUniform):
+        (WebCore::WebGLRenderingContext::getVertexAttrib):
+        (WebCore::WebGLRenderingContext::useProgram):
+        (WebCore::WebGLRenderingContext::getBooleanParameter):
+        (WebCore::WebGLRenderingContext::getFloatParameter):
+        (WebCore::WebGLRenderingContext::getIntParameter):
+        (WebCore::WebGLRenderingContext::getLongParameter):
+        (WebCore::WebGLRenderingContext::getUnsignedLongParameter):
+        (WebCore::WebGLRenderingContext::getWebGLFloatArrayParameter):
+        (WebCore::WebGLRenderingContext::getWebGLIntArrayParameter):
+        (WebCore::WebGLRenderingContext::getWebGLUnsignedByteArrayParameter):
+        * html/canvas/WebGLRenderingContext.h:
+        * html/canvas/WebGLRenderingContext.idl:
+        * html/canvas/WebGLTexture.cpp:
+        (WebCore::WebGLTexture::create):
+        (WebCore::WebGLTexture::WebGLTexture):
+        * html/canvas/WebGLTexture.h:
+        * manual-tests/webgl/resources/utils3d.js:
+        (initWebGL):
+        (loadShader):
+        (Framerate.prototype.snapshot):
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/mac/GraphicsContext3DMac.cpp:
+        (WebCore::GraphicsContext3D::bindRenderbuffer):
+        (WebCore::GraphicsContext3D::getBooleanv):
+        (WebCore::GraphicsContext3D::getBufferParameteriv):
+        (WebCore::GraphicsContext3D::getFloatv):
+        (WebCore::GraphicsContext3D::getFramebufferAttachmentParameteriv):
+        (WebCore::GraphicsContext3D::getIntegerv):
+        (WebCore::GraphicsContext3D::getProgramiv):
+        (WebCore::GraphicsContext3D::getRenderbufferParameteriv):
+        (WebCore::GraphicsContext3D::getShaderiv):
+        (WebCore::GraphicsContext3D::getTexParameterfv):
+        (WebCore::GraphicsContext3D::getTexParameteriv):
+        (WebCore::GraphicsContext3D::getUniformfv):
+        (WebCore::GraphicsContext3D::getUniformiv):
+        (WebCore::GraphicsContext3D::getVertexAttribfv):
+        (WebCore::GraphicsContext3D::getVertexAttribiv):
+
 2009-11-24  Steve Falkenburg  <sfalken at apple.com>
 
         Windows build fix.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 362bce7..2225dee 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1283,6 +1283,8 @@
             'html/canvas/WebGLFloatArray.h',
             'html/canvas/WebGLFramebuffer.cpp',
             'html/canvas/WebGLFramebuffer.h',
+            'html/canvas/WebGLGetInfo.cpp',
+            'html/canvas/WebGLGetInfo.h',
             'html/canvas/CanvasGradient.cpp',
             'html/canvas/CanvasGradient.h',
             'html/canvas/WebGLIntArray.cpp',
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 011b1c1..f1964f5 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1199,6 +1199,8 @@
 		65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DF323609D1DE65000BE325 /* JSCanvasPattern.h */; };
 		65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */; };
 		65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
+		6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
+		6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
 		72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
 		754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
 		754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
@@ -6507,6 +6509,8 @@
 		65DF323609D1DE65000BE325 /* JSCanvasPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCanvasPattern.h; sourceTree = "<group>"; };
 		65F80697054D9F86008BF776 /* BlockExceptions.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlockExceptions.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
+		6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
+		6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };
 		72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
 		754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
 		754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
@@ -10640,6 +10644,8 @@
 				49C7B9AE1042D32E0009D447 /* WebGLFramebuffer.cpp */,
 				49C7B9AF1042D32E0009D447 /* WebGLFramebuffer.h */,
 				49C7B9B01042D32E0009D447 /* WebGLFramebuffer.idl */,
+				6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */,
+				6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */,
 				49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */,
 				49484FB4102CF23C00187DD3 /* CanvasGradient.h */,
 				49484FB5102CF23C00187DD3 /* CanvasGradient.idl */,
@@ -18134,6 +18140,7 @@
 				E124748410AA161D00B79493 /* AuthenticationClient.h in Headers */,
 				9382DF5810A8D5C900925652 /* ColorSpace.h in Headers */,
 				AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */,
+				6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -20277,6 +20284,7 @@
 				1479FAEF109AE37500DED655 /* RenderRubyBase.cpp in Sources */,
 				1479FAF1109AE37500DED655 /* RenderRubyRun.cpp in Sources */,
 				1479FAF3109AE37500DED655 /* RenderRubyText.cpp in Sources */,
+				6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
index d89eca7..47fb793 100644
--- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
@@ -33,11 +33,25 @@
 #include "ExceptionCode.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
-#include "JSWebGLFloatArray.h"
-#include "JSWebGLIntArray.h"
 #include "JSHTMLCanvasElement.h"
 #include "JSHTMLImageElement.h"
+#include "JSWebGLBuffer.h"
+#include "JSWebGLFloatArray.h"
+#include "JSWebGLFramebuffer.h"
+#include "JSWebGLIntArray.h"
+#include "JSWebGLProgram.h"
+#include "JSWebGLRenderbuffer.h"
+#include "JSWebGLShader.h"
+#include "JSWebGLTexture.h"
+#include "JSWebGLUnsignedByteArray.h"
 #include "JSWebKitCSSMatrix.h"
+#include "NotImplemented.h"
+#include "WebGLBuffer.h"
+#include "WebGLGetInfo.h"
+#include "WebGLFloatArray.h"
+#include "WebGLFramebuffer.h"
+#include "WebGLIntArray.h"
+#include "WebGLProgram.h"
 #include <runtime/Error.h>
 #include <wtf/FastMalloc.h>
 #include <wtf/OwnFastMallocPtr.h>
@@ -87,6 +101,214 @@ JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec, JSC::ArgLis
     return jsUndefined();
 }
 
+static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebGLGetInfo& info)
+{
+    switch (info.getType()) {
+    case WebGLGetInfo::kTypeBool:
+        return jsBoolean(info.getBool());
+    case WebGLGetInfo::kTypeFloat:
+        return jsNumber(exec, info.getFloat());
+    case WebGLGetInfo::kTypeLong:
+        return jsNumber(exec, info.getLong());
+    case WebGLGetInfo::kTypeNull:
+        return jsNull();
+    case WebGLGetInfo::kTypeString:
+        return jsString(exec, info.getString());
+    case WebGLGetInfo::kTypeUnsignedLong:
+        return jsNumber(exec, info.getUnsignedLong());
+    case WebGLGetInfo::kTypeWebGLBuffer:
+        return toJS(exec, globalObject, info.getWebGLBuffer());
+    case WebGLGetInfo::kTypeWebGLFloatArray:
+        return toJS(exec, globalObject, info.getWebGLFloatArray());
+    case WebGLGetInfo::kTypeWebGLFramebuffer:
+        return toJS(exec, globalObject, info.getWebGLFramebuffer());
+    case WebGLGetInfo::kTypeWebGLIntArray:
+        return toJS(exec, globalObject, info.getWebGLIntArray());
+    // FIXME: implement WebGLObjectArray
+    // case WebGLGetInfo::kTypeWebGLObjectArray:
+    case WebGLGetInfo::kTypeWebGLProgram:
+        return toJS(exec, globalObject, info.getWebGLProgram());
+    case WebGLGetInfo::kTypeWebGLRenderbuffer:
+        return toJS(exec, globalObject, info.getWebGLRenderbuffer());
+    case WebGLGetInfo::kTypeWebGLTexture:
+        return toJS(exec, globalObject, info.getWebGLTexture());
+    case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
+        return toJS(exec, globalObject, info.getWebGLUnsignedByteArray());
+    default:
+        notImplemented();
+        return jsUndefined();
+    }
+}
+
+enum ObjectType {
+    kBuffer, kRenderbuffer, kTexture, kVertexAttrib
+};
+
+static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, const ArgList& args, ObjectType objectType)
+{
+    if (args.size() != 2)
+        return throwError(exec, SyntaxError);
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl());
+    unsigned target = args.at(0).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    unsigned pname = args.at(1).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    WebGLGetInfo info;
+    switch (objectType) {
+    case kBuffer:
+        info = context->getBufferParameter(target, pname, ec);
+        break;
+    case kRenderbuffer:
+        info = context->getRenderbufferParameter(target, pname, ec);
+        break;
+    case kTexture:
+        info = context->getTexParameter(target, pname, ec);
+        break;
+    case kVertexAttrib:
+        // target => index
+        info = context->getVertexAttrib(target, pname, ec);
+        break;
+    default:
+        notImplemented();
+        break;
+    }
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, obj->globalObject(), info);
+}
+
+enum WhichProgramCall {
+    kProgramParameter, kUniform
+};
+
+static JSValue getProgramParameterHelper(JSWebGLRenderingContext* obj, ExecState* exec, const ArgList& args, WhichProgramCall programCall)
+{
+    if (args.size() != 2)
+        return throwError(exec, SyntaxError);
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl());
+    WebGLProgram* program = toWebGLProgram(args.at(0));
+    unsigned pname = args.at(1).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    WebGLGetInfo info;
+    switch (programCall) {
+    case kProgramParameter:
+        info = context->getProgramParameter(program, pname, ec);
+        break;
+    case kUniform:
+        // pname -> location
+        info = context->getUniform(program, pname, ec);
+        break;
+    default:
+        notImplemented();
+        break;
+    }
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, obj->globalObject(), info);
+}
+
+JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec, const ArgList& args)
+{
+    return getObjectParameter(this, exec, args, kBuffer);
+}
+
+JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec, const ArgList& args)
+{
+    if (args.size() != 3)
+        return throwError(exec, SyntaxError);
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+    unsigned target = args.at(0).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    unsigned attachment = args.at(1).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    unsigned pname = args.at(2).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec);
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, globalObject(), info);
+}
+
+JSValue JSWebGLRenderingContext::getParameter(ExecState* exec, const ArgList& args)
+{
+    if (args.size() != 1)
+        return throwError(exec, SyntaxError);
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+    unsigned pname = args.at(0).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    WebGLGetInfo info = context->getParameter(pname, ec);
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, globalObject(), info);
+}
+
+JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec, const ArgList& args)
+{
+    return getProgramParameterHelper(this, exec, args, kProgramParameter);
+}
+
+JSValue JSWebGLRenderingContext::getRenderbufferParameter(ExecState* exec, const ArgList& args)
+{
+    return getObjectParameter(this, exec, args, kRenderbuffer);
+}
+
+JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec, const ArgList& args)
+{
+    if (args.size() != 2)
+        return throwError(exec, SyntaxError);
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+    WebGLShader* shader = toWebGLShader(args.at(0));
+    unsigned pname = args.at(1).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, globalObject(), info);
+}
+
+JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec, const ArgList& args)
+{
+    return getObjectParameter(this, exec, args, kTexture);
+}
+
+JSValue JSWebGLRenderingContext::getUniform(ExecState* exec, const ArgList& args)
+{
+    return getProgramParameterHelper(this, exec, args, kUniform);
+}
+
+JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec, const ArgList& args)
+{
+    return getObjectParameter(this, exec, args, kVertexAttrib);
+}
+
 // void texImage2DHTML(in unsigned long target, in unsigned long level, in HTMLImageElement image);
 JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec, const ArgList& args)
 { 
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index fd173ba..a8fd96c 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -365,7 +365,15 @@ namespace WebCore {
 #if ENABLE(3D_CANVAS)
         DECLARE_CALLBACK(WebGLRenderingContextBufferData);
         DECLARE_CALLBACK(WebGLRenderingContextBufferSubData);
-        DECLARE_CALLBACK(WebGLRenderingContextSizeof);
+        DECLARE_CALLBACK(WebGLRenderingContextGetBufferParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetFramebufferAttachmentParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetProgramParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetRenderbufferParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetShaderParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetTexParameter);
+        DECLARE_CALLBACK(WebGLRenderingContextGetUniform);
+        DECLARE_CALLBACK(WebGLRenderingContextGetVertexAttrib);
         DECLARE_CALLBACK(WebGLRenderingContextTexImage2D);
         DECLARE_CALLBACK(WebGLRenderingContextTexSubImage2D);
         DECLARE_CALLBACK(WebGLRenderingContextUniform1fv);
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 6b97a7a..45a8626 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -45,6 +45,8 @@
 #include "V8WebGLByteArray.h"
 #include "V8WebGLFloatArray.h"
 #include "V8WebGLIntArray.h"
+#include "V8WebGLProgram.h"
+#include "V8WebGLShader.h"
 #include "V8WebGLShortArray.h"
 #include "V8WebGLUnsignedByteArray.h"
 #include "V8WebGLUnsignedIntArray.h"
@@ -170,6 +172,263 @@ CALLBACK_FUNC_DECL(WebGLRenderingContextBufferSubData)
     return v8::Undefined();
 }
 
+static v8::Handle<v8::Value> toV8(const WebGLGetInfo& info)
+{
+    switch (info.getType()) {
+    case WebGLGetInfo::kTypeBool:
+        return v8::Boolean::New(info.getBool());
+    case WebGLGetInfo::kTypeFloat:
+        return v8::Number::New(info.getFloat());
+    case WebGLGetInfo::kTypeLong:
+        return v8::Integer::New(info.getLong());
+    case WebGLGetInfo::kTypeNull:
+        return v8::Null();
+    case WebGLGetInfo::kTypeString:
+        return v8::String::New(fromWebCoreString(info.getString()), info.getString().length());
+    case WebGLGetInfo::kTypeUnsignedLong:
+        return v8::Integer::NewFromUnsigned(info.getUnsignedLong());
+    case WebGLGetInfo::kTypeWebGLBuffer:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLBUFFER, info.getWebGLBuffer());
+    case WebGLGetInfo::kTypeWebGLFloatArray:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFLOATARRAY, info.getWebGLFloatArray());
+    case WebGLGetInfo::kTypeWebGLFramebuffer:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFRAMEBUFFER, info.getWebGLFramebuffer());
+    case WebGLGetInfo::kTypeWebGLIntArray:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLINTARRAY, info.getWebGLIntArray());
+    // FIXME: implement WebGLObjectArray
+    // case WebGLGetInfo::kTypeWebGLObjectArray:
+    case WebGLGetInfo::kTypeWebGLProgram:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLPROGRAM, info.getWebGLProgram());
+    case WebGLGetInfo::kTypeWebGLRenderbuffer:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERBUFFER, info.getWebGLRenderbuffer());
+    case WebGLGetInfo::kTypeWebGLTexture:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLTEXTURE, info.getWebGLTexture());
+    case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
+        return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY, info.getWebGLUnsignedByteArray());
+    default:
+        notImplemented();
+        return v8::Undefined();
+    }
+}
+
+enum ObjectType {
+    kBuffer, kRenderbuffer, kTexture, kVertexAttrib
+};
+
+static v8::Handle<v8::Value> getObjectParameter(const v8::Arguments& args, ObjectType objectType)
+{
+    if (args.Length() != 2) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context =
+        V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+    bool ok;
+    unsigned target = toInt32(args[0], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    unsigned pname = toInt32(args[1], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    WebGLGetInfo info;
+    switch (objectType) {
+    case kBuffer:
+        info = context->getBufferParameter(target, pname, ec);
+        break;
+    case kRenderbuffer:
+        info = context->getRenderbufferParameter(target, pname, ec);
+        break;
+    case kTexture:
+        info = context->getTexParameter(target, pname, ec);
+        break;
+    case kVertexAttrib:
+        // target => index
+        info = context->getVertexAttrib(target, pname, ec);
+        break;
+    default:
+        notImplemented();
+        break;
+    }
+    if (ec) {
+        V8Proxy::setDOMException(ec);
+        return v8::Undefined();
+    }
+    return toV8(info);
+}
+
+enum WhichProgramCall {
+    kProgramParameter, kUniform
+};
+
+static v8::Handle<v8::Value> getProgramParameter(const v8::Arguments& args, WhichProgramCall programCall)
+{
+    if (args.Length() != 2) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context =
+        V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? v8DOMWrapperTo<WebGLProgram>(V8ClassIndex::WEBGLPROGRAM, v8::Handle<v8::Object>::Cast(args[0])) : 0;
+    bool ok;
+    unsigned pname = toInt32(args[1], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    WebGLGetInfo info;
+    switch (programCall) {
+    case kProgramParameter:
+        info = context->getProgramParameter(program, pname, ec);
+        break;
+    case kUniform:
+        // pname -> location
+        info = context->getUniform(program, pname, ec);
+        break;
+    default:
+        notImplemented();
+        break;
+    }
+    if (ec) {
+        V8Proxy::setDOMException(ec);
+        return v8::Undefined();
+    }
+    return toV8(info);
+}
+
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetBufferParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()");
+    return getObjectParameter(args, kBuffer);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetFramebufferAttachmentParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getFramebufferAttachmentParameter()");
+
+    if (args.Length() != 3) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context =
+        V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+    bool ok;
+    unsigned target = toInt32(args[0], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    unsigned attachment = toInt32(args[1], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    unsigned pname = toInt32(args[2], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec);
+    if (ec) {
+        V8Proxy::setDOMException(ec);
+        return v8::Undefined();
+    }
+    return toV8(info);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getParameter()");
+
+    if (args.Length() != 1) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context =
+        V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+    bool ok;
+    unsigned pname = toInt32(args[0], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    WebGLGetInfo info = context->getParameter(pname, ec);
+    if (ec) {
+        V8Proxy::setDOMException(ec);
+        return v8::Undefined();
+    }
+    return toV8(info);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetProgramParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getProgramParameter()");
+    return getProgramParameter(args, kProgramParameter);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetRenderbufferParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getRenderbufferParameter()");
+    return getObjectParameter(args, kRenderbuffer);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetShaderParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getShaderParameter()");
+
+    if (args.Length() != 2) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+
+    ExceptionCode ec = 0;
+    WebGLRenderingContext* context =
+        V8DOMWrapper::convertDOMWrapperToNative<WebGLRenderingContext>(args.Holder());
+    WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? v8DOMWrapperTo<WebGLShader>(V8ClassIndex::WEBGLSHADER, v8::Handle<v8::Object>::Cast(args[0])) : 0;
+    bool ok;
+    unsigned pname = toInt32(args[1], ok);
+    if (!ok) {
+        V8Proxy::setDOMException(SYNTAX_ERR);
+        return notHandledByInterceptor();
+    }
+    WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
+    if (ec) {
+        V8Proxy::setDOMException(ec);
+        return v8::Undefined();
+    }
+    return toV8(info);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetTexParameter)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getTexParameter()");
+    return getObjectParameter(args, kTexture);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetUniform)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getUniform()");
+    return getProgramParameter(args, kUniform);
+}
+
+CALLBACK_FUNC_DECL(WebGLRenderingContextGetVertexAttrib)
+{
+    INC_STATS("DOM.WebGLRenderingContext.getVertexAttrib()");
+    return getObjectParameter(args, kVertexAttrib);
+}
+
 CALLBACK_FUNC_DECL(WebGLRenderingContextTexImage2D)
 {
     INC_STATS("DOM.WebGLRenderingContext.texImage2D()");
diff --git a/WebCore/html/canvas/CanvasObject.cpp b/WebCore/html/canvas/CanvasObject.cpp
index d8498a7..6c7667b 100644
--- a/WebCore/html/canvas/CanvasObject.cpp
+++ b/WebCore/html/canvas/CanvasObject.cpp
@@ -34,6 +34,7 @@ namespace WebCore {
     
 CanvasObject::CanvasObject(WebGLRenderingContext* context)
     : m_object(0)
+    , m_shouldDeleteObject(true)
     , m_context(context)
 {
 }
@@ -44,24 +45,27 @@ CanvasObject::~CanvasObject()
         m_context->removeObject(this);
 }
 
-void CanvasObject::setObject(Platform3DObject object)
+void CanvasObject::setObject(Platform3DObject object, bool shouldDeleteObject)
 {
     if (object == m_object)
         return;
         
     deleteObject();
     m_object = object;
+    m_shouldDeleteObject = shouldDeleteObject;
 }
 
 void CanvasObject::deleteObject()
 {
     if (m_object) {
-        if (m_context) {
-            m_context->graphicsContext3D()->makeContextCurrent();
-            _deleteObject(m_object);
-        }
+        if (m_shouldDeleteObject)
+            if (m_context) {
+                m_context->graphicsContext3D()->makeContextCurrent();
+                _deleteObject(m_object);
+            }
         m_object = 0;
     }
+    m_shouldDeleteObject = true;
 }
 
 }
diff --git a/WebCore/html/canvas/CanvasObject.h b/WebCore/html/canvas/CanvasObject.h
index a0cb0e0..b7b016a 100644
--- a/WebCore/html/canvas/CanvasObject.h
+++ b/WebCore/html/canvas/CanvasObject.h
@@ -40,7 +40,7 @@ namespace WebCore {
         virtual ~CanvasObject();
         
         Platform3DObject object() const { return m_object; }
-        void setObject(Platform3DObject);
+        void setObject(Platform3DObject, bool shouldDeleteObject = true);
         void deleteObject();
         
         void detachContext()
@@ -57,6 +57,13 @@ namespace WebCore {
     
     private:
         Platform3DObject m_object;
+        // The shouldDeleteObject flag indicates whether this wrapper
+        // owns the underlying resource and should delete it when the
+        // wrapper is unreferenced for the last time and deleted. It
+        // is only set to false for certain objects returned from get
+        // queries. FIXME: should consider canonicalizing all of these
+        // objects in the future.
+        bool m_shouldDeleteObject;
         WebGLRenderingContext* m_context;
     };
     
diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp
index 45a81ba..cbad6a0 100644
--- a/WebCore/html/canvas/WebGLBuffer.cpp
+++ b/WebCore/html/canvas/WebGLBuffer.cpp
@@ -37,6 +37,11 @@ PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx)
     return adoptRef(new WebGLBuffer(ctx));
 }
 
+PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj)
+{
+    return adoptRef(new WebGLBuffer(ctx, obj));
+}
+
 WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx)
     : CanvasObject(ctx)
     , m_elementArrayBufferByteLength(0)
@@ -46,6 +51,12 @@ WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx)
     setObject(context()->graphicsContext3D()->createBuffer());
 }
 
+WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx, Platform3DObject obj)
+    : CanvasObject(ctx)
+{
+    setObject(obj, false);
+}
+
 void WebGLBuffer::_deleteObject(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteBuffer(object);
diff --git a/WebCore/html/canvas/WebGLBuffer.h b/WebCore/html/canvas/WebGLBuffer.h
index ed29e85..cb953c6 100644
--- a/WebCore/html/canvas/WebGLBuffer.h
+++ b/WebCore/html/canvas/WebGLBuffer.h
@@ -40,6 +40,10 @@ namespace WebCore {
         
         static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*);
         
+        // For querying previously created objects via e.g. getFramebufferAttachmentParameter
+        // FIXME: should consider canonicalizing these objects
+        static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*, Platform3DObject);
+
         bool associateBufferData(unsigned long target, int size);
         bool associateBufferData(unsigned long target, WebGLArray* array);
         bool associateBufferSubData(unsigned long target, long offset, WebGLArray* array);
@@ -49,6 +53,7 @@ namespace WebCore {
                         
     protected:
         WebGLBuffer(WebGLRenderingContext*);
+        WebGLBuffer(WebGLRenderingContext*, Platform3DObject obj);
         
         virtual void _deleteObject(Platform3DObject o);
     
diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp
index 35fb9b3..286ad2e 100644
--- a/WebCore/html/canvas/WebGLRenderbuffer.cpp
+++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp
@@ -37,12 +37,23 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* c
     return adoptRef(new WebGLRenderbuffer(ctx));
 }
 
+PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj)
+{
+    return adoptRef(new WebGLRenderbuffer(ctx, obj));
+}
+
 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx)
     : CanvasObject(ctx)
 {
     setObject(context()->graphicsContext3D()->createRenderbuffer());
 }
 
+WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx, Platform3DObject obj)
+    : CanvasObject(ctx)
+{
+    setObject(obj, false);
+}
+
 void WebGLRenderbuffer::_deleteObject(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteRenderbuffer(object);
diff --git a/WebCore/html/canvas/WebGLRenderbuffer.h b/WebCore/html/canvas/WebGLRenderbuffer.h
index 46c2cba..790fdcd 100644
--- a/WebCore/html/canvas/WebGLRenderbuffer.h
+++ b/WebCore/html/canvas/WebGLRenderbuffer.h
@@ -39,8 +39,13 @@ namespace WebCore {
         
         static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*);
         
+        // For querying previously created objects via e.g. getFramebufferAttachmentParameter
+        // FIXME: should consider canonicalizing these objects
+        static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*, Platform3DObject renderbuffer);
+
     protected:
         WebGLRenderbuffer(WebGLRenderingContext*);
+        WebGLRenderbuffer(WebGLRenderingContext*, Platform3DObject);
         
         virtual void _deleteObject(Platform3DObject);
     };
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 3246480..6567a62 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -39,11 +39,31 @@
 #include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
 #include "ImageBuffer.h"
+#include "NotImplemented.h"
 #include "RenderBox.h"
 #include "RenderLayer.h"
 
 namespace WebCore {
 
+class WebGLStateRestorer {
+public:
+    WebGLStateRestorer(WebGLRenderingContext* context,
+                       bool changed)
+        : m_context(context)
+        , m_changed(changed)
+    {
+    }
+
+    ~WebGLStateRestorer()
+    {
+        m_context->cleanupAfterGraphicsCall(m_changed);
+    }
+
+private:
+    WebGLRenderingContext* m_context;
+    bool m_changed;
+};
+
 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas)
 {
     OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create());
@@ -58,9 +78,12 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
     , m_context(context)
     , m_needsUpdate(true)
     , m_markedCanvasDirty(false)
+    , m_activeTextureUnit(0)
 {
     ASSERT(m_context);
-    m_maxVertexAttribs = m_context->getInteger(GraphicsContext3D::MAX_VERTEX_ATTRIBS);
+    int numVertexAttribs = 0;
+    m_context->getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &numVertexAttribs);
+    m_maxVertexAttribs = numVertexAttribs;
     m_context->reshape(canvas()->width(), canvas()->height());
 }
 
@@ -124,8 +147,14 @@ int WebGLRenderingContext::sizeInBytes(int type, ExceptionCode& ec)
     return result;
 }
 
-void WebGLRenderingContext::activeTexture(unsigned long texture)
+void WebGLRenderingContext::activeTexture(unsigned long texture, ExceptionCode& ec)
 {
+    if ((texture - GraphicsContext3D::TEXTURE0) > sizeof(m_textureUnits) / sizeof(TextureUnitState)) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return;
+    }
+    m_activeTextureUnit = texture - GraphicsContext3D::TEXTURE0;
     m_context->activeTexture(texture);
     cleanupAfterGraphicsCall(false);
 }
@@ -162,6 +191,7 @@ void WebGLRenderingContext::bindBuffer(unsigned long target, WebGLBuffer* buffer
     else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER)
         m_boundElementArrayBuffer = buffer;
     else {
+        // FIXME: raise GL_INVALID_ENUM error
         ec = SYNTAX_ERR;
         return;
     }
@@ -177,6 +207,12 @@ void WebGLRenderingContext::bindFramebuffer(unsigned long target, WebGLFramebuff
         ec = TYPE_MISMATCH_ERR;
         return;
     }
+    if (target != GraphicsContext3D::FRAMEBUFFER) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return;
+    }
+    m_framebufferBinding = buffer;
     m_context->bindFramebuffer(target, buffer);
     cleanupAfterGraphicsCall(false);
 }
@@ -187,6 +223,12 @@ void WebGLRenderingContext::bindRenderbuffer(unsigned long target, WebGLRenderbu
         ec = TYPE_MISMATCH_ERR;
         return;
     }
+    if (target != GraphicsContext3D::RENDERBUFFER) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return;
+    }
+    m_renderbufferBinding = renderBuffer;
     m_context->bindRenderbuffer(target, renderBuffer);
     cleanupAfterGraphicsCall(false);
 }
@@ -198,6 +240,15 @@ void WebGLRenderingContext::bindTexture(unsigned long target, WebGLTexture* text
         ec = TYPE_MISMATCH_ERR;
         return;
     }
+    if (target == GraphicsContext3D::TEXTURE_2D)
+        m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture;
+    else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP)
+        m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture;
+    else {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return;
+    }
     m_context->bindTexture(target, texture);
     cleanupAfterGraphicsCall(false);
 }
@@ -691,32 +742,27 @@ int WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String
     return m_context->getAttribLocation(program, name);
 }
 
-bool WebGLRenderingContext::getBoolean(unsigned long pname)
+WebGLGetInfo WebGLRenderingContext::getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec)
 {
-    bool result = m_context->getBoolean(pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLUnsignedByteArray> WebGLRenderingContext::getBooleanv(unsigned long pname)
-{
-    RefPtr<WebGLUnsignedByteArray> array = m_context->getBooleanv(pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
+    if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
 
-int WebGLRenderingContext::getBufferParameteri(unsigned long target, unsigned long pname)
-{
-    int result = m_context->getBufferParameteri(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
+    if (pname != GraphicsContext3D::BUFFER_SIZE && pname != GraphicsContext3D::BUFFER_USAGE) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
 
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getBufferParameteriv(unsigned long target, unsigned long pname)
-{
-    RefPtr<WebGLIntArray> array = m_context->getBufferParameteriv(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
+    WebGLStateRestorer(this, false);
+    int value;
+    m_context->getBufferParameteriv(target, pname, &value);
+    if (pname == GraphicsContext3D::BUFFER_SIZE)
+        return WebGLGetInfo(static_cast<long>(value));
+    else
+        return WebGLGetInfo(static_cast<unsigned long>(value));
 }
 
 unsigned long WebGLRenderingContext::getError()
@@ -724,116 +770,327 @@ unsigned long WebGLRenderingContext::getError()
     return m_context->getError();
 }
 
-float WebGLRenderingContext::getFloat(unsigned long pname)
-{
-    float result = m_context->getFloat(pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLFloatArray> WebGLRenderingContext::getFloatv(unsigned long pname)
-{
-    RefPtr<WebGLFloatArray> array = m_context->getFloatv(pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
-
-int WebGLRenderingContext::getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname)
-{
-    int result = m_context->getFramebufferAttachmentParameteri(target, attachment, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname)
+WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode& ec)
 {
-    RefPtr<WebGLIntArray> array = m_context->getFramebufferAttachmentParameteriv(target, attachment, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
+    if (target != GraphicsContext3D::FRAMEBUFFER
+        || (attachment != GraphicsContext3D::COLOR_ATTACHMENT0
+            && attachment != GraphicsContext3D::DEPTH_ATTACHMENT
+            && attachment != GraphicsContext3D::STENCIL_ATTACHMENT)
+        || (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+            && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
+            && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
+            && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE)) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
 
-int WebGLRenderingContext::getInteger(unsigned long pname)
-{
-    float result = m_context->getInteger(pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
+    if (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) {
+        WebGLStateRestorer(this, false);
+        int value;
+        m_context->getFramebufferAttachmentParameteriv(target, attachment, pname, &value);
+        if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
+            return WebGLGetInfo(static_cast<unsigned long>(value));
+        else
+            return WebGLGetInfo(static_cast<long>(value));
+    } else {
+        WebGLStateRestorer(this, false);
+        int type = 0;
+        m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
+        int value = 0;
+        m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value);
+        // FIXME: should consider canonicalizing these objects
+        switch (type) {
+        case GraphicsContext3D::RENDERBUFFER: {
+            RefPtr<WebGLRenderbuffer> tmp = WebGLRenderbuffer::create(this, value);
+            addObject(tmp.get());
+            return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(tmp));
+        }
+        case GraphicsContext3D::TEXTURE: {
+            RefPtr<WebGLTexture> tmp = WebGLTexture::create(this, value);
+            addObject(tmp.get());
+            return WebGLGetInfo(PassRefPtr<WebGLTexture>(tmp));
+        }
+        default:
+            // FIXME: raise exception?
+            return WebGLGetInfo();
+        }
+    }
 }
 
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getIntegerv(unsigned long pname)
-{
-    RefPtr<WebGLIntArray> array = m_context->getIntegerv(pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
+WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionCode& ec)
+{
+    WebGLStateRestorer(this, false);
+    switch (pname) {
+    case GraphicsContext3D::ACTIVE_TEXTURE:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE:
+        return getWebGLFloatArrayParameter(pname);
+    case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE:
+        return getWebGLFloatArrayParameter(pname);
+    case GraphicsContext3D::ALPHA_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::ARRAY_BUFFER_BINDING:
+        return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer));
+    case GraphicsContext3D::BLEND:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::BLEND_COLOR:
+        return getWebGLFloatArrayParameter(pname);
+    case GraphicsContext3D::BLEND_DST_ALPHA:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLEND_DST_RGB:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLEND_EQUATION_ALPHA:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLEND_EQUATION_RGB:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLEND_SRC_ALPHA:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLEND_SRC_RGB:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::BLUE_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::COLOR_CLEAR_VALUE:
+        return getWebGLFloatArrayParameter(pname);
+    case GraphicsContext3D::COLOR_WRITEMASK:
+        return getWebGLUnsignedByteArrayParameter(pname);
+    case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
+        // Defined as null in the spec
+        return WebGLGetInfo();
+    case GraphicsContext3D::CULL_FACE:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::CULL_FACE_MODE:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::CURRENT_PROGRAM:
+        return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram));
+    case GraphicsContext3D::DEPTH_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::DEPTH_CLEAR_VALUE:
+        return getFloatParameter(pname);
+    case GraphicsContext3D::DEPTH_FUNC:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::DEPTH_RANGE:
+        return getWebGLFloatArrayParameter(pname);
+    case GraphicsContext3D::DEPTH_TEST:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::DEPTH_WRITEMASK:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::DITHER:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::ELEMENT_ARRAY_BUFFER_BINDING:
+        return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundElementArrayBuffer));
+    case GraphicsContext3D::FRAMEBUFFER_BINDING:
+        return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding));
+    case GraphicsContext3D::FRONT_FACE:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::GENERATE_MIPMAP_HINT:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::GREEN_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::LINE_WIDTH:
+        return getFloatParameter(pname);
+    case GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_RENDERBUFFER_SIZE:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_TEXTURE_SIZE:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_VARYING_VECTORS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_VERTEX_ATTRIBS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::MAX_VIEWPORT_DIMS:
+        return getWebGLIntArrayParameter(pname);
+    case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS:
+        // FIXME: should we always return 0 for this?
+        return getLongParameter(pname);
+    case GraphicsContext3D::PACK_ALIGNMENT:
+        return getLongParameter(pname);
+    case GraphicsContext3D::POLYGON_OFFSET_FACTOR:
+        return getFloatParameter(pname);
+    case GraphicsContext3D::POLYGON_OFFSET_FILL:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::POLYGON_OFFSET_UNITS:
+        return getFloatParameter(pname);
+    case GraphicsContext3D::RED_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::RENDERBUFFER_BINDING:
+        return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding));
+    case GraphicsContext3D::SAMPLE_BUFFERS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::SAMPLE_COVERAGE_INVERT:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::SAMPLE_COVERAGE_VALUE:
+        return getFloatParameter(pname);
+    case GraphicsContext3D::SAMPLES:
+        return getLongParameter(pname);
+    case GraphicsContext3D::SCISSOR_BOX:
+        return getWebGLIntArrayParameter(pname);
+    case GraphicsContext3D::SCISSOR_TEST:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_FAIL:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_FUNC:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_FAIL:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_PASS:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_REF:
+        return getLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_VALUE_MASK:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BACK_WRITEMASK:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::STENCIL_CLEAR_VALUE:
+        return getLongParameter(pname);
+    case GraphicsContext3D::STENCIL_FAIL:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_FUNC:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_PASS_DEPTH_FAIL:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_PASS_DEPTH_PASS:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_REF:
+        return getLongParameter(pname);
+    case GraphicsContext3D::STENCIL_TEST:
+        return getBooleanParameter(pname);
+    case GraphicsContext3D::STENCIL_VALUE_MASK:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::STENCIL_WRITEMASK:
+        return getUnsignedLongParameter(pname);
+    case GraphicsContext3D::SUBPIXEL_BITS:
+        return getLongParameter(pname);
+    case GraphicsContext3D::TEXTURE_BINDING_2D:
+        return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_texture2DBinding));
+    case GraphicsContext3D::TEXTURE_BINDING_CUBE_MAP:
+        return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding));
+    case GraphicsContext3D::UNPACK_ALIGNMENT:
+        // FIXME: should this be "long" in the spec?
+        return getIntParameter(pname);
+    case GraphicsContext3D::VIEWPORT:
+        return getWebGLIntArrayParameter(pname);
+    default:
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
 }
 
-int WebGLRenderingContext::getProgrami(WebGLProgram* program, unsigned long pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, unsigned long pname, ExceptionCode& ec)
 {
     if (!program || program->context() != this) {
+        // FIXME: raise GL_INVALID_VALUE error
         ec = TYPE_MISMATCH_ERR;
-        return 0;
+        return WebGLGetInfo();
     }
 
-    int result = m_context->getProgrami(program, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getProgramiv(WebGLProgram* program, unsigned long pname, ExceptionCode& ec)
-{
-    if (!program || program->context() != this) {
-        ec = TYPE_MISMATCH_ERR;
-        return 0;
+    WebGLStateRestorer(this, false);
+    int value = 0;
+    switch (pname) {
+    case GraphicsContext3D::DELETE_STATUS:
+    case GraphicsContext3D::LINK_STATUS:
+    case GraphicsContext3D::VALIDATE_STATUS:
+        m_context->getProgramiv(program, pname, &value);
+        return WebGLGetInfo(static_cast<bool>(value));
+    case GraphicsContext3D::INFO_LOG_LENGTH:
+    case GraphicsContext3D::ATTACHED_SHADERS:
+    case GraphicsContext3D::ACTIVE_ATTRIBUTES:
+    case GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH:
+    case GraphicsContext3D::ACTIVE_UNIFORMS:
+    case GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH:
+        m_context->getProgramiv(program, pname, &value);
+        return WebGLGetInfo(static_cast<long>(value));
+    default:
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
     }
-    RefPtr<WebGLIntArray> array = m_context->getProgramiv(program, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
 }
 
 String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, ExceptionCode& ec)
 {
     if (!program || program->context() != this) {
+        // FIXME: raise GL_INVALID_VALUE error
         ec = TYPE_MISMATCH_ERR;
         return "";
     }
-    String s = m_context->getProgramInfoLog(program);
-    cleanupAfterGraphicsCall(false);
-    return s;
+    WebGLStateRestorer(this, false);
+    return m_context->getProgramInfoLog(program);
 }
 
-int WebGLRenderingContext::getRenderbufferParameteri(unsigned long target, unsigned long pname)
+WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec)
 {
-    int result = m_context->getRenderbufferParameteri(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getRenderbufferParameteriv(unsigned long target, unsigned long pname)
-{
-    RefPtr<WebGLIntArray> array = m_context->getRenderbufferParameteriv(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
+    if (target != GraphicsContext3D::RENDERBUFFER) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
 
-int WebGLRenderingContext::getShaderi(WebGLShader* shader, unsigned long pname, ExceptionCode& ec)
-{
-    if (!shader || shader->context() != this) {
-        ec = TYPE_MISMATCH_ERR;
-        return 0;
+    WebGLStateRestorer(this, false);
+    int value = 0;
+    switch (pname) {
+    case GraphicsContext3D::RENDERBUFFER_WIDTH:
+    case GraphicsContext3D::RENDERBUFFER_HEIGHT:
+    case GraphicsContext3D::RENDERBUFFER_RED_SIZE:
+    case GraphicsContext3D::RENDERBUFFER_GREEN_SIZE:
+    case GraphicsContext3D::RENDERBUFFER_BLUE_SIZE:
+    case GraphicsContext3D::RENDERBUFFER_ALPHA_SIZE:
+    case GraphicsContext3D::RENDERBUFFER_DEPTH_SIZE:
+    case GraphicsContext3D::RENDERBUFFER_STENCIL_SIZE:
+        m_context->getRenderbufferParameteriv(target, pname, &value);
+        return WebGLGetInfo(static_cast<long>(value));
+    case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT:
+        m_context->getRenderbufferParameteriv(target, pname, &value);
+        return WebGLGetInfo(static_cast<unsigned long>(value));
+    default:
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
     }
-    int result = m_context->getShaderi(shader, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
 }
 
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getShaderiv(WebGLShader* shader, unsigned long pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, unsigned long pname, ExceptionCode& ec)
 {
     if (!shader || shader->context() != this) {
+        // FIXME: raise GL_INVALID_VALUE error
         ec = TYPE_MISMATCH_ERR;
-        return 0;
+        return WebGLGetInfo();
+    }
+    WebGLStateRestorer(this, false);
+    int value = 0;
+    switch (pname) {
+    case GraphicsContext3D::DELETE_STATUS:
+    case GraphicsContext3D::COMPILE_STATUS:
+        m_context->getShaderiv(shader, pname, &value);
+        return WebGLGetInfo(static_cast<bool>(value));
+    case GraphicsContext3D::SHADER_TYPE:
+        m_context->getShaderiv(shader, pname, &value);
+        return WebGLGetInfo(static_cast<unsigned long>(value));
+    case GraphicsContext3D::INFO_LOG_LENGTH:
+    case GraphicsContext3D::SHADER_SOURCE_LENGTH:
+        m_context->getShaderiv(shader, pname, &value);
+        return WebGLGetInfo(static_cast<long>(value));
+    default:
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
     }
-    RefPtr<WebGLIntArray> array = m_context->getShaderiv(shader, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
 }
 
 String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCode& ec)
@@ -842,9 +1099,8 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCod
         ec = TYPE_MISMATCH_ERR;
         return "";
     }
-    String s = m_context->getShaderInfoLog(shader);
-    cleanupAfterGraphicsCall(false);
-    return s;
+    WebGLStateRestorer(this, false);
+    return m_context->getShaderInfoLog(shader);
 }
 
 String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec)
@@ -853,86 +1109,166 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode
         ec = TYPE_MISMATCH_ERR;
         return "";
     }
-    String s = m_context->getShaderSource(shader);
-    cleanupAfterGraphicsCall(false);
-    return s;
+    WebGLStateRestorer(this, false);
+    return m_context->getShaderSource(shader);
 }
 
 String WebGLRenderingContext::getString(unsigned long name)
 {
+    WebGLStateRestorer(this, false);
     return m_context->getString(name);
 }
 
-float WebGLRenderingContext::getTexParameterf(unsigned long target, unsigned long pname)
-{
-    float result = m_context->getTexParameterf(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLFloatArray> WebGLRenderingContext::getTexParameterfv(unsigned long target, unsigned long pname)
-{
-    RefPtr<WebGLFloatArray> array = m_context->getTexParameterfv(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
-
-int WebGLRenderingContext::getTexParameteri(unsigned long target, unsigned long pname)
+WebGLGetInfo WebGLRenderingContext::getTexParameter(unsigned long target, unsigned long pname, ExceptionCode& ec)
 {
-    int result = m_context->getTexParameteri(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getTexParameteriv(unsigned long target, unsigned long pname)
-{
-    RefPtr<WebGLIntArray> array = m_context->getTexParameteriv(target, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
-
-float WebGLRenderingContext::getUniformf(WebGLProgram* program, long location, ExceptionCode& ec)
-{
-    if (!program || program->context() != this) {
-        ec = TYPE_MISMATCH_ERR;
-        return 0;
+    if (target != GraphicsContext3D::TEXTURE_2D
+        && target != GraphicsContext3D::TEXTURE_CUBE_MAP) {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
     }
-    float result = m_context->getUniformf(program, location);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLFloatArray> WebGLRenderingContext::getUniformfv(WebGLProgram* program, long location, ExceptionCode& ec)
-{
-    if (!program || program->context() != this) {
-        ec = TYPE_MISMATCH_ERR;
-        return 0;
+    WebGLStateRestorer(this, false);
+    int value = 0;
+    switch (pname) {
+    case GraphicsContext3D::TEXTURE_MAG_FILTER:
+    case GraphicsContext3D::TEXTURE_MIN_FILTER:
+    case GraphicsContext3D::TEXTURE_WRAP_S:
+    case GraphicsContext3D::TEXTURE_WRAP_T:
+        m_context->getTexParameteriv(target, pname, &value);
+        return WebGLGetInfo(static_cast<unsigned long>(value));
+    default:
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
     }
-    RefPtr<WebGLFloatArray> array = m_context->getUniformfv(program, location);
-    cleanupAfterGraphicsCall(false);
-    return array;
 }
 
-long WebGLRenderingContext::getUniformi(WebGLProgram* program, long location, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, long location, ExceptionCode& ec)
 {
     if (!program || program->context() != this) {
+        // FIXME: raise GL_INVALID_VALUE error
         ec = TYPE_MISMATCH_ERR;
-        return 0;
+        return WebGLGetInfo();
     }
-    long result = m_context->getUniformi(program, location);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getUniformiv(WebGLProgram* program, long location, ExceptionCode& ec)
-{
-    if (!program || program->context() != this) {
-        ec = TYPE_MISMATCH_ERR;
-        return 0;
+    WebGLStateRestorer(this, false);
+    // FIXME: make this more efficient using WebGLUniformLocation and caching types in it
+    int activeUniforms = 0;
+    m_context->getProgramiv(program, GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
+    for (int i = 0; i < activeUniforms; i++) {
+        ActiveInfo info;
+        if (!m_context->getActiveUniform(program, i, info)) {
+            // FIXME: raise some GL error
+            ec = INVALID_STATE_ERR;
+            return WebGLGetInfo();
+        }
+        // Now need to look this up by name again to find its location
+        long loc = m_context->getUniformLocation(program, info.name);
+        if (loc == location) {
+            // Found it. Use the type in the ActiveInfo to determine the return type.
+            GraphicsContext3D::WebGLEnumType baseType;
+            unsigned length;
+            switch (info.type) {
+                case GraphicsContext3D::BOOL:
+                    baseType = GraphicsContext3D::BOOL;
+                    length = 1;
+                    break;
+                case GraphicsContext3D::BOOL_VEC2:
+                    baseType = GraphicsContext3D::BOOL;
+                    length = 2;
+                    break;
+                case GraphicsContext3D::BOOL_VEC3:
+                    baseType = GraphicsContext3D::BOOL;
+                    length = 3;
+                    break;
+                case GraphicsContext3D::BOOL_VEC4:
+                    baseType = GraphicsContext3D::BOOL;
+                    length = 4;
+                    break;
+                case GraphicsContext3D::INT:
+                    baseType = GraphicsContext3D::INT;
+                    length = 1;
+                    break;
+                case GraphicsContext3D::INT_VEC2:
+                    baseType = GraphicsContext3D::INT;
+                    length = 2;
+                    break;
+                case GraphicsContext3D::INT_VEC3:
+                    baseType = GraphicsContext3D::INT;
+                    length = 3;
+                    break;
+                case GraphicsContext3D::INT_VEC4:
+                    baseType = GraphicsContext3D::INT;
+                    length = 4;
+                    break;
+                case GraphicsContext3D::FLOAT:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 1;
+                    break;
+                case GraphicsContext3D::FLOAT_VEC2:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 2;
+                    break;
+                case GraphicsContext3D::FLOAT_VEC3:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 3;
+                    break;
+                case GraphicsContext3D::FLOAT_VEC4:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 4;
+                    break;
+                case GraphicsContext3D::FLOAT_MAT2:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 4;
+                    break;
+                case GraphicsContext3D::FLOAT_MAT3:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 9;
+                    break;
+                case GraphicsContext3D::FLOAT_MAT4:
+                    baseType = GraphicsContext3D::FLOAT;
+                    length = 16;
+                    break;
+                default:
+                    // Can't handle this type
+                    // FIXME: what to do about samplers?
+                    return WebGLGetInfo();
+            }
+            switch (baseType) {
+            case GraphicsContext3D::FLOAT: {
+                float value[16] = {0};
+                m_context->getUniformfv(program, location, value);
+                if (length == 1)
+                    return WebGLGetInfo(value[0]);
+                else
+                    return WebGLGetInfo(WebGLFloatArray::create(value, length));
+            }
+            case GraphicsContext3D::INT: {
+                int value[16] = {0};
+                m_context->getUniformiv(program, location, value);
+                if (length == 1)
+                    return WebGLGetInfo(static_cast<long>(value[0]));
+                else
+                    return WebGLGetInfo(WebGLIntArray::create(value, length));
+            }
+            case GraphicsContext3D::BOOL: {
+                int value[16] = {0};
+                m_context->getUniformiv(program, location, value);
+                if (length == 1)
+                    return WebGLGetInfo(static_cast<bool>(value[0]));
+                else {
+                    unsigned char boolValue[16] = {0};
+                    for (unsigned j = 0; j < length; j++)
+                        boolValue[j] = static_cast<bool>(value[j]);
+                    return WebGLGetInfo(WebGLUnsignedByteArray::create(boolValue, length));
+                }
+            }
+            default:
+                notImplemented();
+            }
+        }
     }
-    RefPtr<WebGLIntArray> array = m_context->getUniformiv(program, location);
-    cleanupAfterGraphicsCall(false);
-    return array;
+    // If we get here, something went wrong in our unfortunately complex logic above
+    return WebGLGetInfo();
 }
 
 long WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name, ExceptionCode& ec)
@@ -944,32 +1280,47 @@ long WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const Stri
     return m_context->getUniformLocation(program, name);
 }
 
-float WebGLRenderingContext::getVertexAttribf(unsigned long index, unsigned long pname)
-{
-    float result = m_context->getVertexAttribf(index, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLFloatArray> WebGLRenderingContext::getVertexAttribfv(unsigned long index, unsigned long pname)
-{
-    RefPtr<WebGLFloatArray> array = m_context->getVertexAttribfv(index, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
-}
-
-long WebGLRenderingContext::getVertexAttribi(unsigned long index, unsigned long pname)
-{
-    long result = m_context->getVertexAttribi(index, pname);
-    cleanupAfterGraphicsCall(false);
-    return result;
-}
-
-PassRefPtr<WebGLIntArray> WebGLRenderingContext::getVertexAttribiv(unsigned long index, unsigned long pname)
+WebGLGetInfo WebGLRenderingContext::getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode& ec)
 {
-    RefPtr<WebGLIntArray> array = m_context->getVertexAttribiv(index, pname);
-    cleanupAfterGraphicsCall(false);
-    return array;
+    WebGLStateRestorer(this, false);
+    switch (pname) {
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: {
+        int name = 0;
+        m_context->getVertexAttribiv(index, pname, &name);
+        if (name == 0)
+            return WebGLGetInfo();
+        RefPtr<WebGLBuffer> tmp = WebGLBuffer::create(this, name);
+        addObject(tmp.get());
+        return WebGLGetInfo(PassRefPtr<WebGLBuffer>(tmp));
+    }
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_ENABLED:
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_NORMALIZED: {
+        int value = 0;
+        m_context->getVertexAttribiv(index, pname, &value);
+        return WebGLGetInfo(static_cast<bool>(value));
+    }
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_SIZE:
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_STRIDE: {
+        int value = 0;
+        m_context->getVertexAttribiv(index, pname, &value);
+        return WebGLGetInfo(static_cast<long>(value));
+    }
+    case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE: {
+        int value = 0;
+        m_context->getVertexAttribiv(index, pname, &value);
+        return WebGLGetInfo(static_cast<unsigned long>(value));
+    }
+    case GraphicsContext3D::CURRENT_VERTEX_ATTRIB: {
+        float value[4] = {0};
+        m_context->getVertexAttribfv(index, pname, value);
+        return WebGLGetInfo(WebGLFloatArray::create(value, 4));
+    }
+    default: {
+        // FIXME: raise GL_INVALID_ENUM error
+        ec = SYNTAX_ERR;
+        return WebGLGetInfo();
+    }
+    }
 }
 
 long WebGLRenderingContext::getVertexAttribOffset(unsigned long index, unsigned long pname)
@@ -1584,6 +1935,7 @@ void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
         return;
     }
         
+    m_currentProgram = program;
     m_context->useProgram(program);
     cleanupAfterGraphicsCall(false);
 }
@@ -1752,7 +2104,94 @@ void WebGLRenderingContext::detachAndRemoveAllObjects()
     m_canvasObjects.clear();
 }
 
+WebGLGetInfo WebGLRenderingContext::getBooleanParameter(unsigned long pname)
+{
+    unsigned char value;
+    m_context->getBooleanv(pname, &value);
+    return WebGLGetInfo(static_cast<bool>(value));
+}
+
+WebGLGetInfo WebGLRenderingContext::getFloatParameter(unsigned long pname)
+{
+    float value;
+    m_context->getFloatv(pname, &value);
+    return WebGLGetInfo(static_cast<float>(value));
+}
+
+WebGLGetInfo WebGLRenderingContext::getIntParameter(unsigned long pname)
+{
+    return getLongParameter(pname);
+}
+
+WebGLGetInfo WebGLRenderingContext::getLongParameter(unsigned long pname)
+{
+    int value;
+    m_context->getIntegerv(pname, &value);
+    return WebGLGetInfo(static_cast<long>(value));
+}
+
+WebGLGetInfo WebGLRenderingContext::getUnsignedLongParameter(unsigned long pname)
+{
+    int value;
+    m_context->getIntegerv(pname, &value);
+    return WebGLGetInfo(static_cast<unsigned long>(value));
+}
+
+WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(unsigned long pname)
+{
+    float value[4] = {0};
+    m_context->getFloatv(pname, value);
+    unsigned length = 0;
+    switch (pname) {
+    case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE:
+    case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE:
+    case GraphicsContext3D::DEPTH_RANGE:
+        length = 2;
+        break;
+    case GraphicsContext3D::BLEND_COLOR:
+    case GraphicsContext3D::COLOR_CLEAR_VALUE:
+        length = 4;
+        break;
+    default:
+        notImplemented();
+    }
+    return WebGLGetInfo(WebGLFloatArray::create(value, length));
+}
+
+WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(unsigned long pname)
+{
+    int value[4] = {0};
+    m_context->getIntegerv(pname, value);
+    unsigned length = 0;
+    switch (pname) {
+    case GraphicsContext3D::MAX_VIEWPORT_DIMS:
+        length = 2;
+        break;
+    case GraphicsContext3D::SCISSOR_BOX:
+    case GraphicsContext3D::VIEWPORT:
+        length = 4;
+        break;
+    default:
+        notImplemented();
+    }
+    return WebGLGetInfo(WebGLIntArray::create(value, length));
+}
+
+WebGLGetInfo WebGLRenderingContext::getWebGLUnsignedByteArrayParameter(unsigned long pname)
+{
+    unsigned char value[4] = {0};
+    m_context->getBooleanv(pname, value);
+    unsigned length = 0;
+    switch (pname) {
+    case GraphicsContext3D::COLOR_WRITEMASK:
+        length = 4;
+        break;
+    default:
+        notImplemented();
+    }
+    return WebGLGetInfo(WebGLUnsignedByteArray::create(value, length));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(3D_CANVAS)
-
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index cc37342..5fee4cd 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -29,6 +29,7 @@
 #include "CanvasRenderingContext.h"
 #include "ExceptionCode.h"
 #include "WebGLFloatArray.h"
+#include "WebGLGetInfo.h"
 #include "WebGLIntArray.h"
 #include "WebGLUnsignedByteArray.h"
 #include "GraphicsContext3D.h"
@@ -60,7 +61,7 @@ class WebKitCSSMatrix;
         // like GL_FLOAT, GL_INT, etc.
         int sizeInBytes(int type, ExceptionCode& ec);
 
-        void activeTexture(unsigned long texture);
+        void activeTexture(unsigned long texture, ExceptionCode& ec);
         void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec);
         void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name, ExceptionCode& ec);
         void bindBuffer(unsigned long target, WebGLBuffer*, ExceptionCode& ec);
@@ -130,26 +131,21 @@ class WebKitCSSMatrix;
 
         int  getAttribLocation(WebGLProgram*, const String& name);
 
-        bool getBoolean(unsigned long pname);
-        PassRefPtr<WebGLUnsignedByteArray> getBooleanv(unsigned long pname);
-        int getBufferParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getBufferParameteriv(unsigned long target, unsigned long pname);
+        WebGLGetInfo getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode&);
 
         unsigned long getError();
 
-        float getFloat(unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getFloatv(unsigned long pname);
-        int getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname);
-        int getInteger(unsigned long pname);
-        PassRefPtr<WebGLIntArray> getIntegerv(unsigned long pname);
-        int getProgrami(WebGLProgram*, unsigned long pname, ExceptionCode& ec);
-        PassRefPtr<WebGLIntArray> getProgramiv(WebGLProgram*, unsigned long pname, ExceptionCode& ec);
+        WebGLGetInfo getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode&);
+
+        WebGLGetInfo getParameter(unsigned long pname, ExceptionCode&);
+
+        WebGLGetInfo getProgramParameter(WebGLProgram*, unsigned long pname, ExceptionCode&);
+
         String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec);
-        int getRenderbufferParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getRenderbufferParameteriv(unsigned long target, unsigned long pname);
-        int getShaderi(WebGLShader*, unsigned long pname, ExceptionCode& ec);
-        PassRefPtr<WebGLIntArray> getShaderiv(WebGLShader*, unsigned long pname, ExceptionCode& ec);
+
+        WebGLGetInfo getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode&);
+
+        WebGLGetInfo getShaderParameter(WebGLShader*, unsigned long pname, ExceptionCode& ec);
 
         String getShaderInfoLog(WebGLShader*, ExceptionCode& ec);
 
@@ -159,22 +155,13 @@ class WebKitCSSMatrix;
         String getShaderSource(WebGLShader*, ExceptionCode&);
         String getString(unsigned long name);
 
-        float getTexParameterf(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getTexParameterfv(unsigned long target, unsigned long pname);
-        int getTexParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getTexParameteriv(unsigned long target, unsigned long pname);
+        WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&);
 
-        float getUniformf(WebGLProgram* program, long location, ExceptionCode&);
-        PassRefPtr<WebGLFloatArray> getUniformfv(WebGLProgram* program, long location, ExceptionCode&);
-        long getUniformi(WebGLProgram* program, long location, ExceptionCode& ec);
-        PassRefPtr<WebGLIntArray> getUniformiv(WebGLProgram* program, long location, ExceptionCode&);
+        WebGLGetInfo getUniform(WebGLProgram* program, long location, ExceptionCode& ec);
 
         long getUniformLocation(WebGLProgram*, const String& name, ExceptionCode&);
 
-        float getVertexAttribf(unsigned long index, unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getVertexAttribfv(unsigned long index, unsigned long pname);
-        long getVertexAttribi(unsigned long index, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getVertexAttribiv(unsigned long index, unsigned long pname);
+        WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode&);
 
         long getVertexAttribOffset(unsigned long index, unsigned long pname);
 
@@ -338,6 +325,29 @@ class WebKitCSSMatrix;
         
         Vector<VertexAttribState> m_vertexAttribState;
         unsigned m_maxVertexAttribs;
+
+        RefPtr<WebGLProgram> m_currentProgram;
+        RefPtr<WebGLFramebuffer> m_framebufferBinding;
+        RefPtr<WebGLRenderbuffer> m_renderbufferBinding;
+        class TextureUnitState {
+        public:
+            RefPtr<WebGLTexture> m_texture2DBinding;
+            RefPtr<WebGLTexture> m_textureCubeMapBinding;
+        };
+        TextureUnitState m_textureUnits[32];
+        unsigned long m_activeTextureUnit;
+
+        // Helpers for getParameter and others
+        WebGLGetInfo getBooleanParameter(unsigned long pname);
+        WebGLGetInfo getFloatParameter(unsigned long pname);
+        WebGLGetInfo getIntParameter(unsigned long pname);
+        WebGLGetInfo getLongParameter(unsigned long pname);
+        WebGLGetInfo getUnsignedLongParameter(unsigned long pname);
+        WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname);
+        WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname);
+        WebGLGetInfo getWebGLUnsignedByteArrayParameter(unsigned long pname);
+
+        friend class WebGLStateRestorer;
     };
 
 } // namespace WebCore
diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl
index e5dc4f5..8169367 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.idl
+++ b/WebCore/html/canvas/WebGLRenderingContext.idl
@@ -460,7 +460,7 @@ module html {
 
         long sizeInBytes(in unsigned long type) raises(DOMException);
 
-        void         activeTexture(in unsigned long texture);
+        void         activeTexture(in unsigned long texture) raises(DOMException);
         void         attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException);
         void         bindAttribLocation(in WebGLProgram program, in unsigned long index, in DOMString name) raises(DOMException);
         void         bindBuffer(in unsigned long target, in WebGLBuffer buffer) raises(DOMException);
@@ -530,7 +530,6 @@ module html {
         void         frontFace(in unsigned long mode);
         void         generateMipmap(in unsigned long target);
         
-        // FIXME: these need to be added per the WebGL spec
         WebGLActiveInfo getActiveAttrib(in WebGLProgram program, in unsigned long index)
             raises (DOMException);
         WebGLActiveInfo getActiveUniform(in WebGLProgram program, in unsigned long index)
@@ -540,26 +539,22 @@ module html {
 
         int          getAttribLocation(in WebGLProgram program, in DOMString name);
 
-        boolean getBoolean(in unsigned long pname);
-        WebGLUnsignedByteArray getBooleanv(in unsigned long pname);
-        long getBufferParameteri(in unsigned long target, in unsigned long pname);
-        WebGLIntArray getBufferParameteriv(in unsigned long target, in unsigned long pname);
+        // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
+        [Custom] void getBufferParameter();
 
         unsigned long getError();
 
-        float getFloat(in unsigned long pname);
-        WebGLFloatArray getFloatv(in unsigned long pname);
-        long getFramebufferAttachmentParameteri(in unsigned long target, in unsigned long attachment, in unsigned long pname);
-        WebGLIntArray getFramebufferAttachmentParameteriv(in unsigned long target, in unsigned long attachment, in unsigned long pname);
-        long getInteger(in unsigned long pname);
-        WebGLIntArray getIntegerv(in unsigned long pname);
-        long getProgrami(in WebGLProgram program, in unsigned long pname) raises(DOMException);
-        WebGLIntArray getProgramiv(in WebGLProgram program, in unsigned long pname) raises(DOMException);
+        // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException);
+        [Custom] void getFramebufferAttachmentParameter();
+        // any getParameter(in unsigned long pname) raises(DOMException);
+        [Custom] void getParameter();
+        // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException);
+        [Custom] void getProgramParameter();
         DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException);
-        long getRenderbufferParameteri(in unsigned long target, in unsigned long pname);
-        WebGLIntArray getRenderbufferParameteriv(in unsigned long target, in unsigned long pname);
-        long getShaderi(in WebGLShader shader, in unsigned long pname) raises(DOMException);
-        WebGLIntArray getShaderiv(in WebGLShader shader, in unsigned long pname) raises(DOMException);
+        // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
+        [Custom] void getRenderbufferParameter();
+        // any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException);
+        [Custom] void getShaderParameter() raises(DOMException);
 
         DOMString    getShaderInfoLog(in WebGLShader shader) raises(DOMException);
 
@@ -569,22 +564,16 @@ module html {
         DOMString    getShaderSource(in WebGLShader shader) raises(DOMException);
         DOMString    getString(in unsigned long name);
 
-        float getTexParameterf(in unsigned long target, in unsigned long pname);
-        WebGLFloatArray getTexParameterfv(in unsigned long target, in unsigned long pname);
-        long getTexParameteri(in unsigned long target, in unsigned long pname);
-        WebGLIntArray getTexParameteriv(in unsigned long target, in unsigned long pname);
+        // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
+        [Custom] void getTexParameter();
 
-        float getUniformf(in WebGLProgram program, in long location) raises(DOMException);
-        WebGLFloatArray getUniformfv(in WebGLProgram program, in long location) raises(DOMException);
-        long getUniformi(in WebGLProgram program, in long location) raises(DOMException);
-        WebGLIntArray getUniformiv(in WebGLProgram program, in long location) raises(DOMException);
+        // any getUniform(in WebGLProgram program, in long location) raises(DOMException);
+        [Custom] void getUniform();
         
         long getUniformLocation(in WebGLProgram program, in DOMString name) raises(DOMException);
 
-        float getVertexAttribf(in unsigned long index, in unsigned long pname);
-        WebGLFloatArray getVertexAttribfv(in unsigned long index, in unsigned long pname);
-        long getVertexAttribi(in unsigned long index, in unsigned long pname);
-        WebGLIntArray getVertexAttribiv(in unsigned long index, in unsigned long pname);
+        // any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException);
+        [Custom] void getVertexAttrib();
 
         long getVertexAttribOffset(in unsigned long index, in unsigned long pname);
 
diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp
index 0c58edb..ae09b48 100644
--- a/WebCore/html/canvas/WebGLTexture.cpp
+++ b/WebCore/html/canvas/WebGLTexture.cpp
@@ -37,6 +37,11 @@ PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx)
     return adoptRef(new WebGLTexture(ctx));
 }
 
+PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx, Platform3DObject obj)
+{
+    return adoptRef(new WebGLTexture(ctx, obj));
+}
+
 WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx)
     : CanvasObject(ctx)
     , cubeMapRWrapModeInitialized(false)
@@ -44,6 +49,13 @@ WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx)
     setObject(context()->graphicsContext3D()->createTexture());
 }
 
+WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx, Platform3DObject obj)
+    : CanvasObject(ctx)
+    , cubeMapRWrapModeInitialized(false)
+{
+    setObject(obj, false);
+}
+
 void WebGLTexture::_deleteObject(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteTexture(object);
diff --git a/WebCore/html/canvas/WebGLTexture.h b/WebCore/html/canvas/WebGLTexture.h
index 32ed02f..c64dd41 100644
--- a/WebCore/html/canvas/WebGLTexture.h
+++ b/WebCore/html/canvas/WebGLTexture.h
@@ -39,6 +39,10 @@ namespace WebCore {
         
         static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*);
     
+        // For querying previously created objects via e.g. getFramebufferAttachmentParameter
+        // FIXME: should consider canonicalizing these objects
+        static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*, Platform3DObject);
+
         bool isCubeMapRWrapModeInitialized() {
             return cubeMapRWrapModeInitialized;
         }
@@ -49,6 +53,7 @@ namespace WebCore {
 
     protected:
         WebGLTexture(WebGLRenderingContext*);
+        WebGLTexture(WebGLRenderingContext*, Platform3DObject);
 
         virtual void _deleteObject(Platform3DObject);
 
diff --git a/WebCore/manual-tests/webgl/resources/utils3d.js b/WebCore/manual-tests/webgl/resources/utils3d.js
index 03b6e95..58f520f 100644
--- a/WebCore/manual-tests/webgl/resources/utils3d.js
+++ b/WebCore/manual-tests/webgl/resources/utils3d.js
@@ -43,7 +43,7 @@ function initWebGL(canvasName, vshader, fshader, attribs, clearColor, clearDepth
     gl.linkProgram(gl.program);
 
     // Check the link status
-    var linked = gl.getProgrami(gl.program, gl.LINK_STATUS);
+    var linked = gl.getProgramParameter(gl.program, gl.LINK_STATUS);
     if (!linked) {
         // something went wrong with the link
         var error = gl.getProgramInfoLog (gl.program);
@@ -105,7 +105,7 @@ function loadShader(ctx, shaderId)
     ctx.compileShader(shader);
 
     // Check the compile status
-    var compiled = ctx.getShaderi(shader, ctx.COMPILE_STATUS);
+    var compiled = ctx.getShaderParameter(shader, ctx.COMPILE_STATUS);
     if (!compiled) {
         // Something went wrong during compilation; get the error
         var error = ctx.getShaderInfoLog(shader);
@@ -528,4 +528,3 @@ Framerate.prototype.snapshot = function()
         this.renderTime = newTime;
     }
 }
-
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index b9a6db9..155b4ed 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -458,26 +458,25 @@ namespace WebCore {
 
         int  getAttribLocation(WebGLProgram*, const String& name);
 
-        bool getBoolean(unsigned long pname);
-        PassRefPtr<WebGLUnsignedByteArray> getBooleanv(unsigned long pname);
-        int getBufferParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getBufferParameteriv(unsigned long target, unsigned long pname);
+        void getBooleanv(unsigned long pname, unsigned char* value);
+
+        void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
 
         unsigned long getError();
 
-        float getFloat(unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getFloatv(unsigned long pname);
-        int getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname);
-        int getInteger(unsigned long pname);
-        PassRefPtr<WebGLIntArray> getIntegerv(unsigned long pname);
-        int getProgrami(WebGLProgram*, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getProgramiv(WebGLProgram*, unsigned long pname);
+        void getFloatv(unsigned long pname, float* value);
+
+        void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
+
+        void getIntegerv(unsigned long pname, int* value);
+
+        void getProgramiv(WebGLProgram* program, unsigned long pname, int* value);
+
         String getProgramInfoLog(WebGLProgram*);
-        int getRenderbufferParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getRenderbufferParameteriv(unsigned long target, unsigned long pname);
-        int getShaderi(WebGLShader*, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getShaderiv(WebGLShader*, unsigned long pname);
+
+        void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+        void getShaderiv(WebGLShader*, unsigned long pname, int* value);
 
         String getShaderInfoLog(WebGLShader*);
 
@@ -486,24 +485,18 @@ namespace WebCore {
 
         String getShaderSource(WebGLShader*);
         String getString(unsigned long name);
-        
-        float getTexParameterf(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getTexParameterfv(unsigned long target, unsigned long pname);
-        int getTexParameteri(unsigned long target, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getTexParameteriv(unsigned long target, unsigned long pname);
 
-        float getUniformf(WebGLProgram* program, long location);
-        PassRefPtr<WebGLFloatArray> getUniformfv(WebGLProgram* program, long location);
-        int getUniformi(WebGLProgram* program, long location);
-        PassRefPtr<WebGLIntArray> getUniformiv(WebGLProgram* program, long location);
+        void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
+        void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
+
+        void getUniformfv(WebGLProgram* program, long location, float* value);
+        void getUniformiv(WebGLProgram* program, long location, int* value);
 
         long getUniformLocation(WebGLProgram*, const String& name);
 
-        float getVertexAttribf(unsigned long index, unsigned long pname);
-        PassRefPtr<WebGLFloatArray> getVertexAttribfv(unsigned long index, unsigned long pname);
-        int getVertexAttribi(unsigned long index, unsigned long pname);
-        PassRefPtr<WebGLIntArray> getVertexAttribiv(unsigned long index, unsigned long pname);
-        
+        void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
+        void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
+
         long getVertexAttribOffset(unsigned long index, unsigned long pname);
 
         void hint(unsigned long target, unsigned long mode);
@@ -643,4 +636,3 @@ namespace WebCore {
 } // namespace WebCore
 
 #endif // GraphicsContext3D_h
-
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 2187f4c..c873a8b 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -277,7 +277,7 @@ void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer*
 void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
 {
     ensureContext(m_contextObj);
-    ::glBindBuffer(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
+    ::glBindRenderbufferEXT(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
 }
 
 
@@ -952,321 +952,40 @@ void GraphicsContext3D::viewport(long x, long y, unsigned long width, unsigned l
     ::glViewport(static_cast<GLint>(x), static_cast<GLint>(y), static_cast<GLsizei>(width), static_cast<GLsizei>(height));
 }
 
-static int sizeForGetParam(unsigned long pname)
-{
-    switch(pname) {
-        case GL_ACTIVE_TEXTURE:                  return 1;
-        case GL_ALIASED_LINE_WIDTH_RANGE:        return 2;
-        case GL_ALIASED_POINT_SIZE_RANGE:        return 2;
-        case GL_ALPHA_BITS:                      return 1;
-        case GL_ARRAY_BUFFER_BINDING:            return 1; // (* actually a WebGLBuffer*)
-        case GL_BLEND:                           return 1;
-        case GL_BLEND_COLOR:                     return 4;
-        case GL_BLEND_DST_ALPHA:                 return 1;
-        case GL_BLEND_DST_RGB:                   return 1;
-        case GL_BLEND_EQUATION_ALPHA:            return 1;
-        case GL_BLEND_EQUATION_RGB:              return 1;
-        case GL_BLEND_SRC_ALPHA:                 return 1;
-        case GL_BLEND_SRC_RGB:                   return 1;
-        case GL_BLUE_BITS:                       return 1;
-        case GL_COLOR_CLEAR_VALUE:               return 4;
-        case GL_COLOR_WRITEMASK:                 return 4;
-        case GL_COMPRESSED_TEXTURE_FORMATS:      return GL_NUM_COMPRESSED_TEXTURE_FORMATS;
-        case GL_CULL_FACE:                       return 1;
-        case GL_CULL_FACE_MODE:                  return 1;
-        case GL_CURRENT_PROGRAM:                 return 1; // (* actually a WebGLProgram*)
-        case GL_DEPTH_BITS:                      return 1;
-        case GL_DEPTH_CLEAR_VALUE:               return 1;
-        case GL_DEPTH_FUNC:                      return 1;
-        case GL_DEPTH_RANGE:                     return 2;
-        case GL_DEPTH_TEST:                      return 1;
-        case GL_DEPTH_WRITEMASK:                 return 1;
-        case GL_DITHER:                          return 1;
-        case GL_ELEMENT_ARRAY_BUFFER_BINDING:    return 1; // (* actually a WebGLBuffer*)
-        case GL_FRAMEBUFFER_BINDING_EXT:         return 1; // (* actually a WebGLFramebuffer*)
-        case GL_FRONT_FACE:                      return 1;
-        case GL_GENERATE_MIPMAP_HINT:            return 1;
-        case GL_GREEN_BITS:                      return 1;
-            //case GL_IMPLEMENTATION_COLOR_READ_FORMAT:return 1;
-            //case GL_IMPLEMENTATION_COLOR_READ_TYPE:  return 1;
-        case GL_LINE_WIDTH:                      return 1;
-        case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:return 1;
-        case GL_MAX_CUBE_MAP_TEXTURE_SIZE:       return 1;
-            //case GL_MAX_FRAGMENT_UNIFORM_VECTORS:    return 1;
-        case GL_MAX_RENDERBUFFER_SIZE_EXT:       return 1;
-        case GL_MAX_TEXTURE_IMAGE_UNITS:         return 1;
-        case GL_MAX_TEXTURE_SIZE:                return 1;
-            //case GL_MAX_VARYING_VECTORS:             return 1;
-        case GL_MAX_VERTEX_ATTRIBS:              return 1;
-        case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:  return 1;
-            //case GL_MAX_VERTEX_UNIFORM_VECTORS:      return 1;
-        case GL_MAX_VIEWPORT_DIMS:               return 2;
-        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:  return 1;
-            //case GL_NUM_SHADER_BINARY_FORMATS:       return 1;
-        case GL_PACK_ALIGNMENT:                  return 1;
-        case GL_POLYGON_OFFSET_FACTOR:           return 1;
-        case GL_POLYGON_OFFSET_FILL:             return 1;
-        case GL_POLYGON_OFFSET_UNITS:            return 1;
-        case GL_RED_BITS:                        return 1;
-        case GL_RENDERBUFFER_BINDING_EXT:        return 1; // (* actually a WebGLRenderbuffer*)
-        case GL_SAMPLE_BUFFERS:                  return 1;
-        case GL_SAMPLE_COVERAGE_INVERT:          return 1;
-        case GL_SAMPLE_COVERAGE_VALUE:           return 1;
-        case GL_SAMPLES:                         return 1;
-        case GL_SCISSOR_BOX:                     return 4;
-        case GL_SCISSOR_TEST:                    return 1;
-            //case GL_SHADER_BINARY_FORMATS:           return GL_NUM_SHADER_BINARY_FORMATS;
-            //case GL_SHADER_COMPILER:                 return 1;
-        case GL_STENCIL_BACK_FAIL:               return 1;
-        case GL_STENCIL_BACK_FUNC:               return 1;
-        case GL_STENCIL_BACK_PASS_DEPTH_FAIL:    return 1;
-        case GL_STENCIL_BACK_PASS_DEPTH_PASS:    return 1;
-        case GL_STENCIL_BACK_REF:                return 1;
-        case GL_STENCIL_BACK_VALUE_MASK:         return 1;
-        case GL_STENCIL_BACK_WRITEMASK:          return 1;
-        case GL_STENCIL_BITS:                    return 1;
-        case GL_STENCIL_CLEAR_VALUE:             return 1;
-        case GL_STENCIL_FAIL:                    return 1;
-        case GL_STENCIL_FUNC:                    return 1;
-        case GL_STENCIL_PASS_DEPTH_FAIL:         return 1;
-        case GL_STENCIL_PASS_DEPTH_PASS:         return 1;
-        case GL_STENCIL_REF:                     return 1;
-        case GL_STENCIL_TEST:                    return 1;
-        case GL_STENCIL_VALUE_MASK:              return 1;
-        case GL_STENCIL_WRITEMASK:               return 1;
-        case GL_SUBPIXEL_BITS:                   return 1;
-        case GL_TEXTURE_BINDING_2D:              return 1; // (* actually a WebGLTexture*)
-        case GL_TEXTURE_BINDING_CUBE_MAP:        return 1; // (* actually a WebGLTexture*)
-        case GL_UNPACK_ALIGNMENT:                return 1;
-        case GL_VIEWPORT:                        return 4;
-    }
-    
-    return -1;
-}
-
-bool GraphicsContext3D::getBoolean(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    bool isAlloced = false;
-    GLboolean buf[4];
-    GLboolean* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLboolean*) malloc(size * sizeof(GLboolean));
-        isAlloced = true;
-    }
-            
-    ::glGetBooleanv(pname, pbuf);
-    
-    bool value = pbuf[0];
-
-    if (isAlloced)
-        free(pbuf);
-    
-    return value;
-}
-
-PassRefPtr<WebGLUnsignedByteArray> GraphicsContext3D::getBooleanv(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    RefPtr<WebGLUnsignedByteArray> array = WebGLUnsignedByteArray::create(size);
-    bool isAlloced = false;
-    GLboolean buf[4];
-    GLboolean* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLboolean*) malloc(size * sizeof(GLboolean));
-        isAlloced = true;
-    }
-            
-    ::glGetBooleanv(pname, pbuf);
-            
-    for (int i = 0; i < size; ++i)
-        array->set(i, static_cast<unsigned char>(pbuf[i]));
-            
-    if (isAlloced)
-        free(pbuf);
-    
-    return array;
-}
-
-float GraphicsContext3D::getFloat(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    bool isAlloced = false;
-    GLfloat buf[4];
-    GLfloat* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLfloat*) malloc(size * sizeof(GLfloat));
-        isAlloced = true;
-    }
-            
-    ::glGetFloatv(pname, pbuf);
-    
-    float value = pbuf[0];
-
-    if (isAlloced)
-        free(pbuf);
-    
-    return value;
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getFloatv(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    RefPtr<WebGLFloatArray> array = WebGLFloatArray::create(size);
-    bool isAlloced = false;
-    GLfloat buf[4];
-    GLfloat* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLfloat*) malloc(size * sizeof(GLfloat));
-        isAlloced = true;
-    }
-            
-    ::glGetFloatv(pname, pbuf);
-            
-    for (int i = 0; i < size; ++i)
-        array->set(i, static_cast<float>(pbuf[i]));
-            
-    if (isAlloced)
-        free(pbuf);
-    
-    return array;
-}
-
-int GraphicsContext3D::getInteger(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    bool isAlloced = false;
-    GLint buf[4];
-    GLint* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLint*) malloc(size * sizeof(GLint));
-        isAlloced = true;
-    }
-            
-    ::glGetIntegerv(pname, pbuf);
-    
-    int value = pbuf[0];
-
-    if (isAlloced)
-        free(pbuf);
-    
-    return value;
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getIntegerv(unsigned long pname)
-{
-    int size = sizeForGetParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(size);
-    bool isAlloced = false;
-    GLint buf[4];
-    GLint* pbuf = buf;
-            
-    if (size > 4) {
-        pbuf = (GLint*) malloc(size * sizeof(GLint));
-        isAlloced = true;
-    }
-            
-    ::glGetIntegerv(pname, pbuf);
-            
-    for (int i = 0; i < size; ++i)
-        array->set(i, static_cast<int>(pbuf[i]));
-            
-    if (isAlloced)
-        free(pbuf);
-    
-    return array;
-}
-
-int GraphicsContext3D::getBufferParameteri(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getBooleanv(unsigned long pname, unsigned char* value)
 {
     ensureContext(m_contextObj);
-    GLint data;
-    ::glGetBufferParameteriv(target, pname, &data);
-    return data;
+    ::glGetBooleanv(pname, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetBufferParameteriv(target, pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
+    ::glGetBufferParameteriv(target, pname, value);
 }
 
-int GraphicsContext3D::getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname)
+void GraphicsContext3D::getFloatv(unsigned long pname, float* value)
 {
     ensureContext(m_contextObj);
-    GLint data;
-    ::glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, &data);
-    return data;
+    ::glGetFloatv(pname, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname)
+void GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
+    ::glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value);
 }
 
-int GraphicsContext3D::getProgrami(WebGLProgram* program, unsigned long pname)
+void GraphicsContext3D::getIntegerv(unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    GLint data;
-    ::glGetProgramiv((GLuint) program->object(), pname, &data);
-    return data;
+    ::glGetIntegerv(pname, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long pname)
+void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetProgramiv((GLuint) program->object(), pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
+    ::glGetProgramiv((GLuint) program->object(), pname, value);
 }
 
 String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
@@ -1285,46 +1004,18 @@ String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
     return s;
 }
 
-int GraphicsContext3D::getRenderbufferParameteri(unsigned long target, unsigned long pname)
-{
-    ensureContext(m_contextObj);
-    GLint data;
-    ::glGetBufferParameteriv(target, pname, &data);
-    return data;
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigned long pname)
-{
-    ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetBufferParameteriv(target, pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
-}
-
-int GraphicsContext3D::getShaderi(WebGLShader* shader, unsigned long pname)
+void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value)
 {
-    ASSERT(shader);
-    
     ensureContext(m_contextObj);
-    GLint data;
-    ::glGetShaderiv((GLuint) shader->object(), pname, &data);
-    return data;
+    ::glGetRenderbufferParameterivEXT(target, pname, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long pname)
+void GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long pname, int* value)
 {
     ASSERT(shader);
     
     ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetShaderiv((GLuint) shader->object(), pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
+    ::glGetShaderiv((GLuint) shader->object(), pname, value);
 }
 
 String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
@@ -1360,78 +1051,28 @@ String GraphicsContext3D::getShaderSource(WebGLShader* shader)
 }
 
 
-float GraphicsContext3D::getTexParameterf(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getTexParameterfv(unsigned long target, unsigned long pname, float* value)
 {
     ensureContext(m_contextObj);
-    GLfloat data;
-    ::glGetTexParameterfv(target, pname, &data);
-    return data;
+    ::glGetTexParameterfv(target, pname, value);
 }
 
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getTexParameterfv(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    RefPtr<WebGLFloatArray> array = WebGLFloatArray::create(1);
-    GLfloat data;
-    ::glGetTexParameterfv(target, pname, &data);
-    array->set(0, static_cast<float>(data));
-    
-    return array;
+    ::glGetTexParameteriv(target, pname, value);
 }
 
-int GraphicsContext3D::getTexParameteri(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
 {
     ensureContext(m_contextObj);
-    GLint data;
-    ::glGetTexParameteriv(target, pname, &data);
-    return data;
+    ::glGetUniformfv((GLuint) program->object(), location, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
 {
     ensureContext(m_contextObj);
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(1);
-    GLint data;
-    ::glGetTexParameteriv(target, pname, &data);
-    array->set(0, static_cast<int>(data));
-    
-    return array;
-}
-
-float GraphicsContext3D::getUniformf(WebGLProgram* program, long location)
-{
-    // FIXME: We need to query glGetUniformLocation to determine the size needed
-    UNUSED_PARAM(program);
-    UNUSED_PARAM(location);
-    notImplemented();
-    return 0;
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getUniformfv(WebGLProgram* program, long location)
-{
-    // FIXME: We need to query glGetUniformLocation to determine the size needed
-    UNUSED_PARAM(program);
-    UNUSED_PARAM(location);
-    notImplemented();
-    return 0;
-}
-
-int GraphicsContext3D::getUniformi(WebGLProgram* program, long location)
-{
-    // FIXME: We need to query glGetUniformLocation to determine the size needed
-    UNUSED_PARAM(program);
-    UNUSED_PARAM(location);
-    notImplemented();
-    return 0;
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getUniformiv(WebGLProgram* program, long location)
-{
-    // FIXME: We need to query glGetUniformLocation to determine the size needed
-    UNUSED_PARAM(program);
-    UNUSED_PARAM(location);
-    notImplemented();
-    return 0;
+    ::glGetUniformiv((GLuint) program->object(), location, value);
 }
 
 long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
@@ -1442,71 +1083,16 @@ long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String&
     return ::glGetUniformLocation((GLuint) program->object(), name.utf8().data());
 }
 
-static int sizeForGetVertexAttribParam(unsigned long pname)
-{
-    switch(pname) {
-        case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:     return 1; // (* actually a WebGLBuffer*)
-        case GL_VERTEX_ATTRIB_ARRAY_ENABLED:            return 1;
-        case GL_VERTEX_ATTRIB_ARRAY_SIZE:               return 1;
-        case GL_VERTEX_ATTRIB_ARRAY_STRIDE:             return 1;
-        case GL_VERTEX_ATTRIB_ARRAY_TYPE:               return 1;
-        case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:         return 1;
-        case GL_CURRENT_VERTEX_ATTRIB:                  return 4;
-    }
-    
-    return -1;
-}
-
-float GraphicsContext3D::getVertexAttribf(unsigned long index, unsigned long pname)
-{
-    ensureContext(m_contextObj);
-    GLfloat buf[4];
-    ::glGetVertexAttribfv(index, pname, buf);
-    return buf[0];
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long pname)
+void GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long pname, float* value)
 {
-    int size = sizeForGetVertexAttribParam(pname);
-    if (size < 1) 
-        return 0;
-    
     ensureContext(m_contextObj);
-    
-    RefPtr<WebGLFloatArray> array = WebGLFloatArray::create(size);
-    GLfloat buf[4];
-    ::glGetVertexAttribfv(index, pname, buf);
-            
-    for (int i = 0; i < size; ++i)
-        array->set(i, static_cast<float>(buf[i]));
-    
-    return array;
+    ::glGetVertexAttribfv(index, pname, value);
 }
 
-int GraphicsContext3D::getVertexAttribi(unsigned long index, unsigned long pname)
+void GraphicsContext3D::getVertexAttribiv(unsigned long index, unsigned long pname, int* value)
 {
     ensureContext(m_contextObj);
-    GLint buf[4];
-    ::glGetVertexAttribiv(index, pname, buf);
-    return buf[0];
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getVertexAttribiv(unsigned long index, unsigned long pname)
-{
-    int size = sizeForGetVertexAttribParam(pname);
-    if (size < 1) 
-        return 0;
-    
-    ensureContext(m_contextObj);
-    
-    RefPtr<WebGLIntArray> array = WebGLIntArray::create(size);
-    GLint buf[4];
-    ::glGetVertexAttribiv(index, pname, buf);
-            
-    for (int i = 0; i < size; ++i)
-        array->set(i, static_cast<int>(buf[i]));
-    
-    return array;
+    ::glGetVertexAttribiv(index, pname, value);
 }
 
 long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 2f98eb5..c9e02d4 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,47 @@
+2009-11-23  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Change get... calls to latest spec
+        https://bugs.webkit.org/show_bug.cgi?id=30091
+
+        Removed old versions of get calls on WebGLRenderingContext and
+        added new ones per spec returning "any". New code simplifies
+        GraphicsContext3D and fixes previously unimplemented routines.
+        Added custom JS and V8 bindings. Added exhaustive test case
+        exercising all new code paths. Updated preexisting test cases for
+        new APIs. Fixed preexisting bugs in WebKit's and Chrome's WebGL
+        implementations.
+
+        Ran WebGL layout tests in WebKit (clean) and Chrome (couple of
+        preexisting known failures) and manual WebGL tests in both
+        browsers.
+
+        Test: fast/canvas/webgl/gl-object-get-calls.html
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::createFramebuffer):
+        (WebCore::GraphicsContext3D::createRenderbuffer):
+        (WebCore::GraphicsContext3D::deleteFramebuffer):
+        (WebCore::GraphicsContext3D::deleteRenderbuffer):
+        (WebCore::GraphicsContext3D::checkFramebufferStatus):
+        (WebCore::GraphicsContext3D::getBooleanv):
+        (WebCore::GraphicsContext3D::getBufferParameteriv):
+        (WebCore::GraphicsContext3D::getFloatv):
+        (WebCore::GraphicsContext3D::getFramebufferAttachmentParameteriv):
+        (WebCore::GraphicsContext3D::getIntegerv):
+        (WebCore::GraphicsContext3D::getProgramiv):
+        (WebCore::GraphicsContext3D::getRenderbufferParameteriv):
+        (WebCore::GraphicsContext3D::getShaderiv):
+        (WebCore::GraphicsContext3D::getTexParameterfv):
+        (WebCore::GraphicsContext3D::getTexParameteriv):
+        (WebCore::GraphicsContext3D::getUniformfv):
+        (WebCore::GraphicsContext3D::getUniformiv):
+        (WebCore::GraphicsContext3D::getVertexAttribfv):
+        (WebCore::GraphicsContext3D::getVertexAttribiv):
+        (WebCore::GraphicsContext3D::isFramebuffer):
+        (WebCore::GraphicsContext3D::isRenderbuffer):
+
 2009-11-24  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index 250b39c..f8687f3 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -774,19 +774,6 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
 #endif  // RENDER_TO_DEBUGGING_WINDOW
 }
 
-bool GraphicsContext3DInternal::validateTextureTarget(int target)
-{
-    return (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
-}
-
-bool GraphicsContext3DInternal::validateTextureParameter(int param)
-{
-    return (param == GL_TEXTURE_MAG_FILTER
-         || param == GL_TEXTURE_MIN_FILTER
-         || param == GL_TEXTURE_WRAP_S
-         || param == GL_TEXTURE_WRAP_T);
-}
-
 void GraphicsContext3DInternal::activeTexture(unsigned long texture)
 {
     // FIXME: query number of textures available.
@@ -1105,8 +1092,8 @@ unsigned GraphicsContext3D::createBuffer()
 unsigned GraphicsContext3D::createFramebuffer()
 {
     makeContextCurrent();
-    GLuint o;
-    glGenFramebuffers(1, &o);
+    GLuint o = 0;
+    glGenFramebuffersEXT(1, &o);
     return o;
 }
 
@@ -1120,7 +1107,7 @@ unsigned GraphicsContext3D::createRenderbuffer()
 {
     makeContextCurrent();
     GLuint o;
-    glGenRenderbuffers(1, &o);
+    glGenRenderbuffersEXT(1, &o);
     return o;
 }
 
@@ -1147,7 +1134,7 @@ void GraphicsContext3D::deleteBuffer(unsigned buffer)
 void GraphicsContext3D::deleteFramebuffer(unsigned framebuffer)
 {
     makeContextCurrent();
-    glDeleteFramebuffers(1, &framebuffer);
+    glDeleteFramebuffersEXT(1, &framebuffer);
 }
 
 void GraphicsContext3D::deleteProgram(unsigned program)
@@ -1159,7 +1146,7 @@ void GraphicsContext3D::deleteProgram(unsigned program)
 void GraphicsContext3D::deleteRenderbuffer(unsigned renderbuffer)
 {
     makeContextCurrent();
-    glDeleteRenderbuffers(1, &renderbuffer);
+    glDeleteRenderbuffersEXT(1, &renderbuffer);
 }
 
 void GraphicsContext3D::deleteShader(unsigned shader)
@@ -1197,9 +1184,9 @@ void GraphicsContext3D::bindBuffer(unsigned long target,
     m_internal->bindBuffer(target, buffer);
 }
 
-GL_SAME_METHOD_2_X2(BindFramebuffer, bindFramebuffer, unsigned long, WebGLFramebuffer*)
+GL_SAME_METHOD_2_X2(BindFramebufferEXT, bindFramebuffer, unsigned long, WebGLFramebuffer*)
 
-GL_SAME_METHOD_2_X2(BindRenderbuffer, bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
+GL_SAME_METHOD_2_X2(BindRenderbufferEXT, bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
 
 // If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps,
 // we could just use:
@@ -1253,7 +1240,7 @@ void GraphicsContext3D::bufferSubData(unsigned long target, long offset, WebGLAr
 unsigned long GraphicsContext3D::checkFramebufferStatus(unsigned long target)
 {
     makeContextCurrent();
-    return glCheckFramebufferStatus(target);
+    return glCheckFramebufferStatusEXT(target);
 }
 
 GL_SAME_METHOD_1(Clear, clear, unsigned long)
@@ -1356,9 +1343,9 @@ GL_SAME_METHOD_0(Finish, finish)
 
 GL_SAME_METHOD_0(Flush, flush)
 
-GL_SAME_METHOD_4_X4(FramebufferRenderbuffer, framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)
+GL_SAME_METHOD_4_X4(FramebufferRenderbufferEXT, framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)
 
-GL_SAME_METHOD_5_X4(FramebufferTexture2D, framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)
+GL_SAME_METHOD_5_X4(FramebufferTexture2DEXT, framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)
 
 GL_SAME_METHOD_1(FrontFace, frontFace, unsigned long)
 
@@ -1435,35 +1422,16 @@ int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& na
     return glGetAttribLocation(EXTRACT(program), name.utf8().data());
 }
 
-bool GraphicsContext3D::getBoolean(unsigned long pname)
+void GraphicsContext3D::getBooleanv(unsigned long pname, unsigned char* value)
 {
     makeContextCurrent();
-    GLboolean val;
-    // FIXME: validate pname to ensure it returns only a single value.
-    glGetBooleanv(pname, &val);
-    return static_cast<bool>(val);
+    glGetBooleanv(pname, value);
 }
 
-PassRefPtr<WebGLUnsignedByteArray> GraphicsContext3D::getBooleanv(unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-int GraphicsContext3D::getBufferParameteri(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long pname, int* value)
 {
     makeContextCurrent();
-    GLint data;
-    glGetBufferParameteriv(target, pname, &data);
-    return static_cast<int>(data);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetBufferParameteriv(target, pname, value);
 }
 
 unsigned long GraphicsContext3D::getError()
@@ -1472,72 +1440,33 @@ unsigned long GraphicsContext3D::getError()
     return glGetError();
 }
 
-float GraphicsContext3D::getFloat(unsigned long pname)
+void GraphicsContext3D::getFloatv(unsigned long pname, float* value)
 {
     makeContextCurrent();
-    GLfloat val;
-    // FIXME: validate pname to ensure it returns only a single value.
-    glGetFloatv(pname, &val);
-    return static_cast<float>(val);
+    glGetFloatv(pname, value);
 }
 
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getFloatv(unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-int GraphicsContext3D::getFramebufferAttachmentParameteri(unsigned long target,
-                                                          unsigned long attachment,
-                                                          unsigned long pname)
+void GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target,
+                                                            unsigned long attachment,
+                                                            unsigned long pname,
+                                                            int* value)
 {
     makeContextCurrent();
-    GLint data;
-    glGetFramebufferAttachmentParameteriv(target, attachment, pname, &data);
-    return static_cast<int>(data);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getFramebufferAttachmentParameteriv(unsigned long target,
-                                                                                  unsigned long attachment,
-                                                                                  unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value);
 }
 
-int GraphicsContext3D::getInteger(unsigned long pname)
+void GraphicsContext3D::getIntegerv(unsigned long pname, int* value)
 {
     makeContextCurrent();
-    GLint val;
-    // FIXME: validate pname to ensure it returns only a single value.
-    glGetIntegerv(pname, &val);
-    return static_cast<int>(val);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getIntegerv(unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetIntegerv(pname, value);
 }
 
-int GraphicsContext3D::getProgrami(WebGLProgram* program,
-                                   unsigned long pname)
+void GraphicsContext3D::getProgramiv(WebGLProgram* program,
+                                     unsigned long pname,
+                                     int* value)
 {
     makeContextCurrent();
-    GLint param;
-    glGetProgramiv(EXTRACT(program), pname, &param);
-    return static_cast<int>(param);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getProgramiv(WebGLProgram* program,
-                                                           unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetProgramiv(EXTRACT(program), pname, value);
 }
 
 String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
@@ -1559,38 +1488,20 @@ String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
     return res;
 }
 
-int GraphicsContext3D::getRenderbufferParameteri(unsigned long target,
-                                                 unsigned long pname)
+void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target,
+                                                   unsigned long pname,
+                                                   int* value)
 {
     makeContextCurrent();
-    GLint param;
-    glGetRenderbufferParameteriv(target, pname, &param);
-    return static_cast<int>(param);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getRenderbufferParameteriv(unsigned long target,
-                                                                         unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetRenderbufferParameterivEXT(target, pname, value);
 }
 
-int GraphicsContext3D::getShaderi(WebGLShader* shader,
-                                  unsigned long pname)
+void GraphicsContext3D::getShaderiv(WebGLShader* shader,
+                                    unsigned long pname,
+                                    int* value)
 {
     makeContextCurrent();
-    GLint param;
-    glGetShaderiv(EXTRACT(shader), pname, &param);
-    return static_cast<int>(param);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getShaderiv(WebGLShader* shader,
-                                                          unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetShaderiv(EXTRACT(shader), pname, value);
 }
 
 String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
@@ -1637,82 +1548,28 @@ String GraphicsContext3D::getString(unsigned long name)
     return String(reinterpret_cast<const char*>(glGetString(name)));
 }
 
-float GraphicsContext3D::getTexParameterf(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getTexParameterfv(unsigned long target, unsigned long pname, float* value)
 {
     makeContextCurrent();
-    if (!m_internal->validateTextureTarget(target)) {
-        // FIXME: throw exception.
-        return 0;
-    }
-
-    if (!m_internal->validateTextureParameter(pname)) {
-        // FIXME: throw exception.
-        return 0;
-    }
-
-    GLfloat param;
-    glGetTexParameterfv(target, pname, &param);
-    return static_cast<float>(param);
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getTexParameterfv(unsigned long target, unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetTexParameterfv(target, pname, value);
 }
 
-int GraphicsContext3D::getTexParameteri(unsigned long target, unsigned long pname)
+void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pname, int* value)
 {
     makeContextCurrent();
-    if (!m_internal->validateTextureTarget(target)) {
-        // FIXME: throw exception.
-        return 0;
-    }
-
-    if (!m_internal->validateTextureParameter(pname)) {
-        // FIXME: throw exception.
-        return 0;
-    }
-
-    GLint param;
-    glGetTexParameteriv(target, pname, &param);
-    return static_cast<int>(param);
-}
-
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    glGetTexParameteriv(target, pname, value);
 }
 
-float GraphicsContext3D::getUniformf(WebGLProgram* program, long location)
+void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
 {
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getUniformfv(WebGLProgram* program, long location)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-int GraphicsContext3D::getUniformi(WebGLProgram* program, long location)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    makeContextCurrent();
+    glGetUniformfv(EXTRACT(program), location, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getUniformiv(WebGLProgram* program, long location)
+void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
 {
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    makeContextCurrent();
+    glGetUniformiv(EXTRACT(program), location, value);
 }
 
 long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
@@ -1724,36 +1581,20 @@ long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String&
     return glGetUniformLocation(EXTRACT(program), name.utf8().data());
 }
 
-float GraphicsContext3D::getVertexAttribf(unsigned long index,
-                                          unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-PassRefPtr<WebGLFloatArray> GraphicsContext3D::getVertexAttribfv(unsigned long index,
-                                                                  unsigned long pname)
+void GraphicsContext3D::getVertexAttribfv(unsigned long index,
+                                          unsigned long pname,
+                                          float* value)
 {
-    // FIXME: implement.
-    notImplemented();
-    return 0;
-}
-
-int GraphicsContext3D::getVertexAttribi(unsigned long index,
-                                        unsigned long pname)
-{
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    makeContextCurrent();
+    glGetVertexAttribfv(index, pname, value);
 }
 
-PassRefPtr<WebGLIntArray> GraphicsContext3D::getVertexAttribiv(unsigned long index,
-                                                                unsigned long pname)
+void GraphicsContext3D::getVertexAttribiv(unsigned long index,
+                                          unsigned long pname,
+                                          int* value)
 {
-    // FIXME: implement.
-    notImplemented();
-    return 0;
+    makeContextCurrent();
+    glGetVertexAttribiv(index, pname, value);
 }
 
 long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname)
@@ -1780,7 +1621,7 @@ bool GraphicsContext3D::isEnabled(unsigned long cap)
 bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer)
 {
     makeContextCurrent();
-    return glIsFramebuffer(EXTRACT(framebuffer));
+    return glIsFramebufferEXT(EXTRACT(framebuffer));
 }
 
 bool GraphicsContext3D::isProgram(WebGLProgram* program)
@@ -1792,7 +1633,7 @@ bool GraphicsContext3D::isProgram(WebGLProgram* program)
 bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
 {
     makeContextCurrent();
-    return glIsRenderbuffer(EXTRACT(renderbuffer));
+    return glIsRenderbufferEXT(EXTRACT(renderbuffer));
 }
 
 bool GraphicsContext3D::isShader(WebGLShader* shader)
@@ -1841,7 +1682,7 @@ void GraphicsContext3D::releaseShaderCompiler()
 {
 }
 
-GL_SAME_METHOD_4(RenderbufferStorage, renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long)
+GL_SAME_METHOD_4(RenderbufferStorageEXT, renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long)
 
 GL_SAME_METHOD_2(SampleCoverage, sampleCoverage, double, bool)
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list