diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index bb1cace295e..df1b840fc46 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1165,14 +1165,16 @@ impl WebGLRenderingContext { return ); + let array_buffer = handle_potential_webgl_error!( + self, + self.current_vao().element_array_buffer().get().ok_or(InvalidOperation), + return + ); + if count > 0 && primcount > 0 { - if let Some(array_buffer) = self.current_vao().element_array_buffer().get() { - // This operation cannot overflow in u64 and we know all those values are nonnegative. - let val = offset as u64 + (count as u64 * type_size as u64); - if val > array_buffer.capacity() as u64 { - return self.webgl_error(InvalidOperation); - } - } else { + // This operation cannot overflow in u64 and we know all those values are nonnegative. + let val = offset as u64 + (count as u64 * type_size as u64); + if val > array_buffer.capacity() as u64 { return self.webgl_error(InvalidOperation); } } diff --git a/tests/wpt/webgl/meta/conformance/rendering/draw-elements-out-of-bounds.html.ini b/tests/wpt/webgl/meta/conformance/rendering/draw-elements-out-of-bounds.html.ini deleted file mode 100644 index d6d1e0ab2cb..00000000000 --- a/tests/wpt/webgl/meta/conformance/rendering/draw-elements-out-of-bounds.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[draw-elements-out-of-bounds.html] - [WebGL test #0: getError expected: INVALID_OPERATION. Was NO_ERROR : after evaluating: gl.drawElements(gl.TRIANGLES, 0, gl.UNSIGNED_BYTE, 0)] - expected: FAIL -