Closed Bug 1423184 Opened 7 years ago Closed 7 years ago

Web extension: dynamic context menus

Categories

(WebExtensions :: Frontend, enhancement)

57 Branch
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1215376

People

(Reporter: mozbug, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 Build ID: 20171129230835 Steps to reproduce: Problem: Our extension needs to dynamically change the available context menu items depending on the current domain. Actual results: Right now, to implement this in our extension, we have needed to add a listener to tabs.onUpdated, tabs.onActivated and windows.onFocusChanged which runs a function to remove all previously added context menu items and then add new ones relevant to this domain. An alternative approach would be to create 1000s of context menu items using documentUrlPatterns at startup. Both of these existing solutions seem like an inefficient way to dynamically control the context menus that should be displayed for a given domain name. Expected results: One proposed solution is to add something like browser.menus.onShown/onBeforeShown (that allows populating the context menu when it's shown).
I agree with this idea as having a similar problem at https://addons.mozilla.org/firefox/addon/undoclosetabbutton/. However, the handle delay, timeout (sub-process hang) and failback menus may need to be considered.
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Component: WebExtensions: General → WebExtensions: Frontend
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → All
Whiteboard: [design-decision-needed]
(In reply to Geoffrey De Belie (Smile4ever) from comment #2) > Duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1215376 ? Looks yes, thank you.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Whiteboard: [design-decision-needed]
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.