Is it an expected behaviour for a serviceworker to not respond to or wake up when a message has been sent from a content script or popup. And if so , how do I wake a service worker to perform a task. I dont require a persistent SW, I just want it to run a certain function when I sent a message from a contentscript and after completion , it can go back to sleep again until it receives another message.
Background.js
chrome.runtime.onMessage.addListener(async function (request, sender, sendResponse) {
if(request.message === 'hello'){
clearCookies();
}
});
ContentScript
chrome.runtime.sendMessage({ message: "hello" });