Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

requestAnimationFrame is not defined in web-worker in Firefox?

I can’t find any information why Firefox v91.10.0esr on Windows 10 complains that requestAnimationFrame is not defined:

const worker = new Worker(
               URL.createObjectURL(
               new Blob(
                  ["requestAnimationFrame(() => this.postMessage('requestAnimationFrame in web-worker process'))"]
                  , { type: "text/javascript" })));

worker.addEventListener("message", e =>
{
  console.log(e.data);
});


requestAnimationFrame(() => console.log("requestAnimationFrame in main process"));
19:09:53.100 ReferenceError: requestAnimationFrame is not defined 569ddce0-b6c3-47c9-88b4-89d59445b335:1:1
    <anonymous> blob:null/569ddce0-b6c3-47c9-88b4-89d59445b335:1

It works fine on Android Firefox and other browsers (Edge, Chrome).

Any ideas?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Firefox added support for requestAnimationFrame and cancelAnimationFrame in workers with v97 as you can see on this issue. Comment 17 and 18 just confirm it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading