Skip to content

Correct userScripts / userScripts_legacy index#579

Merged
Rob--W merged 1 commit intomdn:mainfrom
Rob--W:userScripts-mv3-sample-follow-up
Mar 9, 2025
Merged

Correct userScripts / userScripts_legacy index#579
Rob--W merged 1 commit intomdn:mainfrom
Rob--W:userScripts-mv3-sample-follow-up

Conversation

@Rob--W
Copy link
Copy Markdown
Member

@Rob--W Rob--W commented Feb 26, 2025

Description

The MV2-specific userScripts example is currently associated with the "userScripts.register" API. While this is the correct API name, the MDN documentation is actually at userScripts_legacy/register.

To make sure that the example is rendered in the right location, change "userScripts" to "userScripts_legacy".

... and for completeness also add runtime.onMessage to the MV3 example, since that example uses this API.

Motivation

The user-script-register example currently appears at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/userScripts/register#example_extensions, but it should not. Instead, it should be at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/userScripts_legacy/register

Additional details

With this patch, the example will be moved to the correct location, as desired.

The index of all examples, at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples, would show userScripts_legacy.register instead of userScripts.register (legacy). This is a mild issue, and I plan to address that by submitting a patch to the logic at https://github.com/mdn/yari/blob/79c4a5ef6b2807e52b851ec4b54f0def71b0f319/kumascript/macros/WebExtAllExamples.ejs#L48
I tested locally, and the link is rendered as userScripts.register() (Legacy), as desired, as explained at mdn/yari#12677 (comment).

Related issues and pull requests

This is a follow-up to mdn/content#38073 and #576.

The MV2-specific userScripts example is currently associated with the
"userScripts.register" API. While this is the correct API name, the
MDN documentation is actually at `userScripts_legacy/register`.

To make sure that the example is rendered in the right location,
change "userScripts" to "userScripts_legacy".

... and for completeness also add `runtime.onMessage` to the MV3
example, since that example uses this API.
@Rob--W Rob--W merged commit 8f42801 into mdn:main Mar 9, 2025
2 checks passed
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.

2 participants