Diff
Modified: trunk/LayoutTests/ChangeLog (106872 => 106873)
--- trunk/LayoutTests/ChangeLog 2012-02-07 00:34:18 UTC (rev 106872)
+++ trunk/LayoutTests/ChangeLog 2012-02-07 00:38:43 UTC (rev 106873)
@@ -1,3 +1,15 @@
+2012-02-06 Ehsan Akhgari <[email protected]>
+
+ WebGL conformance test misc/functions-returning-strings.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=77149
+
+ Imported the WebGL conformance test related to this.
+
+ Reviewed by Kenneth Russell.
+
+ * fast/canvas/webgl/functions-returning-strings-expected.txt: Added.
+ * fast/canvas/webgl/functions-returning-strings.html: Added.
+
2012-02-06 Chris Rogers <[email protected]>
zvmul incorrectly multiplies complex arrays on Windows.
Added: trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings-expected.txt (0 => 106873)
--- trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings-expected.txt 2012-02-07 00:38:43 UTC (rev 106873)
@@ -0,0 +1,25 @@
+Test that functions returning strings really do return strings (and not e.g. null)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS gl.getShaderSource(vs) returns a string
+PASS gl.getShaderInfoLog(vs) returns a string
+PASS gl.getShaderSource(vs) returns a string
+PASS gl.getShaderInfoLog(vs) returns a string
+PASS gl.getShaderSource(fs) returns a string
+PASS gl.getShaderInfoLog(fs) returns a string
+PASS gl.getShaderSource(fs) returns a string
+PASS gl.getShaderInfoLog(fs) returns a string
+PASS gl.getProgramInfoLog(prog) returns a string
+PASS gl.getProgramInfoLog(prog) returns a string
+PASS getSupportedExtensions() returns an array of strings
+PASS gl.getParameter(gl.VENDOR) returns a string
+PASS gl.getParameter(gl.RENDERER) returns a string
+PASS gl.getParameter(gl.VERSION) returns a string
+PASS gl.getParameter(gl.SHADING_LANGUAGE_VERSION) returns a string
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings.html (0 => 106873)
--- trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/functions-returning-strings.html 2012-02-07 00:38:43 UTC (rev 106873)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Tests</title>
+<link rel="stylesheet" href=""
+<script src="" type="text/_javascript_"></script>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" width="2" height="2"> </canvas>
+<script>
+description("Test that functions returning strings really do return strings (and not e.g. null)");
+debug("");
+
+var validVertexShaderString =
+ "attribute vec4 aVertex; attribute vec4 aColor; varying vec4 vColor; void main() { vColor = aColor; gl_Position = aVertex; }";
+var validFragmentShaderString =
+ "precision mediump float; varying vec4 vColor; void main() { gl_FragColor = vColor; }";
+
+function shouldReturnString(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + ' should return a string. Threw exception ' + exception);
+ else if (typeof _av == "string")
+ testPassed(_a + ' returns a string');
+ else
+ testFailed(_a + ' should return a string. Returns: "' + _av + '"');
+}
+
+var gl = create3DContext(document.getElementById("canvas"));
+if (!gl) {
+ testFailed("context does not exist");
+} else {
+ var vs = gl.createShader(gl.VERTEX_SHADER);
+ shouldReturnString("gl.getShaderSource(vs)");
+ shouldReturnString("gl.getShaderInfoLog(vs)");
+ gl.shaderSource(vs, validVertexShaderString);
+ gl.compileShader(vs);
+ shouldReturnString("gl.getShaderSource(vs)");
+ shouldReturnString("gl.getShaderInfoLog(vs)");
+
+ var fs = gl.createShader(gl.FRAGMENT_SHADER);
+ shouldReturnString("gl.getShaderSource(fs)");
+ shouldReturnString("gl.getShaderInfoLog(fs)");
+ gl.shaderSource(fs, validFragmentShaderString);
+ gl.compileShader(fs);
+ shouldReturnString("gl.getShaderSource(fs)");
+ shouldReturnString("gl.getShaderInfoLog(fs)");
+
+ var prog = gl.createProgram();
+ shouldReturnString("gl.getProgramInfoLog(prog)");
+ gl.attachShader(prog, vs);
+ gl.attachShader(prog, fs);
+ gl.linkProgram(prog);
+ shouldReturnString("gl.getProgramInfoLog(prog)");
+
+ // Make sure different numbers of extensions doesn't result in
+ // different test output.
+ var exts = gl.getSupportedExtensions();
+ var allPassed = true;
+ for (i in exts) {
+ if (typeof i != "string") {
+ shouldReturnString("gl.getSupportedExtensions()[" + i + "]");
+ allPassed = false;
+ }
+ }
+ if (allPassed) {
+ testPassed('getSupportedExtensions() returns an array of strings');
+ }
+
+ shouldReturnString("gl.getParameter(gl.VENDOR)");
+ shouldReturnString("gl.getParameter(gl.RENDERER)");
+ shouldReturnString("gl.getParameter(gl.VERSION)");
+ shouldReturnString("gl.getParameter(gl.SHADING_LANGUAGE_VERSION)");
+}
+
+debug("");
+successfullyParsed = true;
+
+</script>
+<script src=""
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (106872 => 106873)
--- trunk/Source/WebCore/ChangeLog 2012-02-07 00:34:18 UTC (rev 106872)
+++ trunk/Source/WebCore/ChangeLog 2012-02-07 00:38:43 UTC (rev 106873)
@@ -1,3 +1,24 @@
+2012-02-06 Ehsan Akhgari <[email protected]>
+
+ WebGL conformance test misc/functions-returning-strings.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=77149
+
+ Make sure that WebGL methods returning strings don't return null when
+ they run successfully.
+
+ Reviewed by Kenneth Russell.
+
+ Test: fast/canvas/webgl/functions-returning-strings.html
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ (WebCore::WebGLRenderingContext::getProgramInfoLog):
+ (WebCore::WebGLRenderingContext::getShaderInfoLog):
+ (WebCore::WebGLRenderingContext::getShaderSource):
+ (WebCore::WebGLRenderingContext::ensureNotNull):
+ * html/canvas/WebGLRenderingContext.h:
+ (WebGLRenderingContext):
+
2012-02-06 Enrica Casucci <[email protected]>
Refactor Mac platform implementation of the Pasteboard class.
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (106872 => 106873)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-02-07 00:34:18 UTC (rev 106872)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-02-07 00:38:43 UTC (rev 106873)
@@ -2513,7 +2513,7 @@
if (!validateWebGLObject("getProgramInfoLog", program))
return "";
WebGLStateRestorer(this, false);
- return m_context->getProgramInfoLog(objectOrZero(program));
+ return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program)));
}
WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
@@ -2613,7 +2613,7 @@
if (!validateWebGLObject("getShaderInfoLog", shader))
return "";
WebGLStateRestorer(this, false);
- return m_context->getShaderInfoLog(objectOrZero(shader));
+ return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader)));
}
String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec)
@@ -2623,7 +2623,7 @@
return String();
if (!validateWebGLObject("getShaderSource", shader))
return "";
- return shader->getSource();
+ return ensureNotNull(shader->getSource());
}
Vector<String> WebGLRenderingContext::getSupportedExtensions()
@@ -5123,6 +5123,13 @@
canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, ""));
}
+String WebGLRenderingContext::ensureNotNull(const String& text) const
+{
+ if (text.isNull())
+ return WTF::emptyString();
+ return text;
+}
+
WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity)
: m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity]))
, m_capacity(capacity)
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (106872 => 106873)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2012-02-07 00:34:18 UTC (rev 106872)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2012-02-07 00:38:43 UTC (rev 106873)
@@ -662,6 +662,8 @@
// to the _javascript_ console.
void synthesizeGLError(GC3Denum, const char* functionName, const char* description);
+ String ensureNotNull(const String&) const;
+
friend class WebGLStateRestorer;
};