Bug 412530 - "context.restore throws exception if no saved state instead of doing nothing per spec" [p=taken.spc@gmail.com (KUROSAWA, Takeshi) r+a1.9=vlad]

This commit is contained in:
reed@reedloden.com 2008-01-29 20:37:11 -08:00
parent 9e74d0068b
commit 171889e6bc

View File

@ -827,7 +827,9 @@ nsCanvasRenderingContext2D::Save()
NS_IMETHODIMP NS_IMETHODIMP
nsCanvasRenderingContext2D::Restore() nsCanvasRenderingContext2D::Restore()
{ {
if (mSaveCount <= 0) if (mSaveCount == 0)
return NS_OK;
if (mSaveCount < 0)
return NS_ERROR_DOM_INVALID_STATE_ERR; return NS_ERROR_DOM_INVALID_STATE_ERR;
mStyleStack.RemoveElementAt(mSaveCount); mStyleStack.RemoveElementAt(mSaveCount);