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

DedicatedWorkerGlobalScope.requestAnimationFrame - Not supported in nested Web Workers on Chromium #21964

Closed
ArhanChaudhary opened this issue Jan 20, 2024 · 2 comments · Fixed by #24611
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Comments

@ArhanChaudhary
Copy link

What type of issue is this?

Incorrect support data (example: BrowserX says "86" but support was added in "40")

What information was incorrect, unhelpful, or incomplete?

My testing has shown that requestAnimationFrame functionality within nested web workers on Chromium browsers is not yet supported. Chromium browsers should instead be marked as partially compatible with this caveat for now.

What browsers does this problem apply to, if applicable?

Chromium (Chrome, Edge 79+, Opera, Samsung Internet)

What did you expect to see?

The functionality should work in accordance with the compatibility data.

Did you test this? If so, how?

Here is the code snippet I used to test for this functionality:

index.html

<script>
  new Worker('worker1.js').onmessage = (e) => {
    if (e.data === 'worker1 works')
      document.write("first worker raf works<br>");
    else if (e.data === 'worker2 works')
      document.write("nested worker raf works");
  }
</script>

worker1.js

requestAnimationFrame(() => self.postMessage("worker1 works"));
new Worker('worker2.js').onmessage = () => self.postMessage("worker2 works");

worker2.js

requestAnimationFrame(() => postMessage(undefined));

When it fails, it errors:

Uncaught DOMException: Failed to execute 'requestAnimationFrame' on 'DedicatedWorkerGlobalScope': requestAnimationFrame not supported in this Worker.

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

The current compatibility data, the spec, and the MDN page.

Paraphrasing the spec, it mentions that one way requestAnimationFrame is considered supported is if its associated web worker initiator also supports requestAnimationFrame. In the above code snippet on Chromium browsers, the first web worker is always able to run requestAnimationFrame successfully while its nested web worker fails, thus contradicting the spec.

Do you have anything more you want to share?

No response

MDN URL

No response

MDN metadata

No response

@queengooborg queengooborg added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Jan 21, 2024
@skyclouds2001
Copy link
Contributor

skyclouds2001 commented Jan 21, 2024

This is what I'm saying in mdn/content#30880 (comment), and I've fired an issue to Chromium in https://bugs.chromium.org/p/chromium/issues/detail?id=1510413

@ArhanChaudhary
Copy link
Author

Sounds great. The compat tables should still be updated though, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
3 participants