Bug 1422248 - Don't reject promises of dispatch cancel events when canceling idle animations; r=hiro
authorBrian Birtles <birtles@gmail.com>
Thu, 14 Dec 2017 17:15:28 -0600
changeset 448315 03045ec2b4f680eb9b93d761ddb91ca20af42379
parent 448314 884067088663cb3d2ef54ab1c9642aad83eb095f
child 448316 dffc508ff053ba2a7ac93aa078f5d5448c2380fe
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1422248
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1422248 - Don't reject promises of dispatch cancel events when canceling idle animations; r=hiro MozReview-Commit-ID: EGg6Ntj0loq
dom/animation/Animation.cpp
testing/web-platform/meta/web-animations/timing-model/animations/canceling-an-animation.html.ini
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -781,24 +781,26 @@ Animation::SilentlySetPlaybackRate(doubl
     SilentlySetCurrentTime(previousTime.Value());
   }
 }
 
 // https://w3c.github.io/web-animations/#cancel-an-animation
 void
 Animation::CancelNoUpdate()
 {
-  ResetPendingTasks();
+  if (PlayState() != AnimationPlayState::Idle) {
+    ResetPendingTasks();
 
-  if (mFinished) {
-    mFinished->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
+    if (mFinished) {
+      mFinished->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
+    }
+    ResetFinishedPromise();
+
+    DispatchPlaybackEvent(NS_LITERAL_STRING("cancel"));
   }
-  ResetFinishedPromise();
-
-  DispatchPlaybackEvent(NS_LITERAL_STRING("cancel"));
 
   StickyTimeDuration activeTime = mEffect
                                   ? mEffect->GetComputedTiming().mActiveTime
                                   : StickyTimeDuration();
 
   mHoldTime.SetNull();
   mStartTime.SetNull();
 
deleted file mode 100644
--- a/testing/web-platform/meta/web-animations/timing-model/animations/canceling-an-animation.html.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[canceling-an-animation.html]
-  type: testharness
-  [The finished promise should NOT be rejected if the animation is already idle]
-    expected: FAIL
-
-  [The cancel event should NOT be fired if the animation is already idle]
-    expected: FAIL