Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support enable-background-service-worker option #2916

Open
Robot-Inventor opened this issue Oct 17, 2023 · 9 comments
Open

Support enable-background-service-worker option #2916

Robot-Inventor opened this issue Oct 17, 2023 · 9 comments

Comments

@Robot-Inventor
Copy link

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
Copy link
Member

Rob--W commented Oct 26, 2023

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

@rpl
Copy link
Member

rpl commented Oct 26, 2023

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
Copy link
Member

Rob--W commented Oct 26, 2023

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

--firefox-preview= option*

@Robot-Inventor
Copy link
Author

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
Copy link

ximex commented Mar 5, 2024

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
Copy link
Member

Rob--W commented Mar 12, 2024

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
Copy link

ximex commented Mar 13, 2024

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

@xuhdev
Copy link

xuhdev commented Nov 2, 2024

I agree with @ximex . It's not uncommon to share a single manifest.json file across browsers.

However, now it returns a warning (mozilla/addons-linter#5152), which is in line with the behavior of Firefox.

@Rob--W
Copy link
Member

Rob--W commented Nov 7, 2024

We should accept manifest.json files that specify both service_worker and scripts (mozilla/addons-linter#5252 and #3101).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants