1

I have issue with chrome extension in manifest v3. Usually reproduce on MacOS. Before migrating to manifest v3 my app was on manifest v2 and I did't have this problems. Some times app is not reacting on click at icon of list extensions. So I need to reload computer or disabled the app and after turn on it to resolve this problem. In console i have errors: "Could not establish connection. Receiving end does not exist.", "ResizeObserver loop limit exceeded", "Request failed with status code 403". Or without any errors in console. It seems like service worker don't start again or stuck in the loop

    "background": {
    "service_worker": "js/background.js",
    "type": "module"
},
"content_scripts": [{
    "matches": ["<all_urls>"],
    "js": [
        "js/contentscript.js"
    ]
}],

this is code from manifest

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => Promise.resolve()
.then(() => { sendResponse(); })
.then(() => {
    if (message === 'toggle-popup') {
        updateApplicationTab((idTab) => {
            chrome.tabs.sendMessage(idTab, { message: 'clicked_browser_action' });
        });
    }

    if (message === 'toggle-popup_set_id') {
        chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
            chrome.runtime.sendMessage({
                type: 'setActiveTab',
                data: tabs[0].id,
            });
        });
    }

}),
);

this is code from worker to open app

Mykyta
  • 11
  • 1
  • You're not giving us enough information. Two code fragments are not enough to diagnose the problem. Please upload the entire MV3 extension, or a https://stackoverflow.com/help/minimal-reproducible-example , to Github or a similar website. The exact error messages would also be very helpful; you can copy them from the console and paste them into your question. – Thomas Mueller Sep 29 '22 at 15:25
  • It typically happens if your extension was updated or manually reloaded. You need to [re-inject content scripts](https://stackoverflow.com/q/10994324). Another reason, other than a bug in your code that you didn't show yet, is that ManifestV3 is infested with critical bugs like the service worker becoming nonfunctional randomly after an update. – wOxxOm Sep 30 '22 at 19:52

0 Answers0