diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 8e4757a58417..628f69e736bd 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1866,6 +1866,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { if !self.validate_framebuffer_complete() { return; } + if mask & !(constants::DEPTH_BUFFER_BIT | constants::STENCIL_BUFFER_BIT | constants::COLOR_BUFFER_BIT) != 0 { + return self.webgl_error(InvalidValue); + } self.send_command(WebGLCommand::Clear(mask)); self.mark_as_dirty(); diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 47eea45772bc..c84b409d5a6c 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -39229,6 +39229,12 @@ {} ] ], + "mozilla/webgl/clear.html": [ + [ + "/_mozilla/mozilla/webgl/clear.html", + {} + ] + ], "mozilla/webgl/context_creation_error.html": [ [ "/_mozilla/mozilla/webgl/context_creation_error.html", @@ -70864,6 +70870,10 @@ "c333c7b99156d63fcd3ad28014c7915a12cf8169", "testharness" ], + "mozilla/webgl/clear.html": [ + "14cc534be5da96b0cc128d5c44f662b2fdfb294c", + "testharness" + ], "mozilla/webgl/clearcolor.html": [ "942ee78ec987d17f63253ed97d6de958dbe8730d", "reftest" diff --git a/tests/wpt/mozilla/tests/mozilla/webgl/clear.html b/tests/wpt/mozilla/tests/mozilla/webgl/clear.html new file mode 100644 index 000000000000..b03c9a450f2f --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/webgl/clear.html @@ -0,0 +1,23 @@ + + +WebGLRenderingContext.clear testing (issue #20623) + + +