Bug 1352067 - Part 2: Avoid passing any nullptr into Servo_AnimationValue_DeepEqual. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 31 Mar 2017 11:04:08 +0800
changeset 554282 e9382da646667f275cc5de65b2f70fdfaf88173e
parent 554281 124c34295cc61c0817485957f7abeec4235a414e
child 622301 748cbf5584beacd8b8051fe7971b4efcc41ca763
push id51895
push userbmo:boris.chiou@gmail.com
push dateFri, 31 Mar 2017 09:54:51 +0000
bugs1352067
milestone55.0a1
Bug 1352067 - Part 2: Avoid passing any nullptr into Servo_AnimationValue_DeepEqual. The FFI type conversion in AnimationValue::as_arc will check if the parameter is nullptr or not. If it is, we will get a debug assertion, so we shouldn't pass a nullptr into it. MozReview-Commit-ID: KWko2ipJwbo
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -5197,20 +5197,21 @@ StyleAnimationValue::operator==(const St
 // AnimationValue Implementation
 
 bool
 AnimationValue::operator==(const AnimationValue& aOther) const
 {
   // It is possible to compare an empty AnimationValue with others, so both
   // mServo and mGecko could be null while comparing.
   MOZ_ASSERT(!mServo || mGecko.IsNull());
-  if (mServo) {
+  if (mServo && aOther.mServo) {
     return Servo_AnimationValue_DeepEqual(mServo, aOther.mServo);
   }
-  return mGecko == aOther.mGecko;
+  return !mServo && !aOther.mServo &&
+         mGecko == aOther.mGecko;
 }
 
 float
 AnimationValue::GetOpacity() const
 {
   MOZ_ASSERT(!mServo != mGecko.IsNull());
   return mServo ? Servo_AnimationValue_GetOpacity(mServo)
                 : mGecko.GetFloatValue();