diff --git a/dom/canvas/WebGL2ContextMRTs.cpp b/dom/canvas/WebGL2ContextMRTs.cpp index 107cf303f1be..d4803bc09667 100644 --- a/dom/canvas/WebGL2ContextMRTs.cpp +++ b/dom/canvas/WebGL2ContextMRTs.cpp @@ -94,6 +94,10 @@ WebGL2Context::ClearBufferfv_base(GLenum buffer, GLint drawbuffer, const GLfloat void WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Int32Array& value) { + if (IsContextLost()) { + return; + } + value.ComputeLengthAndData(); if (!ValidateClearBuffer("clearBufferiv", buffer, drawbuffer, value.Length())) { return; @@ -105,6 +109,10 @@ WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Int32Ar void WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Sequence& value) { + if (IsContextLost()) { + return; + } + if (!ValidateClearBuffer("clearBufferiv", buffer, drawbuffer, value.Length())) { return; } @@ -115,6 +123,10 @@ WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Sequenc void WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Uint32Array& value) { + if (IsContextLost()) { + return; + } + value.ComputeLengthAndData(); if (!ValidateClearBuffer("clearBufferuiv", buffer, drawbuffer, value.Length())) { return; @@ -126,6 +138,10 @@ WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Uint32 void WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Sequence& value) { + if (IsContextLost()) { + return; + } + if (!ValidateClearBuffer("clearBufferuiv", buffer, drawbuffer, value.Length())) { return; } @@ -136,6 +152,10 @@ WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Sequen void WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Float32Array& value) { + if (IsContextLost()) { + return; + } + value.ComputeLengthAndData(); if (!ValidateClearBuffer("clearBufferfv", buffer, drawbuffer, value.Length())) { return; @@ -147,6 +167,10 @@ WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Float32 void WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Sequence& value) { + if (IsContextLost()) { + return; + } + if (!ValidateClearBuffer("clearBufferfv", buffer, drawbuffer, value.Length())) { return; } @@ -157,6 +181,10 @@ WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Sequenc void WebGL2Context::ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { + if (IsContextLost()) { + return; + } + if (buffer != LOCAL_GL_DEPTH_STENCIL) { return ErrorInvalidEnumInfo("clearBufferfi: buffer", buffer); }