I've recently ported my chrome extension to safari using the safari web extension converter: https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari.
However, I'm finding that my setInterval calls only executed a set number of times in the background page. When I open the background page for my web extension, I've tried running a simple interval to see the result:
Safari Web Extension Background Page with interval stuck after running set number of times
When I try the same thing for my chrome web extension, the interval runs indefinitely:
Chrome Web Extension Background Page with interval running continuously
If I try to run the interval after opening the dev console for any random web page in Safari, the interval works fine:
Safari content page with interval running continuously
Similarly, a recursive setTimeout function fails in the background page for the web extension:
Recursive setTimeout function in my background page Result of recursive set timeout function in my background page (stops afterwards)
I'm not sure why timers might be failing in background page for Safari. My extension works perfectly fine in chrome/brave/firefox. Thanks!