A minimal-reproducible example of a Safari Web Extension bug I've run into where the non-persistant background script seems to crash after 30 seconds even when the content script is messaging it. Apple Developer Forums Post
- Clone this repo
- Open in Xcode and run targeting a physical device
- Open Safari on the device and enable the extension
- Open a new tab and navigate to
https://www.google.com
- From your Mac, open the Safari Web Inspector and navigate to the extension's background page
- You will see messages being sent from the content script to the background script every 1 second
- After 30 seconds, the background script will stop receiving messages. Trying to use the console to interact with the background script, e.g., typing
console.log("hello")
will show that it is no longer responsive.
- This issue does not occur when running the extension in the simulator