Page 1 of 1

Incompatibility with Tree Style Tab and other sidebar addons

Posted: Thu Sep 12, 2019 11:45 am
by piro_or
Some addons using browser.menus.overrideContext() imports extra context menu commands provided by other addons. For example, a sidebar panel of Tree Style Tab ... style-tab/ works like a vertical tab bar and right-click on the panel shows a simulated tab context menu. Flagfox's tab context command is also visible under the menu.

However, commands of Flagfox actually don't work. After investigation I've realized that the parameter "frameUrl" - a part of "info" object for callbacks of browser.menus.onClicked - becomes to an internal URL of the sidebar panel itself, like "moz-extension://xxxx-xxxx-xxxx-xxxx/..." on such cases. Thus,

Code: Select all

function getTopPriorityUrlFromMenuEvent(info) {
    for (const prop of ["srcUrl","linkUrl","frameUrl","pageUrl"])
        if (isNonEmptyString(info[prop]))
            return info[prop];
    return null;
this function returns such an internal URL and

Code: Select all

browser.menus.onClicked.addListener(function(info, tab) {
    newLocationForMenuEvent(info, tab).then(location => {
        actions.doAction(getActionIDfromMenuItemID(info.menuItemId), location, getOpenInModeForMenuEvent(info));
        debugLog_events("Flagfox menu item click processed for target:", info, tab, location);
this callback fails to process the command due to the "location" filled with an internal URL.

Could you make Flagfox compatible with such type addons?
This problem was originally reported at Tree Style Tab's issue tracker: