MV3 Context Menu - help appreciated

Hi

I am not very experienced with js, but I am very keen to update all of my add-ons to MV3 and would really appreciate some guidance.

I have a few add-ons that add a search option to the context menu in Firefox. The user can select some text, open the context menu and send the text to a search string.

When I try to bring this up to scratch for MV3, the context menu option does not appear. The test .xpi file is installed through about:debugging in Dev Edition without a problem, but I have no luck in making it work.

To help illustrate this, this repo (https://github.com/plwt/MV3-Context-Menu-Search), has a working MV2 version, and my attempt at a MV3 version. What do I need to change in the MV3 version to make it work?

Any help or assistance that gets me to a solution would be really appreciated.

Thank you.

Unless Firefox’s implementation of MV3 is different, you need need to use “service_worker” instead of “scripts” when declaring a service worker. Also, it only takes a single string because you can only have 1 worker. This is how it is on Chrome at least:

"background": {
    "service_worker": "service_worker.js"
}

Hi @ComputerWhiz - long time no news, I hope you are okay.

Thank you for your help with this. it was not quite the solution, but it did help me to look into this further and I have been able to figure it out. The MV3 folder in the repo now had a working solution!

This will not only help with the immediate issue but may also help me make all my add-ons MV3 compliant - thank you for your help!