[Webkit-unassigned] [Bug 277588] New: iOS Web Extension service worker fails to load unless I delay all JS via setTimeout

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Aug 3 03:11:05 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=277588

            Bug ID: 277588
           Summary: iOS Web Extension service worker fails to load unless
                    I delay all JS via setTimeout
           Product: WebKit
           Version: Safari 17
          Hardware: iPhone / iPad
                OS: iOS 17
            Status: NEW
          Severity: Critical
          Priority: P2
         Component: Service Workers
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bugs at bfred.it
                CC: youennf at gmail.com

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240803/35012f30/attachment.htm>


More information about the webkit-unassigned mailing list