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

Data for legacy version of webextension.api.userScripts #25857

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Feb 6, 2025

Summary

Initial PR for addressing the compatibility data needs of Bug 1943050 Enable userScripts API by default. This PR creates the compatibility data to complement the documentation changes in mdn/content#37975:

  • addition of a userScripts_legacy.json file (being a copy of the original userScripts.json with a note about the legacy version availability in Manifest V2 only)
  • update to user_scripts.json to note its applicability to Manifest V2 only.

@rebloor rebloor added the data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions label Feb 6, 2025
@rebloor rebloor self-assigned this Feb 6, 2025
@github-actions github-actions bot added the size:l [PR only] 101-1000 LoC changed label Feb 6, 2025
@rebloor
Copy link
Contributor Author

rebloor commented Feb 6, 2025

On reflection, don't believe this is the right approach.

@rebloor rebloor closed this Feb 6, 2025
@rebloor rebloor reopened this Feb 6, 2025
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

mdn_url is missing everywhere. Is that intended?

Other than that, this looks good at the surface.

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

I assume you aligned on this approach with @Rob--W on Monday.

If the only overlap between the old and the new API is register(), then an alternative solution would be to mark all methods from the old API as deprecated, and only rename the legacy register BCD feature to register_legacy (with a good description).

Anyways, if we decide to introduce webextensions.api.userScripts_legacy, then shouldn't webextensions.api.userScripts reflect support for the new API, even if that's currently false for everything?

/cc @Elchi3 in case he has other ideas for this case.

@rebloor
Copy link
Contributor Author

rebloor commented Feb 7, 2025

mdn_url is missing everywhere. Is that intended?

@Rob--W mdn_url is filled when a page referencing the BCD key goes live. Until then, you get a warning from the linter: ✖ webextensions.api.userScripts_legacy - Warning → Current mdn_url is a 404: https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts_legacy

@rebloor
Copy link
Contributor Author

rebloor commented Feb 7, 2025

@caugner

I assume you aligned on this approach with @Rob--W on Monday.

Yes

Anyways, if we decide to introduce webextensions.api.userScripts_legacy, then shouldn't webextensions.api.userScripts reflect support for the new API, even if that's currently false for everything?

I'm working on a PR to add the documentation for the new API now and will update the BCD shortly.

},
"RegisteredUserScript": {
"__compat": {
"description": "RegisteredUserScript (Legacy)",
Copy link
Collaborator

@dotproto dotproto Feb 7, 2025

Choose a reason for hiding this comment

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

@rebloor, I'm curious about your motivations for including "(Legacy)" on each of the entries in this data. Is this an established practice? I assume this affects how entries appear in compatibility tables. Does it affect anything else on MDN? Other tooling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I'm aware, we haven't had a similar situation in the past, so we're inventing "practice" here. In this situation, we have a userScript API implemented in Firefox only for Manifest V2 and an incompatible userScript API for Manifest V3 implemented in Firefox, Chrome, and Safari. In the MDN documentation readers will see the Firefox only version of the API marked up as "legacy" throughout. See mdn/content#37975 description is used as the title in the compatibility tables.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I may have suggested this. If we render the BCD table for this feature, there would be no indication otherwise that this refers to the old API.

I notice that the features have no status set (like experimental, deprecated), which presumably is a special treatment. If it is forbidden to mark a webextensions.api feature as deprecated, then we should probably change that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless there's a change I'm unaware of, we have no plans to deprecate Manifest V2 ((https://blog.mozilla.org/addons/2024/03/13/manifest-v3-manifest-v2-march-2024-update/) so by extension we presumably have no plans to deprecate the Manifest V2 version of userScript. @Rob--W

In addition to including the word legacy in the descriptions, wouldn't the mdn_url indicate that it refers to the legacy API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:webext Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions size:l [PR only] 101-1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants