Skip to content

fix: various WebSocketRoute issues #36517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Jul 1, 2025

  • Do not allow two clients to route simultaneously.
  • Cleanup after dispatcher disconnects.
  • Ensure that routing works in context reuse scenarios.
  • Test context reuse both in the launched browser with a single connection, and in a connected browser with different connections.

Fixes #36480. References #35987.

- Do not allow two clients to route simultaneously.
- Cleanup after dispatcher disconnects.
- Ensure that routing works in context reuse scenarios.
- Test context reuse both in the launched browser with a single
  connection, and in a connected browser with different
  connections.
@dgozman dgozman requested a review from yury-s July 1, 2025 13:23
Copy link
Contributor

github-actions bot commented Jul 1, 2025

Test results for "tests 1"

1 failed
❌ [webkit-library] › library/browsercontext-pages.spec.ts:82:3 › should click the button with offset with page scale @webkit-ubuntu-22.04-node18

5 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1087:7 › cli codegen record › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104:3 › should work with strict CSP policy @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node18-1
⚠️ [webkit-library] › library/browsercontext-pages.spec.ts:105:3 › should return bounding box with page scale @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

47126 passed, 979 skipped
✔️✔️✔️

Merge workflow run.

}
++data.counter;

return await target.addInitScript(progress, `
Copy link
Member

Choose a reason for hiding this comment

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

Why do we add the same module again when the counter > 1?

@@ -319,7 +320,7 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
async setWebSocketInterceptionPatterns(params: channels.PageSetWebSocketInterceptionPatternsParams, progress: Progress): Promise<void> {
this._webSocketInterceptionPatterns = params.patterns;
if (params.patterns.length)
await WebSocketRouteDispatcher.installIfNeeded(progress, this.connection, this._context);
this._routeWebSocketInitScripts.push(await WebSocketRouteDispatcher.install(progress, this.connection, this._context));
Copy link
Member

Choose a reason for hiding this comment

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

how any why can we have more than one init script here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Regression. The routeWebSocket does not work on subsequent attempts unless the browser window is closed.
2 participants