Open Bug 1385073 Opened 7 years ago Updated 2 years ago

Add excludeDocumentUrlPatterns/excludeTargetUrlPatterns options to contextMenus.create

Categories

(WebExtensions :: General, enhancement, P5)

enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: kernp25, Unassigned)

References

Details

(Whiteboard: [design-decision-approved])

This is from bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1367320

browser.contextMenus.create should support two new options:
1) excludeDocumentUrlPatterns
2) excludeTargetUrlPatterns

It would be nice if the following code would work:
browser.contextMenus.create({
  id: "my-link-item",
  title: "My Link Item",
  contexts: ["link"],
  excludeTargetUrlPatterns: ["*://example.com/*"]  
});

The above context menu item does not display on links which have the host "example.com" but does display on all other links.
Priority: -- → P5
Whiteboard: [design-decision-needed]
Hi kernp25, this has been added to the agenda for the August 8 WebExtensions APIs triage meeting. Would you be able to join us? 

Wiki: https://wiki.mozilla.org/Add-ons/Contribute/Triage#Next_Meeting

Agenda: https://docs.google.com/document/d/1I-i1FQ38nwFHNl4hnzTctdsYHXOjJpeAgm1Bm3VoUUA/edit#
This was approved in the design-decision-needed triage. 

It was also noted that without specific API support, this should possible via https://bugzilla.mozilla.org/show_bug.cgi?id=1215376.
Whiteboard: [design-decision-needed] → [design-decision-approved]
Product: Toolkit → WebExtensions
I'm actually inclined towards wontfix'ing this.  Hyper customization of context menus would be better served by the extension making whatever determinations it wants via access to the target element (bug 1341804, whether that is css or actually access to the element).  Extension authors are going to come up with endless different qualifiers, no reason for us to implement them unless they become common use.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.