Skip to content

fix(har): WebSocket message timestamps should be in milliseconds#41364

Merged
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41360
Jun 18, 2026
Merged

fix(har): WebSocket message timestamps should be in milliseconds#41364
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41360

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

the timestamp should also be multipled by 1000 just like the walltime

fixes #41360

@dcrousso dcrousso requested review from dgozman and yury-s June 18, 2026 19:51
this._timestampBaselineForWebSocket.set(event.requestId, wallTimeMs - event.timestamp);
this._page!.frameManager.onWebSocketRequest(event.requestId, headersObjectToArray(event.request.headers, '\n'), wallTimeMs);
this._timestampBaselineForWebSocket.set(event.requestId, event.wallTime - event.timestamp);
this._page!.frameManager.onWebSocketRequest(event.requestId, headersObjectToArray(event.request.headers, '\n'), event.wallTime);

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.

FrameManager.onWebSocketRequest receives wallTimeMs, but event.wallTime is time since epoch in seconds in chromium. Shouldn't the units match?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh shoot good catch! yes i make sure this is not affected by the fix

@dcrousso dcrousso force-pushed the fix-41360 branch 2 times, most recently from fc7a0bd to 3b2fd77 Compare June 18, 2026 20:20
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

_onWebSocketWillSendHandshakeRequest(event: Protocol.Network.webSocketWillSendHandshakeRequestPayload) {
const wallTimeMs = event.walltime * 1000;
this._timestampBaselineForWebSocket.set(event.requestId, wallTimeMs - event.timestamp);
this._timestampBaselineForWebSocket.set(event.requestId, wallTimeMs - (event.timestamp * 1000));

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.

nit drop braces

Suggested change
this._timestampBaselineForWebSocket.set(event.requestId, wallTimeMs - (event.timestamp * 1000));
this._timestampBaselineForWebSocket.set(event.requestId, wallTimeMs - event.timestamp * 1000);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i personally like the extra clarity just in case, but if this is our style then i can follow :)

the `timestamp` should also be multipled by 1000 just like the `walltime`
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7354 passed, 1122 skipped


Merge workflow run.

@dcrousso dcrousso merged commit 0dd2bb9 into microsoft:main Jun 18, 2026
48 of 49 checks passed
@dcrousso dcrousso deleted the fix-41360 branch June 18, 2026 23:57
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

Warning

The triggering workflow run ended with status cancelled. Results below may be incomplete — blob reports from cancelled or timed-out shards are missing, so passing/failing counts do not reflect the full test suite.

5 flaky ⚠️ [installation tests] › playwright-component-testing.spec.ts:21 › pnpm: @playwright/experimental-ct-react should work `@package-installations-windows-latest`
⚠️ [chromium-library] › library/har-websocket.spec.ts:231 › should embed websocket messages `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:645 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:816 › should update state on subsequent run `@windows-latest-node22`

35083 passed, 583 skipped


Merge workflow run.

dgozman pushed a commit that referenced this pull request Jun 19, 2026
…be in milliseconds

the `timestamp` should also be multipled by 1000 just like the `walltime`

fixes <#41360>
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]: Trace viewer: message times in websockets are downscaled by 1000

2 participants