Move WebGLErrorsToConsole page setting to window.internals.settings
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 19:20:08 +0000 (19:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 19:20:08 +0000 (19:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107218

Source/WebCore:

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2013-01-25
Reviewed by Kenneth Russell.

Define webGLErrorsToConsoleEnabled as true by default. Also,
WebGLRenderingContext::m_synthesizedErrorsToConsole is true by default
and can be disabled by settings.

Add a ConsoleDisplayPreference parameter to synthesizeGLError
(defaults to DisplayInConsole). When called with DontDisplayInConsole,
an error message will not be displayed (even if
m_synthesizedErrorsToConsole is true).

Call synthesizeGLError with DontDisplayInConsole in case of synthetic
context lost.

No new tests: covered by existing tests.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::WebGLRenderingContext):
(WebCore::WebGLRenderingContext::setupFlags):
(WebCore::WebGLRenderingContext::validateRenderingState):
(WebCore::WebGLRenderingContext::loseContextImpl):
(WebCore::WebGLRenderingContext::synthesizeGLError):
* html/canvas/WebGLRenderingContext.h:
* page/Settings.in:

LayoutTests:

Set WebGLErrorsToConsoleEnabled to false for WebGL tests which have
errors. Some WebGL error messages depend on OpenGL implementations, so
logging error messages would lead to platform specific output.

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2013-01-25
Reviewed by Kenneth Russell.

* fast/canvas/webgl/attrib-location-length-limits.html:
* fast/canvas/webgl/bad-arguments-test.html:
* fast/canvas/webgl/buffer-bind-test.html:
* fast/canvas/webgl/buffer-data-array-buffer.html:
* fast/canvas/webgl/compressed-tex-image.html:
* fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html:
* fast/canvas/webgl/context-lost-restored.html:
* fast/canvas/webgl/context-lost.html:
* fast/canvas/webgl/draw-arrays-out-of-bounds.html:
* fast/canvas/webgl/draw-elements-out-of-bounds.html:
* fast/canvas/webgl/error-reporting.html:
* fast/canvas/webgl/framebuffer-object-attachment.html:
* fast/canvas/webgl/framebuffer-test.html:
* fast/canvas/webgl/get-active-test.html:
* fast/canvas/webgl/gl-bind-attrib-location-test.html:
* fast/canvas/webgl/gl-enable-enum-test.html:
* fast/canvas/webgl/gl-enum-tests.html:
* fast/canvas/webgl/gl-object-get-calls.html:
* fast/canvas/webgl/gl-uniform-arrays.html:
* fast/canvas/webgl/gl-uniformmatrix4fv.html:
* fast/canvas/webgl/gl-vertexattribpointer.html:
* fast/canvas/webgl/glsl-conformance.html:
* fast/canvas/webgl/incorrect-context-object-behaviour.html:
* fast/canvas/webgl/index-validation-copies-indices.html:
* fast/canvas/webgl/index-validation-verifies-too-many-indices.html:
* fast/canvas/webgl/index-validation.html:
* fast/canvas/webgl/invalid-passed-params.html:
* fast/canvas/webgl/null-object-behaviour.html:
* fast/canvas/webgl/object-deletion-behaviour.html:
* fast/canvas/webgl/program-test.html:
* fast/canvas/webgl/read-pixels-pack-alignment.html:
* fast/canvas/webgl/read-pixels-test.html:
* fast/canvas/webgl/script-tests/texImageTest.js:
* fast/canvas/webgl/shader-deleted-by-accessor.html:
* fast/canvas/webgl/shader-precision-format.html:
* fast/canvas/webgl/tex-input-validation.html:
* fast/canvas/webgl/tex-sub-image-2d-bad-args.html:
* fast/canvas/webgl/texture-complete.html:
* fast/canvas/webgl/texture-npot.html:
* fast/canvas/webgl/type-conversion-test.html:
* fast/canvas/webgl/uniform-location-length-limits.html:
* fast/canvas/webgl/uniform-location.html:
* fast/canvas/webgl/webgl-depth-texture.html:
* fast/canvas/webgl/webgl-specific.html:
* fast/canvas/webgl/webgl-texture-binding-preserved.html:
* inspector/profiler/webgl/webgl-profiler-api-changes.html:
* inspector/profiler/webgl/webgl-profiler-get-error.html:

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

52 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/attrib-location-length-limits.html
LayoutTests/fast/canvas/webgl/bad-arguments-test.html
LayoutTests/fast/canvas/webgl/buffer-bind-test.html
LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html
LayoutTests/fast/canvas/webgl/compressed-tex-image.html
LayoutTests/fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html
LayoutTests/fast/canvas/webgl/context-lost-restored.html
LayoutTests/fast/canvas/webgl/context-lost.html
LayoutTests/fast/canvas/webgl/draw-arrays-out-of-bounds.html
LayoutTests/fast/canvas/webgl/draw-elements-out-of-bounds.html
LayoutTests/fast/canvas/webgl/error-reporting.html
LayoutTests/fast/canvas/webgl/framebuffer-object-attachment.html
LayoutTests/fast/canvas/webgl/framebuffer-test.html
LayoutTests/fast/canvas/webgl/get-active-test.html
LayoutTests/fast/canvas/webgl/gl-bind-attrib-location-test.html
LayoutTests/fast/canvas/webgl/gl-enable-enum-test.html
LayoutTests/fast/canvas/webgl/gl-enum-tests.html
LayoutTests/fast/canvas/webgl/gl-object-get-calls.html
LayoutTests/fast/canvas/webgl/gl-uniform-arrays.html
LayoutTests/fast/canvas/webgl/gl-uniformmatrix4fv.html
LayoutTests/fast/canvas/webgl/gl-vertexattribpointer.html
LayoutTests/fast/canvas/webgl/glsl-conformance.html
LayoutTests/fast/canvas/webgl/incorrect-context-object-behaviour.html
LayoutTests/fast/canvas/webgl/index-validation-copies-indices.html
LayoutTests/fast/canvas/webgl/index-validation-verifies-too-many-indices.html
LayoutTests/fast/canvas/webgl/index-validation.html
LayoutTests/fast/canvas/webgl/invalid-passed-params.html
LayoutTests/fast/canvas/webgl/null-object-behaviour.html
LayoutTests/fast/canvas/webgl/object-deletion-behaviour.html
LayoutTests/fast/canvas/webgl/program-test.html
LayoutTests/fast/canvas/webgl/read-pixels-pack-alignment.html
LayoutTests/fast/canvas/webgl/read-pixels-test.html
LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js
LayoutTests/fast/canvas/webgl/shader-deleted-by-accessor.html
LayoutTests/fast/canvas/webgl/shader-precision-format.html
LayoutTests/fast/canvas/webgl/tex-input-validation.html
LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args.html
LayoutTests/fast/canvas/webgl/texture-complete.html
LayoutTests/fast/canvas/webgl/texture-npot.html
LayoutTests/fast/canvas/webgl/type-conversion-test.html
LayoutTests/fast/canvas/webgl/uniform-location-length-limits.html
LayoutTests/fast/canvas/webgl/uniform-location.html
LayoutTests/fast/canvas/webgl/webgl-depth-texture.html
LayoutTests/fast/canvas/webgl/webgl-specific.html
LayoutTests/fast/canvas/webgl/webgl-texture-binding-preserved.html
LayoutTests/inspector/profiler/webgl/webgl-profiler-api-changes.html
LayoutTests/inspector/profiler/webgl/webgl-profiler-get-error.html
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.h
Source/WebCore/page/Settings.in

index 6a5705e..361ea08 100644 (file)
@@ -1,3 +1,62 @@
+2013-01-25  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        Move WebGLErrorsToConsole page setting to window.internals.settings
+        https://bugs.webkit.org/show_bug.cgi?id=107218
+
+        Set WebGLErrorsToConsoleEnabled to false for WebGL tests which have
+        errors. Some WebGL error messages depend on OpenGL implementations, so
+        logging error messages would lead to platform specific output.
+
+        Reviewed by Kenneth Russell.
+
+        * fast/canvas/webgl/attrib-location-length-limits.html:
+        * fast/canvas/webgl/bad-arguments-test.html:
+        * fast/canvas/webgl/buffer-bind-test.html:
+        * fast/canvas/webgl/buffer-data-array-buffer.html:
+        * fast/canvas/webgl/compressed-tex-image.html:
+        * fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html:
+        * fast/canvas/webgl/context-lost-restored.html:
+        * fast/canvas/webgl/context-lost.html:
+        * fast/canvas/webgl/draw-arrays-out-of-bounds.html:
+        * fast/canvas/webgl/draw-elements-out-of-bounds.html:
+        * fast/canvas/webgl/error-reporting.html:
+        * fast/canvas/webgl/framebuffer-object-attachment.html:
+        * fast/canvas/webgl/framebuffer-test.html:
+        * fast/canvas/webgl/get-active-test.html:
+        * fast/canvas/webgl/gl-bind-attrib-location-test.html:
+        * fast/canvas/webgl/gl-enable-enum-test.html:
+        * fast/canvas/webgl/gl-enum-tests.html:
+        * fast/canvas/webgl/gl-object-get-calls.html:
+        * fast/canvas/webgl/gl-uniform-arrays.html:
+        * fast/canvas/webgl/gl-uniformmatrix4fv.html:
+        * fast/canvas/webgl/gl-vertexattribpointer.html:
+        * fast/canvas/webgl/glsl-conformance.html:
+        * fast/canvas/webgl/incorrect-context-object-behaviour.html:
+        * fast/canvas/webgl/index-validation-copies-indices.html:
+        * fast/canvas/webgl/index-validation-verifies-too-many-indices.html:
+        * fast/canvas/webgl/index-validation.html:
+        * fast/canvas/webgl/invalid-passed-params.html:
+        * fast/canvas/webgl/null-object-behaviour.html:
+        * fast/canvas/webgl/object-deletion-behaviour.html:
+        * fast/canvas/webgl/program-test.html:
+        * fast/canvas/webgl/read-pixels-pack-alignment.html:
+        * fast/canvas/webgl/read-pixels-test.html:
+        * fast/canvas/webgl/script-tests/texImageTest.js:
+        * fast/canvas/webgl/shader-deleted-by-accessor.html:
+        * fast/canvas/webgl/shader-precision-format.html:
+        * fast/canvas/webgl/tex-input-validation.html:
+        * fast/canvas/webgl/tex-sub-image-2d-bad-args.html:
+        * fast/canvas/webgl/texture-complete.html:
+        * fast/canvas/webgl/texture-npot.html:
+        * fast/canvas/webgl/type-conversion-test.html:
+        * fast/canvas/webgl/uniform-location-length-limits.html:
+        * fast/canvas/webgl/uniform-location.html:
+        * fast/canvas/webgl/webgl-depth-texture.html:
+        * fast/canvas/webgl/webgl-specific.html:
+        * fast/canvas/webgl/webgl-texture-binding-preserved.html:
+        * inspector/profiler/webgl/webgl-profiler-api-changes.html:
+        * inspector/profiler/webgl/webgl-profiler-get-error.html:
+
 2013-01-25  Abhishek Arya  <inferno@chromium.org>
 
         Regression(r139836): Crash in WTF::equalIgnoringCase
index 7478d7c..f8e1a7c 100644 (file)
@@ -51,6 +51,8 @@ void main() {
 if (window.initNonKhronosFramework) {
     window.initNonKhronosFramework(false);
 }
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
 
 var wtu = WebGLTestUtils;
 var gl = wtu.create3DContext(document.getElementById("example"));
index b299332..27e95d4 100644 (file)
@@ -9,6 +9,9 @@
 <div id="console"></div>
 
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 description("Tests calling WebGL APIs with wrong argument types");
 
index 695d3fc..3e62967 100644 (file)
@@ -16,6 +16,9 @@ description("Checks a buffer can only be bound to 1 target.");
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var gl = create3DContext(document.getElementById("canvas"));
 if (!gl) {
   testFailed("context does not exist");
index 932aab9..344e7fc 100644 (file)
@@ -12,6 +12,9 @@ description("Test bufferData/bufferSubData with ArrayBuffer input");
 
 debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=41884">https://bugs.webkit.org/show_bug.cgi?id=41884</a> : <code>Implement bufferData and bufferSubData with ArrayBuffer as input</code>');
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var gl = create3DContext();
 shouldBeNonNull("gl");
 
index 5eea42b..ab1950d 100644 (file)
@@ -15,6 +15,9 @@ description("This test ensures WebGL implementations correctly implement compres
 
 debug("");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.createElement("canvas");
 var gl = wtu.create3DContext(canvas);
index c17ce72..262c2c2 100644 (file)
@@ -48,6 +48,9 @@ function init()
         window.initNonKhronosFramework(true);
     }
 
+    if (window.internals)
+        window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
     description('Verify WebGLContextAttributes are working as specified, including alpha, depth, stencil, antialias, but not premultipliedAlpha');
 
     runTest();
index 07516d9..a15cc12 100644 (file)
@@ -6,6 +6,9 @@
 <script src="resources/webgl-test.js"></script>
 <script src="resources/webgl-test-utils.js"></script>
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas;
 var gl;
index 5261d27..9e2f061 100644 (file)
@@ -6,6 +6,9 @@
 <script src="resources/webgl-test.js"></script>
 <script src="resources/webgl-test-utils.js"></script>
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu;
 var canvas;
 var gl;
index 5b5fdfc..955e56f 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description("Test of drawArrays with out-of-bounds parameters");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var program = loadStandardProgram(context);
 
index bba4e71..194d615 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description("Test of drawElements with out-of-bounds parameters");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var program = loadStandardProgram(context);
 
index 09ce844..6b02a41 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description("Tests generation of synthetic and real GL errors");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var program = loadStandardProgram(context);
 
index 82887c7..ca7eba7 100644 (file)
@@ -11,6 +11,9 @@
 <div id="console"></div>
 
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var gl;
 var fbo;
index 58db136..ae7eb58 100644 (file)
@@ -17,6 +17,9 @@ description("This tests framebuffer/renderbuffer-related functions");
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var canvas = document.getElementById("canvas");
 var gl = create3DContext(canvas);
 if (!gl) {
index 708f16b..4d631cd 100644 (file)
@@ -11,6 +11,9 @@
 <script>
 description("Test of getActiveAttrib and getActiveUniform");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var context2 = create3DContext();
 var program = loadStandardProgram(context);
index 184360f..3b99c57 100644 (file)
@@ -34,6 +34,9 @@ void main()
 <script>
 description("This test ensures WebGL implementations don't allow names that start with 'gl_' when calling bindAttribLocation.");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 debug("");
 debug("Canvas.getContext");
 
index da9c99b..56ecd0b 100644 (file)
@@ -18,6 +18,9 @@ description("This test ensures WebGL implementations allow OpenGL ES 2.0 feature
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var gl = create3DContext(document.getElementById("canvas"));
 if (!gl) {
   testFailed("context does not exist");
index dfee46b..25d5dc0 100644 (file)
@@ -18,6 +18,9 @@ description("This test ensures various WebGL functions fail when passed non Open
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var gl = create3DContext(document.getElementById("canvas"));
 if (!gl) {
   testFailed("context does not exist");
index 4d8e235..a0f2af8 100644 (file)
@@ -12,6 +12,9 @@
 <script>
 description("Test of get calls against GL objects like getBufferParameter, etc.");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 function sizeInBytes(type) {
   switch (type) {
   case gl.BYTE:
index 29ec545..c5a3ac7 100644 (file)
@@ -81,6 +81,9 @@ description("This test ensures WebGL implementations handle uniform arrays corre
 
 debug("");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var gl = create3DContext(document.getElementById("example"));
 
 var vSrc = document.getElementById("vshader").text;
index 6c9ac03..5d87773 100644 (file)
@@ -36,6 +36,9 @@ description("This test ensures WebGL implementations handle uniformMatrix in a O
 debug("");
 debug("Checking gl.uniformMatrix.");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
 for (var ii = 2; ii <= 4; ++ii) {
   var loc = gl.getUniformLocation(gl.program, "world" + ii);
index cea389a..8ce5254 100644 (file)
@@ -19,6 +19,9 @@ description("This test checks vertexAttribPointer behaviors in WebGL.");
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var gl = create3DContext(document.getElementById("canvas"));
 if (!gl) {
index aeaa0bf..062e50f 100644 (file)
@@ -221,6 +221,9 @@ description("This test ensures WebGL implementations allow proper GLES2 shaders
 debug("");
 debug("Canvas.getContext");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 wtu.loggingOff();
 var gl = wtu.create3DContext(document.getElementById("canvas"));
index 4fa1c27..e529b69 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description("Tests calling WebGL APIs with objects from other contexts");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var contextA = create3DContext();
 var contextB = create3DContext();
 var programA = loadStandardProgram(contextA);
index a5a7928..6e15e20 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description('Test that client data is always copied during bufferData and bufferSubData calls, because otherwise the data the GL uses to draw may differ from that checked by the index validation code.')
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var program = loadStandardProgram(context);
 
index 04eb493..32e9dfe 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description('Tests that index validation for drawElements does not examine too many indices');
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var program = loadStandardProgram(context);
 
index cb95d40..5c96bab 100644 (file)
@@ -13,6 +13,9 @@
 <script>
 description("Tests that index validation verifies the correct number of indices");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 function sizeInBytes(type) {
   switch (type) {
   case gl.BYTE:
index 2aee2d2..a050674 100644 (file)
@@ -11,6 +11,9 @@
 <script>
 description("Test for invalid passed parameters");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 
 debug("");
index fc0d009..0283855 100644 (file)
@@ -12,6 +12,9 @@
 var wtu = WebGLTestUtils;
 description("Tests calling WebGL APIs without providing the necessary objects");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = wtu.create3DContext();
 var program = wtu.loadStandardProgram(context);
 var shader = wtu.loadStandardVertexShader(context);
index 0c6b115..2f2e749 100644 (file)
@@ -13,6 +13,9 @@
 <script>
 description("Tests deletion behavior for texture, renderbuffer, shader, and program");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var gl = wtu.create3DContext();
 var shouldGenerateGLError = wtu.shouldGenerateGLError;
index c063334..ea6263f 100644 (file)
@@ -17,6 +17,9 @@ function go() {
     debug("");
     debug("Canvas.getContext");
 
+    if (window.internals)
+        window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
     var gl = create3DContext(document.getElementById("canvas"));
     if (!gl) {
         testFailed("context does not exist");
index 1955655..abcdced 100644 (file)
@@ -31,6 +31,8 @@ void main()
 <div id="description"></div>
 <div id="console"></div>
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
 
 // The below declarations need to be global for "shouldBe" to see them
 var gl = null;
index d4aee4e..e6410e5 100644 (file)
@@ -14,6 +14,9 @@
 <script>
 description("Checks that ReadPixels works as expected.");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("example");
 var gl = create3DContext(canvas);
index 620f3fe..c1a9d4e 100644 (file)
@@ -1,5 +1,8 @@
 description("Test of texImage2d and texSubImage2d");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = create3DContext();
 var image = document.createElement("img");
 var video = document.createElement("video");
index 4cbd41e..1534818 100644 (file)
@@ -12,6 +12,9 @@
 
 description("Verifies that WebGLRenderingContext::getAttachedShaders doesn't crash when an accessor property is defined on Array.prototype.");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 context = create3DContext();
 program = context.createProgram();
 
index b80f385..4ebf63a 100644 (file)
@@ -17,6 +17,9 @@ if (window.initNonKhronosFramework) {
     window.initNonKhronosFramework(true);
 }
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 description(document.title);
 debug("Tests that WebGLShaderPrecisionFormat class and getShaderPrecisionFormat work.");
index 272aac9..8d581d3 100644 (file)
@@ -9,6 +9,9 @@
 <div id="console"></div>
 
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var gl = null;
 var tex = null;
index 2afc7a2..de88bbe 100644 (file)
@@ -12,6 +12,9 @@
 <script>
 description('Tests texSubImage2D with bad arguments');
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("testbed");
 var c = document.getElementById("c");
index ed6812d..7b15fd5 100644 (file)
@@ -44,6 +44,9 @@ function init()
     window.initNonKhronosFramework(false);
   }
 
+  if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
   debug("Checks that a texture that is not -texture-complete- does not draw if"+
         " filtering needs mips");
   debug("");
index 854cf7d..3129a03 100644 (file)
@@ -34,6 +34,9 @@ void main()
 }
 </script>
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("example");
 var gl = wtu.create3DContext(canvas);
index 26c3a7e..2796bdc 100644 (file)
@@ -12,6 +12,9 @@
 var wtu = WebGLTestUtils;
 description("Tests calling WebGL APIs with various types");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var context = wtu.create3DContext();
 var program = wtu.loadStandardProgram(context);
 var shader = wtu.loadStandardVertexShader(context);
index 45ddf93..012cb06 100644 (file)
@@ -74,6 +74,9 @@ if (window.initNonKhronosFramework) {
     window.initNonKhronosFramework(false);
 }
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var gl = wtu.create3DContext(document.getElementById("example"));
 
index 8357a1b..5394660 100644 (file)
@@ -10,6 +10,9 @@
 <script>
 description("Tests the WebGLUniformLocation API");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var contextA = create3DContext();
 var contextB = create3DContext();
 var programA1 = loadStandardProgram(contextA);
index 07e2a54..e06f862 100644 (file)
@@ -37,6 +37,9 @@ description("This test verifies the functionality of the WEBGL_depth_texture ext
 
 debug("");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("canvas");
 var gl = wtu.create3DContext(canvas, {antialias: false});
index ec521c1..6964bfd 100644 (file)
@@ -12,6 +12,9 @@
 <div id="console"></div>
 
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 description("Tests the a few differences between WebGL and GLES2");
 
index 2cc88bd..c75bfb1 100755 (executable)
@@ -17,6 +17,9 @@ if (window.testRunner) {
     testRunner.waitUntilDone();
 }
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var canvas;
 var context;
 
index b1f66f1..84daaf7 100644 (file)
@@ -200,6 +200,8 @@ function runTest()
         testRunner.dumpAsText();
         testRunner.waitUntilDone();
     }
+    if (window.internals)
+        window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
     try {
         test();
     } finally {
index ec3093d..ef62d63 100644 (file)
@@ -3,6 +3,8 @@
     <script src="../../../http/tests/inspector/inspector-test.js"></script>
     <script src="../canvas-profiler-test.js"></script>
 <script>
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
 
 /**
  * @constructor
index bf2b9ed..c23481f 100644 (file)
@@ -1,3 +1,34 @@
+2013-01-25  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        Move WebGLErrorsToConsole page setting to window.internals.settings
+        https://bugs.webkit.org/show_bug.cgi?id=107218
+
+        Reviewed by Kenneth Russell.
+
+        Define webGLErrorsToConsoleEnabled as true by default. Also,
+        WebGLRenderingContext::m_synthesizedErrorsToConsole is true by default
+        and can be disabled by settings.
+
+        Add a ConsoleDisplayPreference parameter to synthesizeGLError
+        (defaults to DisplayInConsole). When called with DontDisplayInConsole,
+        an error message will not be displayed (even if
+        m_synthesizedErrorsToConsole is true).
+
+        Call synthesizeGLError with DontDisplayInConsole in case of synthetic
+        context lost.
+
+        No new tests: covered by existing tests.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::WebGLRenderingContext):
+        (WebCore::WebGLRenderingContext::setupFlags):
+        (WebCore::WebGLRenderingContext::validateRenderingState):
+        (WebCore::WebGLRenderingContext::loseContextImpl):
+        (WebCore::WebGLRenderingContext::synthesizeGLError):
+        * html/canvas/WebGLRenderingContext.h:
+        * page/Settings.in:
+
 2013-01-25  Alec Flett  <alecflett@chromium.org>
 
         IndexedDB: Move TaskType enum to IDBDatabaseBackendInterface
index 409a66c..4f24b0c 100644 (file)
@@ -464,7 +464,7 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
     , m_contextLost(false)
     , m_contextLostMode(SyntheticLostContext)
     , m_attributes(attributes)
-    , m_synthesizedErrorsToConsole(false)
+    , m_synthesizedErrorsToConsole(true)
     , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
 {
     ASSERT(m_context);
@@ -566,8 +566,8 @@ void WebGLRenderingContext::setupFlags()
     ASSERT(m_context);
 
     Page* p = canvas()->document()->page();
-    if (p && p->settings()->webGLErrorsToConsoleEnabled())
-        m_synthesizedErrorsToConsole = true;
+    if (p)
+        m_synthesizedErrorsToConsole = p->settings()->webGLErrorsToConsoleEnabled();
 
     m_isGLES2Compliant = m_context->isGLES2Compliant();
     m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions()->isEnabled("GL_CHROMIUM_strict_attribs");
@@ -4546,7 +4546,8 @@ void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMo
         if (m_context->getError() == GraphicsContext3D::NO_ERROR)
             break;
     }
-    synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL, "loseContext", "context lost");
+    ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInConsole: DontDisplayInConsole;
+    synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL, "loseContext", "context lost", display);
 
     // Don't allow restoration unless the context lost event has both been
     // dispatched and its default behavior prevented.
@@ -5786,9 +5787,9 @@ namespace {
 
 } // namespace anonymous
 
-void WebGLRenderingContext::synthesizeGLError(GC3Denum error, const char* functionName, const char* description)
+void WebGLRenderingContext::synthesizeGLError(GC3Denum error, const char* functionName, const char* description, ConsoleDisplayPreference display)
 {
-    if (m_synthesizedErrorsToConsole) {
+    if (m_synthesizedErrorsToConsole && display == DisplayInConsole) {
       String str = String("WebGL: ") + GetErrorString(error) +  ": " + String(functionName) + ": " + String(description);
       printGLErrorToConsole(str);
     }
index 5b0fb91..793b3d4 100644 (file)
@@ -711,9 +711,14 @@ public:
     // a Safari or Chrome extension.
     bool allowPrivilegedExtensions() const;
 
+    enum ConsoleDisplayPreference {
+        DisplayInConsole,
+        DontDisplayInConsole
+    };
+
     // Wrapper for GraphicsContext3D::synthesizeGLError that sends a message
     // to the JavaScript console.
-    void synthesizeGLError(GC3Denum, const char* functionName, const char* description);
+    void synthesizeGLError(GC3Denum, const char* functionName, const char* description, ConsoleDisplayPreference = DisplayInConsole);
 
     String ensureNotNull(const String&) const;
 
index cd2e668..d2904d0 100644 (file)
@@ -97,7 +97,7 @@ compositedScrollingForFramesEnabled initial=false
 
 experimentalNotificationsEnabled initial=false
 webGLEnabled initial=false
-webGLErrorsToConsoleEnabled initial=false
+webGLErrorsToConsoleEnabled initial=true
 openGLMultisamplingEnabled initial=true
 privilegedWebGLExtensionsEnabled initial=false
 accelerated2dCanvasEnabled initial=false