Bug 290772

Summary: [web-animations] animation events do not get fired if relevant event listeners are added dynamically after they are enqueued
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, karlcow, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/51828
Bug Depends on: 290836    
Bug Blocks: 290993    
Attachments:
Description Flags
Test none

Antoine Quint
Reported 2025-03-31 10:37:32 PDT
Created attachment 474773 [details] Test The attached test case adds `finish` and `cancel` events after a `finished` promise has resolved and the `cancel()` method was called on the finished animation. Due to the asynchronous nature of animation events, which are first enqueued and later dispatched in one batch, and our optimization where only events with registered event listeners are enqueued (see 262123@main), we fail to dispatch the expected events. This also affects Chrome, though I'm not sure this is for the same reason.
Attachments
Test (1.91 KB, text/html)
2025-03-31 10:37 PDT, Antoine Quint
no flags
Antoine Quint
Comment 1 2025-03-31 10:42:45 PDT
Filed a similar bug on Chrome: https://issues.chromium.org/issues/407497938. This works as expected in Firefox.
Antoine Quint
Comment 2 2025-04-03 05:45:26 PDT
Antoine Quint
Comment 3 2025-04-03 05:45:52 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/51828
Antoine Quint
Comment 4 2025-04-03 22:34:37 PDT
*** Bug 290836 has been marked as a duplicate of this bug. ***
EWS
Comment 5 2025-04-03 22:37:29 PDT
Committed 293217@main (fdfe5c907393): <https://commits.webkit.org/293217@main> Reviewed commits have been landed. Closing PR #43536 and removing active labels.
Radar WebKit Bug Importer
Comment 6 2025-04-03 22:38:17 PDT
Note You need to log in before you can comment on or make changes to this bug.