Skip to content

Commit 8f6d21c

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Fix mIsSorted assignment in AnimationEventDispatcher.
Differential Revision: https://phabricator.services.mozilla.com/D314257 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2057814 gecko-commit: 828e40fbe027dd492f7e7aafe39ca4b0628e89d9 gecko-reviewers: birtles
1 parent 688f174 commit 8f6d21c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

web-animations/timing-model/timelines/update-and-send-events.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,29 @@
9797
'order');
9898
}, 'Sorts finish events by composite order');
9999

100+
promise_test(async t => {
101+
const div = createDiv(t);
102+
103+
// animA comes first in composite order but is scheduled to finish after
104+
// animB, so the events have to be re-sorted by scheduled event time.
105+
const animA = div.animate(null, 100 * MS_PER_SEC);
106+
const animB = div.animate(null, 100 * MS_PER_SEC);
107+
108+
const receivedEvents = [];
109+
animA.onfinish = () => receivedEvents.push('animA');
110+
animB.onfinish = () => receivedEvents.push('animB');
111+
112+
await Promise.all([animA.ready, animB.ready]);
113+
114+
animA.currentTime = 100 * MS_PER_SEC - 2;
115+
animB.currentTime = 100 * MS_PER_SEC - 1;
116+
117+
await waitForAnimationFrames(2);
118+
119+
assert_array_equals(receivedEvents, [ 'animB', 'animA' ],
120+
'finish events should be sorted by scheduled event time');
121+
}, 'Sorts finish events by scheduled event time');
122+
100123
promise_test(async t => {
101124
createStyle(t, { '@keyframes anim': '' });
102125
const div = createDiv(t);

0 commit comments

Comments
 (0)