This only happens on iOS on all of the iPhones.
Safari extension works perfectly fine but after few days of inactivity it just stops. I see that content script still injects js that i want but service worker does not wake up.
Here is code that usually works
in content script i call
// wait for service worker to be ready
const response = await browser.runtime.sendMessage({
type: NIGHTLY_SAFARI_WAKE_UP,
randomNumber: randomNumber
})
in background service worker i respond
browser.runtime.onMessage.addListener(function (request, _sender, sendResponse) {
if (request.type === NIGHTLY_SAFARI_WAKE_UP) {
sendResponse(`I'm awake! ${request.randomNumber}`)
}
})
It works perfectly but after some time sendMessage call starts to respond with undefined and service worker does not work at all.