contextMenus as an optional permission

I am having a bit of trouble figuring out if I can use “contextMenus” as an optional permission for my addon.

According to the docs (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/optional_permissions) I can include contextMenus in the optional_permissions. However if I load my addon into the browser and attempt to request the permission I get the error:

Uncaught Error: Type error for parameter permissions (Error processing permissions.0: Value “contextMenus” must either: must either [be one of [“idle”], be one of [“menus.overrideContext”], be one of [“search”], be one of [“activeTab”], be one of [“cookies”], or be one of [“webRequest”, “webRequestBlocking”]], be one of [“clipboardRead”, “clipboardWrite”, “geolocation”, “notifications”], be one of [“bookmarks”], be one of [“browsingData”], be one of [“devtools”], be one of [“find”], be one of [“history”], be one of [“pkcs11”], be one of [“sessions”], be one of [“topSites”], be one of [“tabs”, “tabHide”], be one of [“browserSettings”], be one of [“downloads”, “downloads.open”], be one of [“management”], be one of [“privacy”], be one of [“proxy”], or be one of [“webNavigation”]) for permissions.request.

So this has confused me, so I was wondering if I am maybe misunderstanding the documentation?

See the compatibility table below (on the link you posted), the “contextMenus” permission is not supported as optional in Firefox.

Anyway, the “contextMenus” permission is in the list of permission that are not alerted to users. So making it optional doesn’t really bring any value.
More info:

1 Like

Thanks for that. I had not seen the compatability table, I had just assumed that it would work as it was mentioned on the docs.

Yep, MDN is like a wikipedia for web technologies :slight_smile: , even those that are not supported in Mozilla products (yet).

1 Like