зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176281 - Part 3: Simplify contextMenuOpened using BrowserTestUtils.waitForEvent. r=Gijs
This commit is contained in:
Родитель
d5fbb010dc
Коммит
0cc0b9afd2
|
@ -164,16 +164,11 @@ function newWindowOpened() {
|
|||
* @resolves With the menu popup when the context menu is open.
|
||||
*/
|
||||
function contextMenuOpened(aWindow, aLinkId) {
|
||||
return new Promise(function(resolve) {
|
||||
aWindow.document.addEventListener("popupshown",
|
||||
function handleMenu(aEvent) {
|
||||
aWindow.document.removeEventListener("popupshown", handleMenu, false);
|
||||
resolve(aEvent.target);
|
||||
}, false);
|
||||
|
||||
// Simulate right-click that opens the context menu.
|
||||
clickTheLink(aWindow, aLinkId, {type: "contextmenu", button: 2});
|
||||
});
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(aWindow.document,
|
||||
"popupshown");
|
||||
// Simulate right-click.
|
||||
clickTheLink(aWindow, aLinkId, { type: "contextmenu", button: 2 });
|
||||
return popupShownPromise.then(e => e.target);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче