Bug 1330190 - Part 6: Add MOZ_DIAGNOSTIC_ASSERT for mIsComposing. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 16 Jan 2017 17:41:25 +0900
changeset 461304 f726341e34883298350d873585e7e6893314177a
parent 461303 54a72bf6e16954edcf117d2065ab7ff80fe4ffe6
child 542286 7e51a48a5942b3a8dc68a14f9403a14b71872412
push id41639
push userhikezoe@mozilla.com
push dateMon, 16 Jan 2017 11:20:00 +0000
reviewersbirtles
bugs1330190
milestone53.0a1
Bug 1330190 - Part 6: Add MOZ_DIAGNOSTIC_ASSERT for mIsComposing. r?birtles Based on the other changesets in this series, we don't expect to be calling UpdateProperties() and ComposeStyle() from within ComposeStyle() itself. However, in case there is some scenario where that does still occur, we leave the mIsComposing check in place and add an equivalent MOZ_DIAGNOSTIC_ASSERT so that we are alerted if this does occur on debug / Nightly / DevEdition builds, but handle it gracefully on beta or release builds. MozReview-Commit-ID: 2cFpyMFR29Q
dom/animation/KeyframeEffectReadOnly.cpp
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -272,16 +272,18 @@ SpecifiedKeyframeArraysAreEqual(const ns
 void
 KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(aStyleContext);
 
   // Skip updating properties when we are composing style.
   // FIXME: Bug 1324966. Drop this check once we have a function to get
   // nsStyleContext without resolving animating style.
+  MOZ_DIAGNOSTIC_ASSERT(!mIsComposingStyle,
+                        "Should not be called while processing ComposeStyle()");
   if (mIsComposingStyle) {
     return;
   }
 
   nsTArray<AnimationProperty> properties = BuildProperties(aStyleContext);
 
   if (mProperties == properties) {
     return;
@@ -460,16 +462,18 @@ KeyframeEffectReadOnly::EnsureBaseStyles
   }
 }
 
 void
 KeyframeEffectReadOnly::ComposeStyle(
   RefPtr<AnimValuesStyleRule>& aStyleRule,
   const nsCSSPropertyIDSet& aPropertiesToSkip)
 {
+  MOZ_DIAGNOSTIC_ASSERT(!mIsComposingStyle,
+                        "Should not be called recursively");
   if (mIsComposingStyle) {
     return;
   }
 
   AutoRestore<bool> isComposingStyle(mIsComposingStyle);
   mIsComposingStyle = true;
 
   ComputedTiming computedTiming = GetComputedTiming();