SafariExtensions icon indicating copy to clipboard operation
SafariExtensions copied to clipboard

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

Open g-sam opened this issue 10 months ago • 1 comments

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

g-sam avatar Aug 29 '23 09:08 g-sam