Bug 673378 - Crash at nsHTMLCanvasElement::GetContext - r=roc, a=clegnitto
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 03 Aug 2011 19:35:56 -0400
changeset 70598 f8583ac431a637c5622c7b25e27be58c959f87cc
parent 70597 6eafc1d64af99113395f386468155027ad17572b
child 70599 a9bc7596542b87b6b5a62a002a699c12400530f3
push id146
push userbjacob@mozilla.com
push dateWed, 03 Aug 2011 23:56:33 +0000
treeherdermozilla-beta@f8583ac431a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, clegnitto
bugs673378
milestone6.0
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
@@ -591,28 +591,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()