Skip to content
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

chore(ui): decouple TestServerConnection from websocket transport #32274

Merged
merged 4 commits into from
Aug 23, 2024

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Aug 22, 2024

Preparation for #32076.

@Skn0tt Skn0tt requested a review from dgozman August 22, 2024 14:56
@Skn0tt Skn0tt self-assigned this Aug 22, 2024
@@ -19,6 +19,16 @@ import * as events from './events';

// -- Reuse boundary -- Everything below this line is reused in the vscode extension.

export interface TestServerSocket {
Copy link
Contributor

Choose a reason for hiding this comment

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

  • We usually call things like this one "Transport" for easier search across the codebase.
  • This is a somewhat convoluted interface for a transport. Perhaps we should separate transport (onmessage, onclose, send, close) from a factory that creates a websocket transport (this one needs open/error/etc).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good! How do you like 0f37e55?

@@ -102,7 +102,7 @@ export const WorkbenchLoader: React.FunctionComponent<{
const guid = new URLSearchParams(window.location.search).get('ws');
const wsURL = new URL(`../${guid}`, window.location.toString());
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:');
const testServerConnection = new TestServerConnection(wsURL.toString());
const testServerConnection = new TestServerConnection(new WebSocket(wsURL));
Copy link
Contributor

@Meir017 Meir017 Aug 22, 2024

Choose a reason for hiding this comment

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

const guid = new URLSearchParams(window.location.search).get('ws');
const wsURL = new URL(`../${guid}`, window.location.toString());
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:');
const testServerConnection = new TestServerConnection(new WebSocket(wsURL));

this code is also used in packages/trace-viewer/src/ui/uiModeView.tsx consider extracting to a utility function

This comment has been minimized.

This comment has been minimized.

@Skn0tt Skn0tt merged commit 3fb33e7 into microsoft:main Aug 23, 2024
29 checks passed
Copy link
Contributor

Test results for "tests 1"

1 flaky ⚠️ [firefox-page] › page/page-goto.spec.ts:182:3 › should properly cancel Cross-Origin-Opener-Policy navigation

30097 passed, 870 skipped
✔️✔️✔️

Merge workflow run.

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.

3 participants