Bug 1190687 - [webext] Convert openContextMenu and closeContextMenu test helpers into async functions. r=kmag

MozReview-Commit-ID: AD57ftJiVlR

--HG--
extra : rebase_source : 335fad80d92844ae2d773abf39186d772a67c08a
This commit is contained in:
Luca Greco 2017-02-22 19:02:56 +01:00
Родитель bd60fe4e05
Коммит de5896b417
1 изменённых файлов: 5 добавлений и 5 удалений

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

@ -225,19 +225,19 @@ function closeBrowserAction(extension, win = window) {
return Promise.resolve(); return Promise.resolve();
} }
function* openContextMenu(selector = "#img1") { async function openContextMenu(selector = "#img1") {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu"); let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown"); let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser); await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser);
yield popupShownPromise; await popupShownPromise;
return contentAreaContextMenu; return contentAreaContextMenu;
} }
function* closeContextMenu() { async function closeContextMenu() {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu"); let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden"); let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup(); contentAreaContextMenu.hidePopup();
yield popupHiddenPromise; await popupHiddenPromise;
} }
function* openExtensionContextMenu(selector = "#img1") { function* openExtensionContextMenu(selector = "#img1") {