Disallow passing null data to uniform1uiv() and friends.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2017 14:55:00 +0000 (14:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Sep 2017 14:55:00 +0000 (14:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176777

Patch by Ms2ger <Ms2ger@igalia.com> on 2017-09-12
Reviewed by Sam Weinig.

This matches the specification as well as Gecko and Chromium.

Source/WebCore:

Test: fast/canvas/webgl/webgl2/bindings.html

* html/canvas/WebGL2RenderingContext.idl:

LayoutTests:

* fast/canvas/webgl/webgl2/bindings-expected.txt: Added.
* fast/canvas/webgl/webgl2/bindings.html: Added.
* platform/gtk/TestExpectations: disable test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/webgl2/bindings-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/webgl2/bindings.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGL2RenderingContext.idl

index fa3a87c..8d257c1 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-12  Ms2ger  <Ms2ger@igalia.com>
+
+        Disallow passing null data to uniform1uiv() and friends.
+        https://bugs.webkit.org/show_bug.cgi?id=176777
+
+        Reviewed by Sam Weinig.
+
+        This matches the specification as well as Gecko and Chromium.
+
+        * fast/canvas/webgl/webgl2/bindings-expected.txt: Added.
+        * fast/canvas/webgl/webgl2/bindings.html: Added.
+        * platform/gtk/TestExpectations: disable test.
+
 2017-09-12  Zan Dobersek  <zdobersek@igalia.com>
 
         [EME] Implement CDMInstanceClearKey::requestLicense()
diff --git a/LayoutTests/fast/canvas/webgl/webgl2/bindings-expected.txt b/LayoutTests/fast/canvas/webgl/webgl2/bindings-expected.txt
new file mode 100644 (file)
index 0000000..14a9478
--- /dev/null
@@ -0,0 +1,12 @@
+
+PASS uniform1uiv with null data 
+PASS uniform2uiv with null data 
+PASS uniform3uiv with null data 
+PASS uniform4uiv with null data 
+PASS uniformMatrix2x3fv with null data 
+PASS uniformMatrix3x2fv with null data 
+PASS uniformMatrix2x4fv with null data 
+PASS uniformMatrix4x2fv with null data 
+PASS uniformMatrix3x4fv with null data 
+PASS uniformMatrix4x3fv with null data 
+
diff --git a/LayoutTests/fast/canvas/webgl/webgl2/bindings.html b/LayoutTests/fast/canvas/webgl/webgl2/bindings.html
new file mode 100644 (file)
index 0000000..f4231aa
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>WebGL2RenderingContext: IDL bindings</title>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+let context, error_methods = [];
+setup(function() {
+  window.internals.settings.setWebGL2Enabled(true);
+
+  context = document.createElement("canvas").getContext("webgl2");
+  if (!context) {
+    throw new Error("Could not create webgl2 context");
+  }
+
+  for (let i = 1; i <= 4; ++i) {
+    error_methods.push([`uniform${i}uiv`, [null, null], `uniform${i}uiv with null data`]);
+  }
+  for (let dim of ["2x3", "3x2", "2x4", "4x2", "3x4", "4x3"]) {
+    error_methods.push([`uniformMatrix${dim}fv`, [null, false, null], `uniformMatrix${dim}fv with null data`]);
+  }
+});
+
+for (var [method, args, name] of error_methods) {
+  test(function() {
+    assert_throws(new TypeError(), () => context[method](...args));
+  }, name);
+}
+</script>
index 7517c1b..db23f74 100644 (file)
@@ -581,6 +581,7 @@ webkit.org/b/169917 webgl/1.0.3/conformance/extensions/webgl-draw-buffers.html [
 # WebGL 2.0 still not enabled
 webkit.org/b/166536 webgl/webgl2-rendering-context-defined.html [ Skip ]
 webkit.org/b/166536 webgl/webgl2-rendering-context-obtain.html [ Skip ]
+webkit.org/b/166536 fast/canvas/webgl/webgl2/ [ Skip ]
 webkit.org/b/166536 fast/canvas/webgl/webgl2-buffer-targets.html [ Skip ]
 webkit.org/b/166536 fast/canvas/webgl/webgl2-buffers.html [ Skip ]
 webkit.org/b/166536 fast/canvas/webgl/webgl2-context-creation.html [ Skip ]
index 7ebd5f6..29c125f 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-12  Ms2ger  <Ms2ger@igalia.com>
+
+        Disallow passing null data to uniform1uiv() and friends.
+        https://bugs.webkit.org/show_bug.cgi?id=176777
+
+        Reviewed by Sam Weinig.
+
+        This matches the specification as well as Gecko and Chromium.
+
+        Test: fast/canvas/webgl/webgl2/bindings.html
+
+        * html/canvas/WebGL2RenderingContext.idl:
+
 2017-09-12  Sam Weinig  <sam@webkit.org>
 
         [Cleanup] Follow up cleanup for DOMFormData implementation
index 8e8fd89..f631d1a 100644 (file)
@@ -377,16 +377,16 @@ typedef (ImageData or HTMLImageElement or HTMLCanvasElement or HTMLVideoElement)
     void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
     void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
     void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-    void uniform1uiv(WebGLUniformLocation? location, Uint32Array? value);
-    void uniform2uiv(WebGLUniformLocation? location, Uint32Array? value);
-    void uniform3uiv(WebGLUniformLocation? location, Uint32Array? value);
-    void uniform4uiv(WebGLUniformLocation? location, Uint32Array? value);
-    void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
-    void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
-    void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
-    void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
-    void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
-    void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array? value);
+    void uniform1uiv(WebGLUniformLocation? location, Uint32Array value);
+    void uniform2uiv(WebGLUniformLocation? location, Uint32Array value);
+    void uniform3uiv(WebGLUniformLocation? location, Uint32Array value);
+    void uniform4uiv(WebGLUniformLocation? location, Uint32Array value);
+    void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
+    void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
+    void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
+    void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
+    void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
+    void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
     void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
     void vertexAttribI4iv(GLuint index, Int32Array? v);
     void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);