WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
283107
[scroll-animations] scroll-animations/scroll-timelines/updating-the-finished-state.html times out
https://bugs.webkit.org/show_bug.cgi?id=283107
Summary
[scroll-animations] scroll-animations/scroll-timelines/updating-the-finished-...
Antoine Quint
Reported
2024-11-14 05:41:08 PST
The WPT test scroll-animations/scroll-timelines/updating-the-finished-state.html times out. The specific subtest that times out is "Animation finish event is fired again after replaying from start". If run in isolation, it completes fine, but when paired with other tests, it does not. I've noticed in particular that running just the "Updating the finished state when start time is unresolved and did seek = true" subtest in addition reproduces the timeout. That other subtest can really be reduced to just calling `await waitForNextFrame()`. What happens is that wrapping `requestAnimationFrame` in a promise, which is what it does, means that we will schedule a microtask during the next page rendering update to resolve the promise. As it turns out, this is the same page rendering update during which `AnimationTimelinesController::updateAnimationAndSendEvents()` is called and the first `finish` event is enqueued in the subtest that times out. The behavioral difference that I can see is that the event dispatch happens in the microtask mentioned above, whereas in the case where there is no promise involved, the event dispatch happens later, after about 100ms. I'm not sure if that the source of the issue, but just changing from a promise to a simple callback for `requestAnimationFrame` makes the timeout disappear.
Attachments
Add attachment
proposed patch, testcase, etc.
Antoine Quint
Comment 1
2024-11-14 06:10:25 PST
What I wrote isn't quite right. The event dispatch doesn't happen immediately after the completion of `updateAnimationAndSendEvents()`. In the working case, the event dispatch occurs between two calls to `updateAnimationAndSendEvents()`. In the timeout case, the event dispatch occurs during the second call to `updateAnimationAndSendEvents()`.
Antoine Quint
Comment 2
2024-11-14 07:27:39 PST
So since we're dispatching the `finish` event while we're under the second call to `updateAnimationsAndSendEvents()`, we never get to a state where `updateFinishedState()` is called with a play state of "running". But here's another relevant tidbit: it's not just about using a promise to wrap the call to `requestAnimationFrame()`, it turns out that the function used, `waitForNextFrame()`, queries `document.timeline.currentTime` which creates a DocumentTimeline for this document and changes how we enqueue the `finish` event. Indeed, if the `DocumentTimeline` is _not_ created, then we enqueue the event using `queueTaskToDispatchEvent()`. Otherwise, we enqueue the event and dispatches it when `updateAnimationAndSendEvents()` is called. We should eliminate this behavior by always using the DocumentTimeline, even if it wasn't already created. This does not solve our issue, but I believe this will make the behavior identical in both the scenarios described.
Radar WebKit Bug Importer
Comment 3
2024-11-21 05:42:13 PST
<
rdar://problem/140340957
>
Antoine Quint
Comment 4
2024-11-25 06:52:44 PST
I'm not sure why we're failing this test, filed a spec issue to get to the bottom of it:
https://github.com/w3c/csswg-drafts/issues/11270
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug