Bug 723446. Be a little more careful changing declarations on keyframe rules. r=dbaron

This commit is contained in:
Boris Zbarsky 2012-02-02 11:59:39 -05:00
parent be2a314e45
commit dbea24d349
2 changed files with 6 additions and 1 deletions

View File

@ -1964,7 +1964,11 @@ nsCSSKeyframeRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
void
nsCSSKeyframeRule::ChangeDeclaration(css::Declaration* aDeclaration)
{
mDeclaration = aDeclaration;
// Be careful to not assign to an nsAutoPtr if we would be assigning
// the thing it already holds.
if (aDeclaration != mDeclaration) {
mDeclaration = aDeclaration;
}
if (mSheet) {
mSheet->SetModifiedByChildRule();

View File

@ -66,6 +66,7 @@ class nsAutoPtr
void
assign( T* newPtr )
{
NS_ABORT_IF_FALSE(mRawPtr != newPtr || !newPtr, "This makes no sense!");
T* oldPtr = mRawPtr;
mRawPtr = newPtr;
delete oldPtr;