-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Remove a setTimeout
's entry in the map of active timers after it runs
#7377
Conversation
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.
Now that I think about it, if |
I think this works, but I also think the current setup is broken in other ways. It works for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good to me. Regarding @annevk's comment, it doesn't feel like the current setup is broken, but instead that we'd have to add more complications to it if we want to allow more complicated caller patterns in the future?
This PR wasn't editorial, and I was planning on writing tests for it (and seeing if any browser engine bugs needed to be filed) tomorrow. |
Oh, I'm so sorry about that! I was thinking of it as a bugfix to bd63843, but I agree that probably this case wasn't covered in the tests for that commit, so it would have been better to wait. |
@domenic yeah I guess that can work. I was thinking that might allow consolidation of the removal after the completion steps have run. I guess as long as we don't have too many callers of the algorithm it doesn't really matter. |
Tests are at web-platform-tests/wpt#31853 |
…ired timer is non-negative, a=testonly Automatic update from web-platform-tests Test that the idle deadline after an expired timer is non-negative (#31853) Tests for whatwg/html#7377. -- wpt-commits: 19f704c5e32a9a6ad4f1542e2228e5d0b6d727b6 wpt-pr: 31853
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.
requestIdleCallback()
yet.(See WHATWG Working Mode: Changes for more details.)
/timers-and-user-prompts.html ( diff )