Bug 1096632 - Add a null check in case webgl app calls to glTexImage(<video>) while no frame inserted into ImageContainer. r=jgilbert
authorchiajung hung <chung@mozilla.com>
Tue, 11 Nov 2014 19:29:00 -0500
changeset 238117 cbfba445b09eb452e8fa9ea7ad6eac64017647cf
parent 238116 725c5cf6db6cb317f8b2bc6301780ef2eabb7a9f
child 238118 9e126e97e3470194832c2c799307e331aeaafe8c
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1096632
milestone37.0a1
Bug 1096632 - Add a null check in case webgl app calls to glTexImage(<video>) while no frame inserted into ImageContainer. r=jgilbert
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1802,16 +1802,19 @@ WebGLContext::TexImageFromVideoElement(c
             GenerateWarning("It is forbidden to load a WebGL texture from a cross-domain element that has not been validated with CORS. "
                                 "See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
             return false;
         }
     }
 
     gl->MakeCurrent();
     nsRefPtr<mozilla::layers::Image> srcImage = container->LockCurrentImage();
+    if (!srcImage)
+        return false;
+
     WebGLTexture* tex = ActiveBoundTextureForTexImageTarget(texImageTarget);
 
     const WebGLTexture::ImageInfo& info = tex->ImageInfoAt(texImageTarget, 0);
     bool dimensionsMatch = info.Width() == srcImage->GetSize().width &&
                            info.Height() == srcImage->GetSize().height;
     if (!dimensionsMatch) {
         // we need to allocation
         gl->fTexImage2D(texImageTarget.get(), level, internalFormat,