Bug 673378 - Crash at nsHTMLCanvasElement::GetContext - r=roc, a=clegnitto
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 03 Aug 2011 19:35:56 -0400
changeset 72744 1539927cf9ba
parent 72743 eb83ff4f4175
child 72745 2ba82873fa9c
push id283
push userbjacob@mozilla.com
push dateWed, 03 Aug 2011 23:56:42 +0000
treeherdermozilla-aurora@1539927cf9ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, clegnitto
bugs673378
milestone7.0a2
Bug 673378 - Crash at nsHTMLCanvasElement::GetContext - r=roc, a=clegnitto When UpdateContext fails, we only reset mCurrentContext, and forgot to reset mCurrentContextId.
content/html/content/src/nsHTMLCanvasElement.cpp
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -566,28 +566,31 @@ nsHTMLCanvasElement::UpdateContext(nsIPr
     return NS_OK;
 
   nsresult rv = NS_OK;
   nsIntSize sz = GetWidthHeight();
 
   rv = mCurrentContext->SetIsOpaque(GetIsOpaque());
   if (NS_FAILED(rv)) {
     mCurrentContext = nsnull;
+    mCurrentContextId.AssignLiteral("");
     return rv;
   }
 
   rv = mCurrentContext->SetContextOptions(aNewContextOptions);
   if (NS_FAILED(rv)) {
     mCurrentContext = nsnull;
+    mCurrentContextId.AssignLiteral("");
     return rv;
   }
 
   rv = mCurrentContext->SetDimensions(sz.width, sz.height);
   if (NS_FAILED(rv)) {
     mCurrentContext = nsnull;
+    mCurrentContextId.AssignLiteral("");
     return rv;
   }
 
   return rv;
 }
 
 nsIFrame *
 nsHTMLCanvasElement::GetPrimaryCanvasFrame()