Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-cancelled setTimeouts would lead to idle deadlines in the past #7376

Closed
andreubotella opened this issue Nov 29, 2021 · 1 comment · Fixed by #7377
Closed

Non-cancelled setTimeouts would lead to idle deadlines in the past #7376

andreubotella opened this issue Nov 29, 2021 · 1 comment · Fixed by #7377

Comments

@andreubotella
Copy link
Member

Before #7166, there was no way to observe whether a setTimeout() timer's ID is in the list of active timers after the timer callback has been run, and so the timer task does not remove that ID from the list. However, that PR made the list of active timers into a map of active timers that is used to determine the idle deadline to use for the requestIdleCallback() API, and such timer ID's would result in the computed deadline being in the past if any setTimeout() timer was started and its callback was run.

@domenic
Copy link
Member

domenic commented Nov 29, 2021

Good catch, thanks. Would you like to submit a PR removing the map entry?

andreubotella pushed a commit to andreubotella/html that referenced this issue Nov 29, 2021
It used to be unobservable whether a non-repeating timer that had
already run its callback had an entry in the list of active timers or
not, and so those entries were never removed from the list. However,
calculation of the idle deadline, meaning that if a timer expires and is
never cancelled, the deadline will be in the past.

This change avoids this case by removing non-repeating timers from the
map of active timers after their callback runs.

Closes whatwg#7376.
domenic pushed a commit that referenced this issue Nov 30, 2021
It used to be unobservable whether a non-repeating timer that had already run its callback had an entry in the list of active timers or not, and so those entries were never removed from the list. However, calculation of the idle deadline, meaning that if a timer expires and is never cancelled, the deadline will be in the past.

This change avoids this case by removing non-repeating timers from the map of active timers after their callback runs.

Closes #7376.
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
It used to be unobservable whether a non-repeating timer that had already run its callback had an entry in the list of active timers or not, and so those entries were never removed from the list. However, calculation of the idle deadline, meaning that if a timer expires and is never cancelled, the deadline will be in the past.

This change avoids this case by removing non-repeating timers from the map of active timers after their callback runs.

Closes whatwg#7376.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants