Closed Bug 2092827 Opened 16 days ago Closed 12 days ago

[wpt-sync] Sync PR 64635 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=326641

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64635 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64635
Details from upstream follow.

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=326641

WebKit export from bug: requestIdleCallback callbacks stop running after removing a same-<!---->origin iframe that had a pending setTimeout

<pre>
requestIdleCallback callbacks stop running after removing a same-origin iframe that had a pending setTimeout

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

EventLoopTaskGroup::markAsReadyToStop() stops the group's timers, which clears each
timer's task. Once that happens, EventLoopTimer::group() returns null, so when the
owner later drops its EventLoopTimerHandle, the handle's destructor never calls
removeScheduledTimer(). That call is the only thing that clears
EventLoop::m_nextTimerFireTimeCache. The timer is destroyed and quietly drops out of
the event loop's weak timer sets, but the cache keeps its old fire time.

Same-origin frames share a WindowEventLoop. When an iframe with a pending setTimeout
is removed, the parent's event loop keeps reporting the dead timer's fire time. After
that time passes, WindowEventLoop::opportunisticallyRunIdleCallbacks() always sees
work due immediately, so it keeps re-arming the idle timer and never starts an idle
period. Idle callbacks without a timeout never run until some other timer is
scheduled in that event loop.

Also, EventLoop::nextTimerFireTime() did not skip stopped timers. A stopped TimerBase
reports a fire time of 0, so any stopped timer that was still referenced made it look
as if timer work was already overdue.

Fix both: clear the fire-time cache after markAsReadyToStop() stops the group's
timers, and ignore inactive timers when computing the next fire time.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=326641">https://bugs.webkit.org/show_bug.cgi?id=326641</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/323148@main">https://commits.webkit.org/323148@main</a>
</pre>

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests and 1 subtests

Status Summary

Firefox

OK : 1
PASS: 1

Chrome

OK : 1
PASS: 1

Safari

OK : 1
FAIL: 1

Links

GitHub PR Head
GitHub PR Base

Status: NEW → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.