Open larry-xu opened 2 years ago
Please note that this is not really applicable to Firefox yet, since Firefox does not support service worker backgrounds yet. I'm not sure how Safari handles this case.
Safari does not have a fixed timeout for service workers or background pages. As long as there is activity (events, messages, etc) the service worker will stay alive.
Firefox has the same approach to Safari, as long as extension has any activity, the native messaging connection would stay alive.
Chrome recently added support for service workers to run beyond the default 5 minute timeout if there is an open native messaging connection. See https://bugs.chromium.org/p/chromium/issues/detail?id=1189678
This is useful for extensions to receive messages from a connected native messaging host at any time. Otherwise, if the service worker terminates, then the connection is lost, and the native messaging host cannot send messages to the extension.
Can we standardize this functionality in MV3, so that it can be adopted by Firefox and Safari? And would this behavior differ at all between service workers and event pages?