Bug 1704875 - For now, keep synthesizing events on menus if a mouse button is set. r=robwu

This capability is used by browser_ext_menus_capture_secondary_click.js, which
checks that the mouse button is correctly propagated when clicking menu items.
Once bug 1704879 is fixed and activateItem supports specifying a mouse button,
we can revert this patch again.

Differential Revision: https://phabricator.services.mozilla.com/D111901
This commit is contained in:
Markus Stange 2021-04-13 20:22:39 +00:00
Родитель 06db1fec76
Коммит 6278623835
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -509,7 +509,12 @@ async function closeExtensionContextMenu(itemToSelect, modifiers = {}) {
"popuphidden"
);
if (itemToSelect) {
itemToSelect.closest("menupopup").activateItem(itemToSelect, modifiers);
if ("button" in modifiers) {
// Bug 1704879: activateItem does not currently support button
EventUtils.synthesizeMouseAtCenter(itemToSelect, modifiers);
} else {
itemToSelect.closest("menupopup").activateItem(itemToSelect, modifiers);
}
} else {
contentAreaContextMenu.hidePopup();
}