Bug 1353987 - Clear ready promise when animation is canceled. r?birtles
According to the spec, when we cancel an animation we should "reset an
animation's pending tasks"[1] which has following step:
...
4. Reject animation’s current ready promise with a DOMException named "AbortError".
5. Let animation’s current ready promise be the result of creating a new resolved Promise object.
Since we create the ready promise and, if need resolve it when we create it
(see Animation::GetReady), this patch simply clear the ready promise
when an animation is canceled.
[1] https://w3c.github.io/web-animations/#reset-an-animations-pending-tasks
MozReview-Commit-ID: JxoqeA5dXCO
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1361,16 +1361,17 @@ Animation::ResetPendingTasks()
{
if (mPendingState == PendingState::NotPending) {
return;
}
CancelPendingTasks();
if (mReady) {
mReady->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
+ mReady = nullptr;
}
}
bool
Animation::IsPossiblyOrphanedPendingAnimation() const
{
// Check if we are pending but might never start because we are not being
// tracked.
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -220234,17 +220234,17 @@
"5ef1183a4d3e12ad3edfe678c9fa002e7edce888",
"support"
],
"web-animations/resources/keyframe-utils.js": [
"ff5700466b5af6ffaad824437d6566003a22e25b",
"support"
],
"web-animations/testcommon.js": [
- "b12f7087f2adec5ce2a2b8e07be2f24d68aa9df2",
+ "d057ad66c4561ef32f83770e4948f2019da89d48",
"support"
],
"web-animations/timing-model/animation-effects/active-time.html": [
"42eb1a23e89ae60ccd0a3664a9a583df1eb30d49",
"testharness"
],
"web-animations/timing-model/animation-effects/current-iteration.html": [
"b08a35ae832ce33da7fe7fee22e589a6b85a6353",
deleted file mode 100644
--- a/testing/web-platform/meta/web-animations/timing-model/animations/canceling-an-animation.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[canceling-an-animation.html]
- type: testharness
- [The ready promise should be replaced when the animation is canceled]
- expected: FAIL
-