Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox): wait for startup before closing the browser (#575)

Joel Einbinder717159094c36
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index 0842778194..4d042afa2c 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1 +1 @@
-1017
+1018
diff --git a/browser_patches/firefox/patches/bootstrap.diff b/browser_patches/firefox/patches/bootstrap.diff
index e88dc16f0b..aa37e8948e 100644
--- a/browser_patches/firefox/patches/bootstrap.diff
+++ b/browser_patches/firefox/patches/bootstrap.diff
@@ -3807,10 +3807,10 @@ index 0000000000000000000000000000000000000000..a2d3b79469566ca2edb7d864621f7085
+this.AccessibilityHandler = AccessibilityHandler;
diff --git a/testing/juggler/protocol/BrowserHandler.js b/testing/juggler/protocol/BrowserHandler.js
new file mode 100644
-index 0000000000000000000000000000000000000000..708059a95b3a01f3d9c7b7ef4714ee6f8ab26b94
+index 0000000000000000000000000000000000000000..9bf14b3c4842d15508f67daa10f350475551a73e
--- /dev/null
+++ b/testing/juggler/protocol/BrowserHandler.js
-@@ -0,0 +1,66 @@
+@@ -0,0 +1,72 @@
+"use strict";
+
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
@@ -3829,6 +3829,12 @@ index 0000000000000000000000000000000000000000..708059a95b3a01f3d9c7b7ef4714ee6f
+ }
+
+ async close() {
++ let browserWindow = Services.wm.getMostRecentWindow(
++ "navigator:browser"
++ );
++ if (browserWindow && browserWindow.gBrowserInit) {
++ await browserWindow.gBrowserInit.idleTasksFinishedPromise;
++ }
+ Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
+ }
+