问题
I am trying to add a context menu item in the bookmark menu of Firefox (with a WebExtension). I read the contextMenus.create() article and the example works for me.
There are a bunch of context types, but none seems to work in the bookmark menu. Is this not possible?
回答1:
What you desire is not currently possible in a WebExtension. In general, if there is capability that you desire in WebExtensions which does not already exist, you can:
File a Request For Enhancement (a bug) requesting the functionality. In the case of adding an item to the bookmark context menu, such a bug already exists: Bug 1370499: Consider support for bookmark context menus. The general direction from this tracking bug is that adding an entry to the bookmark context menu will be implemented at some point in time.
Create a WebExtension experiment: You can create a WebExtension experiment to implement the functionality. If you create a WebExtension experiment, you can request that it be integrated into Firefox (which may, or may not happen). Having a WebExtension experiment will make it more likely that something along the lines of what you want is implemented, because it reduces the amount of Mozilla developer time required to do so. As WebExtension Experiments are actually legacy add-ons, they will not be able to function in Firefox as of the Release version of Firefox 57 (2017-11-14).
WebExtension experiments support (and legacy add-ons in general) is disabled by default in Firefox Nightly. However, in Nightly, you can enable an
about:config
preference,extensions.legacy.enabled
, which allows you to use legacy extensions, including WebExtension Experiments. This is expected to be also be true in Developer Edition, but has not been verified. WebExtension Experiments and legacy add-ons certainly won't function in the Release version of Firefox 57.
One thing that might improve the chance of having some functionality added to Firefox is to look through what is possible in Chrome extensions. If there is a Chrome extension API which closely matches what you desire, then it's more likely that Mozilla will implement it.
Unfortunately, there is a huge amount of functionality available in the other types of extensions which is not possible in WebExtensions (at least currently, and almost all of it permanently), but it's possible that any specific functionality could implemented. Some things not initially supported have been implemented, at least to a limited extent (e.g. Sidebars).
来源:https://stackoverflow.com/questions/44118274/add-context-menu-in-bookmark-menu