Extension misbehaves when there is a pending chrome update

366 views
Skip to first unread message

joette cordsen

unread,
Dec 12, 2022, 8:57:03 AM12/12/22
to Chromium Extensions
I have received reports from users that my extension doesn't work sometimes when they have a pending chrome update. As near as I can tell the content script is not able to communicate with the background script (yes, this is still V2). The solution is always to allow the chrome update to happen. This is a somewhat recent event, and has happened with multiple chrome updates. And it doesn't happen all the time to all people. Has anyone else noticed this? 

Robbi

unread,
Dec 12, 2022, 9:29:33 AM12/12/22
to Chromium Extensions, jill...@gmail.com
I read that you are using MV2.
If you're dealing with a persistent background you can do the magic with the runtime.onUpdateAvailable event.

function handleUpdateAvailable(details) {
    console.log('pending update. Please restart the browser');
    alert('There is a pending update. Please restart the browser');

   
    /*
    //Otherwise you can proceed to upgrade the extenion, but you have to inform the user to refresh the tab(s) in which the content script have been injected
    var msg = `There is a pending update.\n Would you to apply this update now ?\n Keep in mind you have to refresh the tab(s) in which the content script have been injected`;
    if (confirm(msg))
        chrome.runtime.reload();

    */
}
chrome.runtime.onUpdateAvailable.addListener(handleUpdateAvailable)

Robbi

unread,
Dec 12, 2022, 11:03:09 AM12/12/22
to Chromium Extensions, Robbi, jill...@gmail.com
> "the problem comes into play when chrome has a pending update - not my extension. Is there a call to detect a pending chrome update? 

> thx!"

Ok, I read wrong.
I am not sure at 100% but I think that whereas a Chrome update is being automatically downloaded is not being installed during a session without the user consens.
After a browser restart upon a chrome update download, we'll find it updated with the last version.
Thus, until the browser is not manual restarted, we could be sure that the thread between our extension and the content script(s) is not broken.
What I mean is that it seems to me unlikely that the communication between extension and content script will break down when a browser update is pending (downloaded but not installed).
Anyway you can check the browser updating (not its downloading) via runtime.onInstalled and reason property.
I don't think it will help you much though.
See the docs here: link

Best regards

Jackie Han

unread,
Dec 13, 2022, 12:53:15 AM12/13/22
to joette cordsen, Chromium Extensions
I am not familiar with this problem. But if you want to reproduce this issue (then report a bug to the browser), you can use Chrome Canary, because it is updated almost every day.

On Mon, Dec 12, 2022 at 9:57 PM joette cordsen <jill...@gmail.com> wrote:
I have received reports from users that my extension doesn't work sometimes when they have a pending chrome update. As near as I can tell the content script is not able to communicate with the background script (yes, this is still V2). The solution is always to allow the chrome update to happen. This is a somewhat recent event, and has happened with multiple chrome updates. And it doesn't happen all the time to all people. Has anyone else noticed this? 

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/4455a281-3f31-4b0b-9f0d-eacbb20dc142n%40chromium.org.

Ryota KUNISADA

unread,
Dec 13, 2022, 1:36:42 AM12/13/22
to Chromium Extensions, Jackie Han, Chromium Extensions, jill...@gmail.com
Our team started encountering this problem in MV3.
The content_script we were executing via chrome.webNavigation.onDOMContentLoaded.addListener was running.
After that, the content_script that was being executed via chrome.runtime.onMessage.addListener registered from service_worker was not being executed.

This is speculation, but I suspect that the issue of Service Worker randomly failing to start during extension updates, as discussed in the thread below, is also occurring during Chrome updates.


2022年12月13日火曜日 14:53:15 UTC+9 Jackie Han:
Reply all
Reply to author
Forward
0 new messages