NEW263113
browser.runtime.sendMessage not invoking service worker after Safari idle
https://bugs.webkit.org/show_bug.cgi?id=263113
Summary browser.runtime.sendMessage not invoking service worker after Safari idle
chu-vevo
Reported 2023-10-13 03:32:01 PDT
Some info about the extension: manifest_version: 3, background: { service_worker: ..., type: 'module', persistent: false, }, Our extension inject a button into the page which triger a call in service worker. Then the service worker returns the result with a port. Then the result is shown on the page. The issue happens like this: 1. Open a web page and see the button injected 2. Switch to other pages, back to home screen 3. Use some other apps for some time and lock/unlock the iPhone several times 4. Return to Safari and the original webpage with button 5. Click the button, nothing happens The content script make a browser.runtime.sendMessage() after the user click the button. An event listener in service worker listen to this call, call the API, and relay the data to content script using a port. After made some console.log calls, I can confirm that browser.runtime.sendMessage() did not fail or throw, which makes the content script believe the service worker is working. But the service worker is never brought up. I cannot see the service worker thread in macOS Safari developer menu. What made this even worse is that the service worker cannot be broought up ever once this happend once. No even restart Safari could solve this issue. Which means the only way to make the extension working again is uninstall/reinstall the iOS app. That's why I considered this is a Blocker level issue.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-10-13 03:32:11 PDT
Note You need to log in before you can comment on or make changes to this bug.