lapcat / SafariExtensions

Resources for the development of Safari extensions
42 stars 3 forks source link

Service worker fails to load after disabling and re-enabling the extension #39

Open g-sam opened 1 year ago

g-sam commented 1 year ago

In my Manifest v3 extension, rapidly unticking and re-ticking the checkbox to disable/re-enable the extension causes a permanent failure to load the service worker.

I was able to stop this happening by removing my onInstalled handler. Reducing the number of async functions in this handler made it less likely to occur. I'd speculate the crash occurs when the extension is disabled before that handler has finished running.

When the handler included calls to browser.storage.local I would occasionally see the following error message logged by the service worker:

Unhandled Promise Rejection: Error: disk I/O error: disk I/O error: SELECT SUM(LENGTH(key) + LENGTH(value)) FROM extension_storage

Tested with Safari 16.4, 17 Beta, MacOS Ventura

xeenon commented 6 months ago

Is this any better in Safari Technology Preview 192?