Closed Bug 1280555 Opened 8 years ago Closed 8 years ago

Add ability to trigger something operations when the context menu is (being) opened

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox50 affected)

RESOLVED DUPLICATE of bug 1215376
Tracking Status
firefox50 --- affected

People

(Reporter: yuki, Unassigned)

References

Details

(Whiteboard: [design-decision-needed])

`chrome.contextMenus` now have an entry point `chrome.contextMenus.onClicked` so we can know when the item is choosen, but there is no entry point to know when the menu is (trying to be) opened. `chrome.contextMenu.onOpening` or `chrome.contextMenu.onOpened` is required for an addon which provids a context menu feature based on very heavy preliminary operations.

For example, my addon Text Link https://addons.mozilla.org/firefox/addon/text-link/ provides some menu items like "Open (URLs extracted from selection) in new tabs", "Copy (URLs) to the clipboard", and so on. However, the extraction operation is sometimes very heavy, so I don't want to prepare the list of URLs from selection when the selection is just changed - the user will open the context menu, but possibly don't open it. If such an entry point is available, I can start the heavy operation when the context menu is opened, and update menu labels/icons, activate or deactivate those items, or something.
Whiteboard: [design-decision-needed]
And one more entry point, `chrome.contextMenus.onClosing` or something can cancel such a heavy operation if the context menu is closed before the operation finishes.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.