Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/playwright-core/src/server/bidi/bidiConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be a part of BidiSession.dispose() which already deletes the child sessions from _browsingContextToSession map.

This session management code is more convoluted than it needs to be. The idea was to have hierarchy of Browser->Page->Frame sessions, but unfortunately there is no unified way to route the messages and we ended up with the ugly BidiConnection._dispatchMessage logic. Perhaps you have an idea how to improve it? I was contemplating just giving up on the unified routing and instead having particular classes route delegate to their child sessions, but didn't quite like it either.

this.browserSession.dispose();
this._onDisconnect();
}
Expand Down
2 changes: 0 additions & 2 deletions tests/bidi/expectations/moz-firefox-nightly-library.txt
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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]
Expand Down
Loading