Bug 13821850 - Check the status of GLContext::MakeCurrent in CanvasRenderingContext2D. r=Bas
authorNicolas Silva <nsilva@mozilla.com>
Mon, 24 Jul 2017 12:24:21 +0200
changeset 419285 7928b9c4f4c3edc1087e220122e4a09e409d4b82
parent 419284 b746e314d3d137ce61d49bc7d631bccada74227a
child 419286 7764f3432bac5a10eab4d103930f972528054e1e
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs13821850
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 13821850 - Check the status of GLContext::MakeCurrent in CanvasRenderingContext2D. r=Bas
dom/canvas/CanvasRenderingContext2D.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5227,17 +5227,20 @@ CanvasRenderingContext2D::DrawImage(cons
     AutoLockImage lockImage(container);
     layers::Image* srcImage = lockImage.GetImage();
     if (!srcImage) {
       aError.Throw(NS_ERROR_NOT_AVAILABLE);
       return;
     }
 
     {
-      gl->MakeCurrent();
+      if (!gl->MakeCurrent()) {
+        aError.Throw(NS_ERROR_NOT_AVAILABLE);
+        return;
+      }
       GLuint videoTexture = 0;
       gl->fGenTextures(1, &videoTexture);
       // skiaGL expect upload on drawing, and uses texture 0 for texturing,
       // so we must active texture 0 and bind the texture for it.
       gl->fActiveTexture(LOCAL_GL_TEXTURE0);
       const gl::ScopedBindTexture scopeBindTexture(gl, videoTexture);
 
       gl->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGB, srcImage->GetSize().width, srcImage->GetSize().height, 0, LOCAL_GL_RGB, LOCAL_GL_UNSIGNED_SHORT_5_6_5, nullptr);