Skip to content

improve clearTimeout and clearInterval compatibility #3908

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

Merged
merged 1 commit into from
Apr 8, 2025

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Apr 8, 2025

Browsers do not throw an error when passed NaN value to clearTimeout and clearInterval. On workerd, this throws an error under UBsan builds.

src/workerd/io/_virtual_includes/io-helpers/workerd/io/io-timers.h:30:32: runtime error: nan is outside the range of representable values of type 'unsigned long'

This fixes this issue.

@anonrig anonrig requested review from jasnell and kentonv April 8, 2025 16:53
@anonrig anonrig requested review from a team as code owners April 8, 2025 16:53
@anonrig anonrig requested a review from danlapid April 8, 2025 16:54
@anonrig anonrig force-pushed the yagiz/fix-settimeout branch 3 times, most recently from 1137908 to a5fe4c8 Compare April 8, 2025 19:22
@anonrig anonrig requested a review from jasnell April 8, 2025 19:30
@anonrig anonrig force-pushed the yagiz/fix-settimeout branch from a5fe4c8 to c09d373 Compare April 8, 2025 19:31
Copy link
Member

@npaun npaun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anonrig anonrig force-pushed the yagiz/fix-settimeout branch from c09d373 to b784ede Compare April 8, 2025 20:12
@anonrig anonrig force-pushed the yagiz/fix-settimeout branch from b784ede to 33a10f4 Compare April 8, 2025 20:24
@anonrig anonrig requested a review from jasnell April 8, 2025 20:28
@anonrig anonrig force-pushed the yagiz/fix-settimeout branch from 33a10f4 to 7e81ccd Compare April 8, 2025 20:42
Copy link
Collaborator

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as the type generation looks good with the switch to using JsNumber (I honestly can't remember if that was ever updated since I don't know if anything is actually using JsNumber yet)

@anonrig anonrig merged commit 718f286 into main Apr 8, 2025
17 of 18 checks passed
@anonrig anonrig deleted the yagiz/fix-settimeout branch April 8, 2025 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants