Open Bug 1902843 Opened 8 months ago Updated 4 months ago

composeScripts and messageDisplayScripts APIs: Allow registering scripts in the manifest.json file

Categories

(Thunderbird :: Add-Ons: Extensions API, enhancement, P5)

enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: tdulcet, Unassigned)

Details

Attachments

(2 files)

Please allow registering composeScripts and messageDisplayScripts in the manifest.json file, the same as developers can already do with contentScripts. This would make is easier for developers to port Firefox and Chrome extensions with content scripts to Thunderbird using compose and/or message display scripts, as they would only need to update the manifest.json file, instead also needing to add code to conditionally call the respective register() function(s) in Thunderbird. This would also eliminate potential race conditions in extensions, as the scripts would be registered immediately when the add-on is installed/enabled, instead having wait for the background script to run first.

Also see part 3 of bug 1630786 comment 4.

Status: NEW → UNCONFIRMED
Ever confirmed: false

Please do not create bugs with NEW status. This is now the second time this happened. Users with edit rights have to manually switch back to UNCONFIRMED. With great power comes great responsibility.

Attached image image.png

Please do not create bugs with NEW status.

It does that automatically and it looks like I do not have permission to change it (see attached screenshot). I have canConfirm permission, but not editBugs.

However, I am not sure what the difference between "new" and "unconfirmed" status is on a feature request (as opposed to a bug report).

canConfirm should allow you exactly that, confirm a bug which changes it from UNCONFIRMED to NEW. This is part of the triage process. If you edit the bug, you should be able to flip it back. Did you receive instructions when the rights have been granted to you?

Not sure if we should be discussing this in public, but anyone can get canConfirm permission by clicking a button on a hidden BMO page. Anyway, you are correct, it looks like I am able to change the status back to "unconfirmed" (as you did) after initially filing the bug. I will try to remember to do this next time I file an add-ons related bug.

Priority: -- → P5

As pointed out by Geoff in the https://bugzilla.mozilla.org/show_bug.cgi?id=1630786#c4, this is not possible, because an extension context is needed, and it isn't available when reading the manifest.

The new scripting API for Manifest V3 (and Manifest V2) also no longer allow defining scripts in the manifest. I therefore tend to close this as WONTFIX, instead of having it here as P5 forever.

Hmm, why is an extension context needed for composeScripts and messageDisplayScripts, but not contentScripts?

Based on the documentation on MDN, content scripts can be statically defined in the manifest.json file for both Manifest V2 and V3. The new Scripting API just replaces the old methods for dynamically registering content scripts.

Based on the documentation on MDN, content scripts can be statically defined in the manifest.json file for both Manifest V2 and V3. The new Scripting API just replaces the old methods for dynamically registering content scripts.

Interesting. It is not mentioned in the documentation of the scripting API itself. Thanks for the clarification.

I think the MDN page you linked is wrong. Can you provide an MV3 add-on, which uses a content script definition in the manifest?

The code looks as if it is unsupported:
https://searchfox.org/mozilla-central/source/toolkit/components/extensions/schemas/content_scripts.json#4

All of my Firefox add-ons that use content scripts do statically declare them in the manifest.json file, but those are all MV2. However, neither the Chrome nor the Firefox MV3 migration documentation mention any removal of the content_scripts key. The regular Chrome content script documentation also does not mention that the content_scripts key is specific to any manifest version.

Most of the official MDN example extensions are MV2, but from a quick search I found some MV3 extensions from Rob, for example this one, which does use the content_scripts key in the manifest.json file. Hope that helps.

Working MV3 extension using content-script manifest key.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: