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): await browser initialization when closing browser (#4121)

Andrey Lushnikov58285f615568
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index 4bdbc9bac8..c69911e429 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1188
-Changed: [email protected] Wed Oct 7 14:29:11 PDT 2020
+1189
+Changed: [email protected] Mon Oct 12 22:21:30 PDT 2020
diff --git a/browser_patches/firefox/juggler/protocol/BrowserHandler.js b/browser_patches/firefox/juggler/protocol/BrowserHandler.js
index e99a9c4fd5..128d9e5e08 100644
--- a/browser_patches/firefox/juggler/protocol/BrowserHandler.js
+++ b/browser_patches/firefox/juggler/protocol/BrowserHandler.js
@@ -51,7 +51,7 @@ class BrowserHandler {
// service before returning from this method. Failing to do so will result
// in a broken shutdown sequence and multiple errors in browser STDERR log.
//
- // NOTE: we have to put this here instead of in the `Browser.close` handler
+ // NOTE: we have to put this here as well as in the `Browser.close` handler
// since browser shutdown can be initiated when the last tab is closed, e.g.
// with persistent context.
await Promise.all([
@@ -139,6 +139,12 @@ class BrowserHandler {
if (browserWindow && browserWindow.gBrowserInit) {
await browserWindow.gBrowserInit.idleTasksFinishedPromise;
}
+ // Try to fully initialize browser before closing.
+ // See comment in `Browser.enable`.
+ await Promise.all([
+ waitForAddonManager(),
+ waitForSearchService(),
+ ]);
this._onclose();
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}