Blank newtab as service_worker is inactive on extension update

201 views
Skip to first unread message

Lobanov Ivan

unread,
Oct 15, 2024, 1:33:24 PM10/15/24
to Chromium Extensions
Hello, I've got another problem with MV3 extensions. My extension replaces newtab page.

The problem: during the extension update, sometimes the service worker can become inactive, and new tab page that are dependent on the serviceworker become unresponsive.

The steps to reproduce the problem:
1. Completely close the browser, no extension is installed
2. Open the browser, install v3 extension with the lowest version (3.0)
3. Open ntp page, open devtools on this page
4. Go back to chrome://extensions
5. Drop extension of version 3.1 to update it locally
6. At chrome://extensions, the status of service_worker is inactive
(Sometimes this status do not changes even on extension reload).

I added 3.0 and 3.1 versions of minimal examples of the extension
(In case nothing has been uploaded I am also sharing a link to my google drive: https://drive.google.com/drive/folders/1vQyHLFvQr99locULEYFq8HU-nBwqAaoW?usp=sharing)

The main problem is, that when migrating an extension from MV2 to MV3, there are feedbacks from users report blank pages. I suspect that this might be because of the same problem. The exact cause is error to reproduce, this is the only example I have managed to achieve so far.

Mitchell

unread,
Oct 15, 2024, 6:53:31 PM10/15/24
to Chromium Extensions, Lobanov Ivan
Have you opened a bug on chromiums issue tracker yet? https://issues.chromium.org/issues. Our company has had quite a few issues with MV3 but they need to get added to get more visibility on them.

kg_17

unread,
Oct 16, 2024, 1:52:33 AM10/16/24
to Chromium Extensions, Mitchell, Lobanov Ivan
You can't rely on the chrome://extensions page to always accurately display whether a service worker is active or inactive.  I don't think its every been completely reliable,  unless it's right after the page is reloaded.  Of course, in some cases, reloading the page may restart a stopped service worker.    

With your example extension, I updated to the newest version and got it to show as inactive in chrome://extensions (this can sometimes be very hard to reproduce).  However, there was a stop button showing in the chrome://serviceworker-internals/ under the service worker, signifying it was active.  I then reloaded the chrome://extensions page and the service worker showed as active.

This is not to imply your main extension doesn't become inactive after an update, just possibly not in this example you provided.

woxxom

unread,
Oct 16, 2024, 3:15:31 AM10/16/24
to Chromium Extensions, kg_17, Mitchell, Lobanov Ivan
The service worker implementation in ManifestV3 is still bugged, especially during the internal registration on update, but apparently Google considers it acceptable to ignore the small percentage of affected users and disable the more reliable MV2 extension platform even though there's no guarantee this bug will be fixed within foreseeable future if at all.

Things to try:

1. add the following in the background script:

self.oninstall = () => skipWaiting();
self.onactivate = () => clients.claim();

2. Don't use importScripts, put everything in the main SW script.
3. Remove the background script altogether.
Reply all
Reply to author
Forward
0 new messages