mdn / mdn/browser-compat-data

api.Window.requestAnimationFrame() - Chrome/Safari return `long` instead of `unsigned long`

Open
#25,807 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

browser:multiple data:api p4
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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.