From 99a150a0083e156e26f08f6dd21424c031827167 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Wed, 6 Aug 2025 18:37:49 +0000 Subject: [PATCH] Bug 1828622, try to stabilize test_focus.xhtml a bit, r=farre a=test-only Differential Revision: https://phabricator.services.mozilla.com/D259856 --- dom/tests/mochitest/chrome/window_focus.xhtml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dom/tests/mochitest/chrome/window_focus.xhtml b/dom/tests/mochitest/chrome/window_focus.xhtml index 72759465a51d..bb119ae4a456 100644 --- a/dom/tests/mochitest/chrome/window_focus.xhtml +++ b/dom/tests/mochitest/chrome/window_focus.xhtml @@ -1572,8 +1572,13 @@ function doFrameHistoryTests() resolve({ location: content.location.href, persisted }); }, { once: true }); }); - // make sure that loading a new page and then going back maintains the focus - content.location = "data:text/html,"; + // Make sure that loading a new page and then going back maintains the focus, + // but try to stabilize the page first so that it can enter bfcache. + content.requestAnimationFrame(() => { + content.requestAnimationFrame(() => { + content.location = "data:text/html,"; + }); + }); return goneBack; }); }).then(({ location, persisted }) => {