Bug 1190687 - [webext] Convert openContextMenu and closeContextMenu test helpers into async functions. r=kmag
authorLuca Greco <lgreco@mozilla.com>
Wed, 22 Feb 2017 19:02:56 +0100
changeset 345571 53796fc215f8
parent 345570 af332c1ddc74
child 345572 3884829f39b0
push id31440
push userkwierso@gmail.com
push date2017-03-02 21:09 +0000
treeherdermozilla-central@c54c652af04c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1190687
milestone54.0a1
Bug 1190687 - [webext] Convert openContextMenu and closeContextMenu test helpers into async functions. r=kmag

MozReview-Commit-ID: AD57ftJiVlR
browser/components/extensions/test/browser/head.js
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -220,29 +220,29 @@ function closeBrowserAction(extension, w
   let group = getBrowserActionWidget(extension);
 
   let node = win.document.getElementById(group.viewId);
   CustomizableUI.hidePanelForNode(node);
 
   return Promise.resolve();
 }
 
-function* openContextMenu(selector = "#img1") {
+async function openContextMenu(selector = "#img1") {
   let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
   let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
-  yield BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser);
-  yield popupShownPromise;
+  await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser);
+  await popupShownPromise;
   return contentAreaContextMenu;
 }
 
-function* closeContextMenu() {
+async function closeContextMenu() {
   let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
   let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
   contentAreaContextMenu.hidePopup();
-  yield popupHiddenPromise;
+  await popupHiddenPromise;
 }
 
 function* openExtensionContextMenu(selector = "#img1") {
   let contextMenu = yield openContextMenu(selector);
   let topLevelMenu = contextMenu.getElementsByAttribute("ext-type", "top-level-menu");
 
   // Return null if the extension only has one item and therefore no extension menu.
   if (topLevelMenu.length == 0) {