From d427e7411c371fc6f85ca5bbdaab4b5185ffd97e Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 10 Jun 2019 03:06:25 +0000 Subject: [PATCH] Bug 1488953 - Wait for a scrollend event to make sure the scrolling has finished before proceeding the test. r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D33614 --HG-- extra : moz-landing-system : lando --- browser/base/content/test/tabs/browser_tabCloseSpacer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/browser/base/content/test/tabs/browser_tabCloseSpacer.js b/browser/base/content/test/tabs/browser_tabCloseSpacer.js index 4142f8ef80fa..62f4160a17fd 100644 --- a/browser/base/content/test/tabs/browser_tabCloseSpacer.js +++ b/browser/base/content/test/tabs/browser_tabCloseSpacer.js @@ -48,7 +48,11 @@ async function overflowTabs() { while (gBrowser.tabs.length < tabCountForOverflow) { BrowserTestUtils.addTab(gBrowser, "about:blank", { skipAnimation: true, index: 0 }); } - await window.promiseDocumentFlushed(() => {}); + + // Make sure scrolling finished. + await new Promise(resolve => { + arrowScrollbox.addEventListener("scrollend", resolve, { once: true }); + }); } function getLastCloseButton() {