Open Bug 1578655 Opened 5 years ago Updated 2 years ago

Follow up 1280347 - Allow extensions to include native (tab) items when using overrideContext

Categories

(WebExtensions :: Frontend, enhancement, P5)

71 Branch
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: geoffreydebelie, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Currently, when you use overrideContext you can choose to inherit other addons context menu items. [1]

This is a request to make it also possible to include native context menu items from Firefox, for example "Send tab to device".

API proposal:

browser.menus.overrideContext({
showDefaults: true,
context: "tab",
tabId: "55",
requestedMenuItems: ["SEND_TAB_TO_DEVICE", "RELOAD_TAB", "CLOSE_TAB"]
});

This would help Tab Center Reborn. [2]

In case a menu item isn't available (anymore) in the specific version of Firefox that the user is running, it should output a warning to the console.

For context, see https://bugzilla.mozilla.org/show_bug.cgi?id=1376251#c12

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/overrideContext
[2] https://framagit.org/ariasuni/tabcenter-reborn

From my comment at https://bugzilla.mozilla.org/show_bug.cgi?id=1376251#c12 :

I think that the best way to offer this functionality is with a new option in the browser.overrideContext method. The main things needed are

  1. ability to express interest in the menu item and
  2. ability to specify the desired location of the menu item.

The API proposal in comment #0 here offers (1) but not (2).

You've also shown "RELOAD_TAB" and "CLOSE_TAB" as examples. Since these can already be implemented with the existing APIs with little disadvantages, I see no reason to include them in the API. For now, the only accepted menu item is "Send Tab to Device". The API needs to be sufficiently generic to support multiple built-in menu items.

Component: Untriaged → Frontend
See Also: → 1376251

To accomodate for (2):

browser.menus.overrideContext({
  showDefaults: true,
  context: "tab",
  tabId: "55",
  requestedMenuItems: [
    {
      code: "SEND_TAB_TO_DEVICE",
      insertAfterId: "specific-id-from-webextension-contextmenu-item"
   }
  ]
});
Priority: -- → P5
Version: Firefox 71 → 71 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.