diff options
author | Josh Matthews <josh@joshmatthews.net> | 2019-09-19 17:38:46 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-09-20 01:28:21 -0400 |
commit | 46b1d8faeeeadcddf136ad99096d2d99da7ea36b (patch) | |
tree | 1f719788a4bb46780056ac5ad606cab447dc8354 /components/script/dom/webglrenderingcontext.rs | |
parent | 540a73ed2970948e916db0c53880ca20cb5083e9 (diff) | |
download | servo-46b1d8faeeeadcddf136ad99096d2d99da7ea36b.tar.gz servo-46b1d8faeeeadcddf136ad99096d2d99da7ea36b.zip |
webgl: Report invalid operations for more APIs that can't use an incomplete framebuffer.
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index e50d70cb916..354f918a0dd 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1241,9 +1241,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // GL_OES_read_format support (assuming an underlying GLES // driver. Desktop is happy to format convert for us). constants::IMPLEMENTATION_COLOR_READ_FORMAT => { + if self.validate_framebuffer().is_err() { + self.webgl_error(InvalidOperation); + return NullValue(); + } return Int32Value(constants::RGBA as i32); }, constants::IMPLEMENTATION_COLOR_READ_TYPE => { + if self.validate_framebuffer().is_err() { + self.webgl_error(InvalidOperation); + return NullValue(); + } return Int32Value(constants::UNSIGNED_BYTE as i32); }, constants::COMPRESSED_TEXTURE_FORMATS => unsafe { @@ -2819,6 +2827,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { pixel_type: u32, mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>, ) { + handle_potential_webgl_error!(self, self.validate_framebuffer(), return); + let pixels = handle_potential_webgl_error!(self, pixels.as_mut().ok_or(InvalidValue), return); @@ -2834,7 +2844,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { return self.webgl_error(InvalidOperation); } - handle_potential_webgl_error!(self, self.validate_framebuffer(), return); let (fb_width, fb_height) = handle_potential_webgl_error!( self, self.get_current_framebuffer_size().ok_or(InvalidOperation), |