diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index d288e9422c4f..0458e2ae2ca8 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -147,7 +147,7 @@ impl WebGLProgram { } // Check if the name is reserved - if name.starts_with("webgl") || name.starts_with("_webgl_") { + if name.starts_with("gl_") || name.starts_with("webgl") || name.starts_with("_webgl_") { return Err(WebGLError::InvalidOperation); } @@ -185,6 +185,10 @@ impl WebGLProgram { } // Check if the name is reserved + if name.starts_with("gl_") { + return Err(WebGLError::InvalidOperation); + } + if name.starts_with("webgl") || name.starts_with("_webgl_") { return Ok(None); } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 197dcce55f51..5f1b0589af4c 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -979,12 +979,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { fn GetUniformLocation(&self, program: Option<&WebGLProgram>, name: DOMString) -> Option> { - if let Some(program) = program { - handle_potential_webgl_error!(self, program.get_uniform_location(name), None) - .map(|location| WebGLUniformLocation::new(self.global().r(), location, program.id())) - } else { - None - } + program.and_then(|p| { + handle_potential_webgl_error!(self, p.get_uniform_location(name), None) + .map(|location| WebGLUniformLocation::new(self.global().r(), location, p.id())) + }) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3 diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/programs/gl-bind-attrib-location-test.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/programs/gl-bind-attrib-location-test.html.ini index c81f7bef1543..17d8dfb7a4bb 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/programs/gl-bind-attrib-location-test.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/programs/gl-bind-attrib-location-test.html.ini @@ -1,3 +1,4 @@ [gl-bind-attrib-location-test.html] type: testharness - expected: CRASH + [WebGL test #6: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] + expected: FAIL