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

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.

LGTM from a structure point of view, didn't verify the accurateness of the data.

@caugner
Copy link
Contributor

caugner commented Feb 21, 2025

I'm holding off on merging this until @dotproto or @Rob--W have approved.

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.

Is this a good place for adding a reference to the newer userScripts APIs for future reference?

I.e. a comment to the top level userScripts namespace, register method, RegisteredUserScripts, RegisteredUserScript.unregister methods.

@rebloor rebloor requested a review from Rob--W February 24, 2025 01:53
"edge": "mirror",
"firefox": {
"version_added": "68",
"notes": "For extension using Manifest V3, see [`userScripts.unregister`](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/unregister)."
Copy link
Member

Choose a reason for hiding this comment

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

When I read this out of context, it could be read as the API being meant for extensions using MV3, and that there is more information at the given link. Is this just me?

A way to address that is to prepend a note like "Only available for use in extensions using Manifest V2."

"edge": "mirror",
"firefox": {
"version_added": "68",
"notes": "For extension using Manifest V3, see [`userScripts.unregister`](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/unregister)."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On rereading - I can only agree!

Suggested change
"notes": "For extension using Manifest V3, see [`userScripts.unregister`](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/unregister)."
"notes": "Only available for use in extensions using Manifest V2. For extension using Manifest V3, see [`userScripts.unregister`](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/unregister)."

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