Bug 277588
| Summary: | iOS Web Extension service worker fails to load unless I delay all JS via setTimeout | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | @fregante <bugs> |
| Component: | Service Workers | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Critical | CC: | bfulgham, timothy, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 17 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 17 | ||
@fregante
In the latest version of Refined GitHub on the App Store, currently v24.7.10, the service worker fails to load: https://apps.apple.com/us/app/refined-github/id1519867270
- This only happens on iOS, including the simulator
- There are no syntax errors or uncaught errors in the code
- The same file works when loaded via `background.scripts` instead of `background.service_worker`
- It's impossible to debug because the "Service worker" does not appear in Safari's Develop -> MyDevice list
- It seems to occasionally run on my iPhone, e.g. it responds to action.onClicked, but rarely, and it never responds to runtime.sendMessage.
Most importantly:
- The same file works if I wrap the entire background.js contents in `setTimeout(() => {/*contents*/}, 1000)`
Versions:
- iOS 17.5 and 17.6 iPhone 15 Pro Max Simulator
Questions:
- If you'd like me to attach a repro, would .xcarchive be enough?
- How can I debug service worker failures on iOS? It seems impossible because "Automatically Show Web Inspector for JSContexts" does not work for other devices
Repro:
- GitHub repo with the extension: https://github.com/refined-github/refined-github/tree/24.7.10
- It needs Node 21+, `npm install && npm run build`. The Xcode project is in /safari
References:
- https://github.com/refined-github/refined-github/issues/7590
- https://github.com/refined-github/refined-github/issues/7629
Workarounds:
- I'll have to ship `background.scripts` until this is resolved
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/133593437>
@fregante
Some updates:
- It has been working recently, maybe thanks to iOS 17.6.1. I have not checked the Simulator though
- Version 24.8.20 has been released on the App Store and it was reverted to a background script anyway
If you need a build of the service worker version let me know.
Overall I wish there was *any* way to debug these issues. I don't know if the service worker can be debugged at all in extensions, if it fails on launch.
Brent Fulgham
This was actually resolved in:
<rdar://126825362>
Brent Fulgham
*** This bug has been marked as a duplicate of bug 274331 ***