api.Window.requestAnimationFrame() - Chrome/Safari return `long` instead of `unsigned long`
Nobody has claimed this yet.
- Dominant language
- JSON
- Stars
- 5.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 186
Description
What type of issue is this?
Browser bug (a bug with a feature that may impact site compatibility)
What information was incorrect, unhelpful, or incomplete?
Both Chromium and Webkit use a int (long) instead of unsigned long for the requestAnimationFrame() request ID.
This means it can be negative on overflow.
What browsers does this problem apply to, if applicable?
Chromium (Chrome, Edge 79+, Opera, Samsung Internet), Safari, Firefox
What did you expect to see?
As per spec, the request ID should be unsigned.
Did you test this? If so, how?
Not fully, using Edge, I estimate the following loop to take ~1.5 hours to finish running and trigger the issue on my PC.
I would run for(let i = 0;i<2147483647;i++) { cancelAnimationFrame(requestAnimationFrame(() => {})); } then console.log(requestAnimationFrame(() => {}));.
Can you link to any release notes, bugs, pull requests, or MDN pages related to this?
MDN source:
https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame
MDN PR mentionning the issue:
https://github.com/mdn/content/pull/37856
Links to WebKit source:
- https://github.com/WebKit/WebKit/blob/6355462b3a9548b4d9df5a39afc5b4b923b57c95/Source/WebCore/dom/ScriptedAnimationController.h#L66
- https://github.com/WebKit/WebKit/blob/6355462b3a9548b4d9df5a39afc5b4b923b57c95/Source/WebCore/dom/ScriptedAnimationController.cpp#L108
Link to the same issue in Blink (since based on Webkit):
Note that firefox (merged in july 2024) only recently fixed the issue:
And it gives an error instead of overflowing https://phabricator.services.mozilla.com/rMOZILLACENTRAL149722297f033d5c3ad126d0c72edcb1cb96d72e
https://searchfox.org/mozilla-central/source/dom/base/RequestCallbackManager.h#43
Do you have anything more you want to share?
No response
MDN URL
No response
MDN metadata
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's MDN requestAnimationFrame page and the linked WebKit, Blink, and Firefox sources to verify the reported return-type behavior. Then inspect the relevant browser-compat-data entry, if identified, and determine whether verified compatibility data needs updating; done requires a decided scope and confirmation from current browser behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100