mozilla / web-ext

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

web-ext run should encourage background.scripts when only background.service_worker is present #3101

Open Rob--W opened 3 months ago

Rob--W commented 3 months ago

MV3 extensions originally developed for Chrome often use the service_worker key. Firefox does not support background.service_worker yet, and the lack of support for that is often a surprise (e.g. https://github.com/mozilla/web-ext/issues/3045).

Firefox 121+ and Chrome 121+ support specifying service_worker and scripts in the background key at once, mentioned at https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/121#changes_for_add-on_developers and documented at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/background#browser_support

Chrome 121 was released in January 2024, Firefox 121 was released in December 2023. This has been long enough for general recommendations to specify scripts and service_worker to make sense. We should detect when a manifest contains background.service_worker without background.page or background.scripts, and recommend the addition of scripts (with a link to documentation) to improve the developer experience.