mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.67k stars 334 forks source link

Support enable-background-service-worker option #2916

Open Robot-Inventor opened 10 months ago

Robot-Inventor commented 10 months ago

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.

Rob--W commented 10 months ago

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

rpl commented 10 months ago

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).

Rob--W commented 10 months ago

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

--firefox-preview= option*

Robot-Inventor commented 10 months ago

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.

ximex commented 6 months ago

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

Rob--W commented 6 months ago

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

ximex commented 6 months ago

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