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): fix closing browser contexts with beforeunload (#4314)

Andrey Lushnikove3b12b0a0d07
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index cb074bfc0d..26ae34194f 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1199
-Changed: [email protected] Mon 02 Nov 2020 04:10:47 PM PST
+1200
+Changed: [email protected] Mon 02 Nov 2020 05:18:01 PM PST
diff --git a/browser_patches/firefox/juggler/TargetRegistry.js b/browser_patches/firefox/juggler/TargetRegistry.js
index c4893382e5..46d1f4a5c2 100644
--- a/browser_patches/firefox/juggler/TargetRegistry.js
+++ b/browser_patches/firefox/juggler/TargetRegistry.js
@@ -417,8 +417,8 @@ class PageTarget {
await this.updateViewportSize();
}
- async close(runBeforeUnload = false) {
- await this._gBrowser.removeTab(this._tab, {
+ close(runBeforeUnload = false) {
+ this._gBrowser.removeTab(this._tab, {
skipPermitUnload: !runBeforeUnload,
});
}
@@ -562,7 +562,8 @@ class BrowserContext {
async destroy() {
if (this.userContextId !== 0) {
ContextualIdentityService.remove(this.userContextId);
- ContextualIdentityService.closeContainerTabs(this.userContextId);
+ for (const page of this.pages)
+ page.close();
if (this.pages.size) {
await new Promise(f => {
const listener = helper.on(this._registry, TargetRegistry.Events.TargetDestroyed, () => {