Skip to content

Conversation

@dotproto
Copy link

Fixes #5252

This PR updates the error/warning message returned when an extension's manifest.json file contains a background.service_worker property without declaring background.scripts or background.page.

@dotproto dotproto force-pushed the service-worker-message branch from 814d739 to d255e92 Compare October 30, 2025 01:10
Comment on lines +895 to +896
description: i18n._(`The "background" property must contain either "scripts"
or "page". See
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of offering two options, let's offer "scripts" as a fallback. The MDN docs provides more context:

Suggested change
description: i18n._(`The "background" property must contain either "scripts"
or "page". See
description: i18n._(`"background.scripts" must be specified as a fallback for
"background.service_worker". See

this.collector.addWarning(
messages.manifestFieldUnsupported('/background/service_worker')
);
this.collector.addWarning(messages.BACKGROUND_SERVICE_WORKER);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to come up with a message that is not confusing when used as a warning and an error. I cannot really think of a good one. Can we have a separate warning that is clear? Currently one would think that they did something wrong.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit helpful message when background.service_worker is used without background.scripts/page

2 participants