From 3d5d9027191065e2e30caabec92401364d977b34 Mon Sep 17 00:00:00 2001 From: Holger Benl Date: Fri, 12 Jun 2026 19:33:00 +0200 Subject: [PATCH] chore(bidi): dispose all sessions when connection is closed --- packages/playwright-core/src/server/bidi/bidiConnection.ts | 2 ++ tests/bidi/expectations/moz-firefox-nightly-library.txt | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/src/server/bidi/bidiConnection.ts b/packages/playwright-core/src/server/bidi/bidiConnection.ts index 13b15c11f4b8c..4e6d6596203b3 100644 --- a/packages/playwright-core/src/server/bidi/bidiConnection.ts +++ b/packages/playwright-core/src/server/bidi/bidiConnection.ts @@ -126,6 +126,8 @@ export class BidiConnection { this._transport.onmessage = undefined; this._transport.onclose = undefined; this._browserDisconnectedLogs = helper.formatBrowserLogs(this._browserLogsCollector.recentLogs(), reason); + for (const session of this._browsingContextToSession.values()) + session.dispose(); this.browserSession.dispose(); this._onDisconnect(); } diff --git a/tests/bidi/expectations/moz-firefox-nightly-library.txt b/tests/bidi/expectations/moz-firefox-nightly-library.txt index 70bbb117e3e7f..bd781694c3910 100644 --- a/tests/bidi/expectations/moz-firefox-nightly-library.txt +++ b/tests/bidi/expectations/moz-firefox-nightly-library.txt @@ -1,5 +1,4 @@ library/agent-perform.spec.ts › retrieve a secret [timeout] -library/browser.spec.ts › should dispatch page.on(close) upon browser.close and reject evaluate [timeout] library/browsercontext-add-cookies.spec.ts › should allow unnamed cookies [fail] library/browsercontext-basic.spec.ts › fetch with keepalive should throw when offline [fail] library/browsercontext-basic.spec.ts › should disable javascript [fail] @@ -72,7 +71,6 @@ library/browsertype-connect.spec.ts › run-server › should save download [fai library/browsertype-connect.spec.ts › run-server › should saveAs videos from remote browser [timeout] library/browsertype-connect.spec.ts › run-server › should save videos to artifactsDir [fail] library/browsertype-connect.spec.ts › run-server › should upload a folder [fail] -library/browsertype-launch.spec.ts › should reject all promises when browser is closed [timeout] library/browsertype-launch.spec.ts › should reject if launched browser fails immediately [fail] library/capabilities.spec.ts › SharedArrayBuffer should work @smoke [timeout] library/capabilities.spec.ts › should play video @smoke [timeout]