Make toolbar icon changes compatible with service worker

Background / User story

Manifest v3 forces us to run our background scripts in a service worker, which can be suspended/terminated at any time. Therefore we have to make sure that we add all event listeners synchronously, or they may not be called when the service worker activates.

Potential breakage:

  • Icon changes not applied (incl. when switching tabs during ongoing icon animation).

What to change

  • Design: N/A
  • Research: N/A
  • Spec: N/A
  • Legal: N/A
  • Development: Adjust code to add all event listeners synchronously:
    • browser.*.addListener()
      • lib/browserAction: setBadge()/setIconImageData()/setIconPath()/toggleBadge()
        • tabs.onReplaced
          fallback for prerendered tabs

Hints for testers

See list of potential breakage under "Background".

Hints for translators

N/A

Further information

See also ui#1070 for information on which code is run on service worker activation.

Edited by Thomas Greiner
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information