commit 793fc3bce145d88d30efe245d1eee89a1e7ac061
parent cbcae85afa0199bf28ff821e9dbba5342e3a3cbf
Author: Julian Descottes <jdescottes@mozilla.com>
Date: Fri, 5 Dec 2025 06:29:50 +0000
Bug 2003857 - [bidi] Wait for document to be visible in browsingContext.create with background=false r=Sasha
Differential Revision: https://phabricator.services.mozilla.com/D274957
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/remote/webdriver-bidi/modules/root/browsingContext.sys.mjs b/remote/webdriver-bidi/modules/root/browsingContext.sys.mjs
@@ -769,6 +769,17 @@ class BrowsingContextModule extends RootBiDiModule {
// Force a reflow by accessing `clientHeight` (see Bug 1847044).
browser.parentElement.clientHeight;
+ if (!background && !lazy.AppInfo.isAndroid) {
+ // See Bug 2002097, on slow platforms, the newly created tab might not be
+ // visible immediately.
+ await this._forwardToWindowGlobal(
+ "_awaitVisibilityState",
+ browser.browsingContext.id,
+ { value: "visible" },
+ { retryOnAbort: true }
+ );
+ }
+
return {
context: lazy.NavigableManager.getIdForBrowser(browser),
};