Bug 791521 - return early on resizing WebGLContext where the canvas is null - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 27 Sep 2012 10:13:44 -0400
changeset 108417 ac136b93a1a343276991a444107a56fdcd6b1f2c
parent 108416 96fd99a249cd6519567c766b2e696ffa61e2a363
child 108418 3d81919584ff2fbebb0a22cdb316dbd6b22b2e9e
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersjgilbert
bugs791521
milestone18.0a1
Bug 791521 - return early on resizing WebGLContext where the canvas is null - r=jgilbert
content/canvas/src/WebGLContext.cpp
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -326,19 +326,20 @@ WebGLContext::SetContextOptions(nsIPrope
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::SetDimensions(int32_t width, int32_t height)
 {
     /*** early success return cases ***/
 
-    if (mCanvasElement) {
-        mCanvasElement->InvalidateCanvas();
-    }
+    if (!GetCanvas())
+        return NS_ERROR_FAILURE;
+
+    GetCanvas()->InvalidateCanvas();
 
     if (gl && mWidth == width && mHeight == height)
         return NS_OK;
 
     // Zero-sized surfaces can cause problems.
     if (width == 0 || height == 0) {
         width = 1;
         height = 1;