Bug 1443149 - Ensure WebGLFBAttachPoint::HasImage() before dereferencing Format(). r?jgilbert
Previously we were checking IsDefined() rather than HasImage(), but
were hitting crashes. This was because Format() can return null if the
attach point is defined but the attached texture level or renderbuffer
aren't themselves defined. HasImage() checks for this case.
MozReview-Commit-ID: 8KY3zPXXAFv
--- a/dom/canvas/WebGLContextFramebufferOperations.cpp
+++ b/dom/canvas/WebGLContextFramebufferOperations.cpp
@@ -28,17 +28,17 @@ WebGLContext::Clear(GLbitfield mask)
GenerateWarning("Calling gl.clear(0) has no effect.");
} else if (mRasterizerDiscardEnabled) {
GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
}
if (mask & LOCAL_GL_COLOR_BUFFER_BIT && mBoundDrawFramebuffer) {
if (mask & LOCAL_GL_COLOR_BUFFER_BIT) {
for (const auto& cur : mBoundDrawFramebuffer->ColorDrawBuffers()) {
- if (!cur->IsDefined())
+ if (!cur->HasImage())
continue;
switch (cur->Format()->format->componentType) {
case webgl::ComponentType::Float:
case webgl::ComponentType::NormInt:
case webgl::ComponentType::NormUInt:
break;