mozilla/web-ext

Support enable-background-service-worker option

Opened this issue · 7 comments

Is this a feature request or a bug?

Feature request

addons-linter supports the --enable-background-service-worker option on the command line. I would like to see this option supported in the web-ext lint command as well. This option is especially important when developing extensions for multiple browsers.

What is the purpose of running web-ext lint on manifest.json files targeting non-Firefox browsers?

rpl commented

Besides Rob question (which we are still interested in), we agreed that we would be willing to extend the --firefox-prefix option to support this use case (at the moment we enable mv3 addons-linter option by default, and we could add an opt-in one to enable the background service worker support as well).

(...) to extend the --firefox-prefix option

--firefox-preview= option*

Thank you for agreeing to expand the option.

As for why use web-ext lint, in my project, manifest.json and some code are different for Firefox and Chrome (most are the same). In addition to manual checks, web-ext lint can be a useful way to prevent simple mistakes in the manifest and code for each browser.

Firefox 121+ allows now background.server_worker.
See: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support
Also minimum_chrome_version should be allowed in the manifest.json for easier cross browser support

Firefox 121 does not support service_worker. The difference in 121 is that it loads the background script as expected even if the service_worker key is present. This was https://bugzilla.mozilla.org/show_bug.cgi?id=1860304

This is what i mean. Firefox 121 doesn't have a problem now if the service_worker key is there. not that Firefox supports it. So web-ext shouldn't complain about it