1 year ago

#367643

test-img

Jonathan R

Chrome Extension Service Worker inactive after "Clear site data"

I have a very simple background script in my manifest v3 extension that basically waits for messages and then retrieves a value from sync storage like so:

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
  chrome.storage.sync.get("value", ({ value }) => {
    ... do some stuff
  }
}

Now this works fine until i goto the DevTools of my extension -> Application -> Storage -> Clear site data.

After that my service worker is always "inactive" and does not become active when I send messages to it. Only when I go to chrome://extensions and disable/enable the extension the service worker starts functioning again.

The weirdest thing is that my popup.js can actually still get the value from sync storage. How is that possible after I clear the site data?

google-chrome

google-chrome-extension

service-worker

chrome-extension-manifest-v3

0 Answers

Your Answer

Accepted video resources