Closed Bug 2057814 Opened 27 days ago Closed 25 days ago

mIsSorted has incorrect/inverted polarity condition in AnimationEventDispatcher

Categories

(Core :: DOM: Animation, defect)

defect

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- wontfix
firefox-esr153 --- wontfix
firefox153 --- wontfix
firefox154 --- wontfix
firefox155 --- fixed

People

(Reporter: mayankleoboy1, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Found via Claude :

AnimationEventDispatcher.cpp:111:

const bool wasEmpty = mPendingEvents.IsEmpty();
mPendingEvents.AppendElement(std::move(aEvent));
mIsSorted = !wasEmpty;

The polarity is inverted. Appending to an empty queue yields one element, which is trivially sorted; appending to a non-empty queue is exactly when order can break. It should be mIsSorted = wasEmpty;.

Since SortEvents early-returns on mIsSorted, QueueEvents (plural, correctly sets false) followed by QueueEvent (singular) marks the whole array sorted and skips the sort — so CSS events never get ordered against the appended playback event, even though Compare requires Web Animations events to precede CSS events at equal timestamps. Introduced by da2ca6b75df5 (Bug 1958970), which also made ScheduleDispatch() conditional on wasEmpty; the sortedness line looks like collateral of that edit. Only caller is Animation::QueuePlaybackEvent, so it's confined to onfinish/oncancel/onremove.

I'd want a WPT that queues a playback event after CSS events in one tick to confirm it's observable before filing — want me to write that test, or file the bug first?

Set release status flags based on info from the regressing bug 1958970

:emilio, since you are the author of the regressor, bug 1958970, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Assignee: nobody → emilio
Status: NEW → ASSIGNED

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61541 for changes under testing/web-platform/tests

Status: ASSIGNED → RESOLVED
Closed: 25 days ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch

The patch landed in nightly and beta is affected, along with ESR.
:emilio, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

Upstream PR merged by moz-wptsync-bot

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: