Content script to background service worker message delivery after Firefox idle termination
0 reputation · 25 Nov 2020, 22:11 UTC
Goal
Determine whether a Firefox Manifest V3 extension can rely on browser.runtime.sendMessage from a content script to reach a background service worker after Firefox terminates that worker for idleness.
Constraints and uncertainty
Manifest V3 service workers are ephemeral, and Firefox may stop them when idle. The WebExtensions API does not expose a method to keep a worker alive or to guarantee that messages sent during termination are queued and replayed after restart. runtime.connect ports emit onDisconnect when the counterparty is gone, but that event does not indicate whether termination is temporary or permanent. Behavior may differ across Firefox Desktop, Firefox for Android, and release channels, and the stable API contract does not specify pending-message handling during worker restart.
Questions
- Does Firefox queue
runtime.sendMessagepayloads destined for a terminated service worker and deliver them after the worker restarts? - If delivery is not guaranteed, what interoperability boundary should separate content-script messaging from background state persistence?
- Does the queuing behavior differ between Firefox stable, beta, and nightly channels?