Bug 1484789 - Ensure document flushed before triggering context menu in a browserAction popup test. r=mixedpuppy, a=test-only
authorLuca Greco <lgreco@mozilla.com>
Fri, 15 Feb 2019 18:10:11 +0000
changeset 516043 2d73b02c64e35c65823e26e7eb620241ff83b5af
parent 516042 596f118fa8e31d8ca8f34ac970d8f308e464b47c
child 516044 26383c993190b7ba1b9360771efe404025ae01ad
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, test-only
bugs1484789
milestone66.0
Bug 1484789 - Ensure document flushed before triggering context menu in a browserAction popup test. r=mixedpuppy, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D19967
browser/components/extensions/test/browser/head.js
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -303,16 +303,20 @@ async function toggleBookmarksToolbar(vi
 
   setToolbarVisibility(bookmarksToolbar, visible);
   await transitionPromise;
 }
 
 async function openContextMenuInPopup(extension, selector = "body") {
   let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
   let browser = await awaitExtensionPanel(extension);
+
+  // Ensure that the document layout has been flushed before triggering the mouse event
+  // (See Bug 1519808 for a rationale).
+  await browser.ownerGlobal.promiseDocumentFlushed(() => {});
   let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
   await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "mousedown", button: 2}, browser);
   await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, browser);
   await popupShownPromise;
   return contentAreaContextMenu;
 }
 
 async function openContextMenuInSidebar(selector = "body") {