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 108299 ac136b93a1a343276991a444107a56fdcd6b1f2c
parent 108298 96fd99a249cd6519567c766b2e696ffa61e2a363
child 108300 3d81919584ff2fbebb0a22cdb316dbd6b22b2e9e
push id15467
push userbjacob@mozilla.com
push dateThu, 27 Sep 2012 16:09:48 +0000
treeherdermozilla-inbound@3d81919584ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs791521
milestone18.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 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;