From c6dbf554496191a0cfe4c8f5dbe8c96031d1445b Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 20 Jan 2020 22:35:36 +0100 Subject: Issue #1354 - Clear the current context when MakeCurrent() fails. --- dom/canvas/WebGLContextValidate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dom') diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp index ebf0aa8c2..30d4c6522 100644 --- a/dom/canvas/WebGLContextValidate.cpp +++ b/dom/canvas/WebGLContextValidate.cpp @@ -440,6 +440,13 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason) { MOZ_RELEASE_ASSERT(gl, "GFX: GL not initialized"); + if (!gl->MakeCurrent(true)) { + MOZ_ASSERT(false); + *out_failReason = { "FEATURE_FAILURE_WEBGL_MAKECURRENT", + "Failed to MakeCurrent for init." }; + return false; + } + // Unconditionally create a new format usage authority. This is // important when restoring contexts and extensions need to add // formats back into the authority. -- cgit v1.2.3