Bug 1422248 - Don't reject promises of dispatch cancel events when canceling idle animations; r?hiro
MozReview-Commit-ID: EGg6Ntj0loq
--- 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