[Bug]: bidi reports transfer size as responseBodySize, so request().sizes() over-reports the body by the header size
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- networking
調査の方向性
packages/playwright-core/src/server/bidi/bidiNetworkManager.ts:168 から始め、network.ts:719 のフォールバック関係と、issue に記載されている CDP の処理を比較します。BiDi Network.ResponseData が bodySize とともに headersSize を提供しているかを確認します。reproduction およびその他の response 形状について、request().sizes() が 2000 バイトの body と response headers を別々に報告すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Version
1.64.0-next, d1ead3ecc. Chrome 141 over --project=bidi-chrome-page.
Steps to reproduce
Serve a body of a known length and read sizes():
server.setRoute('/fixed', (req, res) => {
const plain = 'x'.repeat(2000);
res.writeHead(200, { 'content-type': 'text/plain', 'content-length': String(plain.length) });
res.end(plain);
});
const resp = await page.goto(server.PREFIX + '/fixed');
console.log(await resp.request().sizes());
Expected
responseBodySize of 2000, as chromium over CDP reports:
chromium (CDP) {"requestBodySize":0,"requestHeadersSize":674,"responseBodySize":2000,"responseHeadersSize":151}
Actual
bidi-chrome {"requestBodySize":0,"requestHeadersSize":343,"responseBodySize":2151,"responseHeadersSize":132}
2151 for a 2000 byte body. That number is exactly CDP's body plus CDP's header size (2000 + 151), so what is coming back is the whole transfer, headers included, in the body field. Same overshoot on the other shapes I tried: a gzipped body whose encoded length is 35 reports 208, and a chunked response whose wire body is 15 reports 172.
Cause
packages/playwright-core/src/server/bidi/bidiNetworkManager.ts:168:
response.setTransferSize(params.response.bodySize);
response.setEncodedBodySize(params.response.bodySize);
One protocol field feeds two different metrics. The codebase treats them as distinct, and network.ts:719 spells the relationship out in the fallback path:
transferSize = responseHeadersSize + encodedBodySize;
so setting both from one value cannot be right for both. CDP keeps them apart:
response.setTransferSize(event.encodedDataLength);
response.responseHeadersSize().then(size => response.setEncodedBodySize(event.encodedDataLength - size));
WebKit only sets setEncodedBodySize(event.metrics?.responseBodyBytesReceived) and leaves transfer size to the fallback.
If BiDi's network.ResponseData carries headersSize alongside bodySize, subtracting it the way CDP does would line the two up. I did not check what Chrome actually populates there, so that part is a suggestion rather than a diagnosis.
Scope
Only the bidi backend, which I realise is still experimental and tracked under #32577, so this is a low-priority one. Filing it discretely because the value is plainly wrong rather than merely missing, and the cause is two lines.
I am a freshman in college doing my best to contribute usefully, so if bidi gaps are better collected on #32577 than filed one by one, tell me and I will move it there.
- 主要言語
- TypeScript
- スター
- 100k
- フォーク
- 6.9k
- 平均マージ
- 16時間 8分
- マージ済み PR(30日)
- 281
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright のほかの issue
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/playwright#44289 ·
メンテナーはふだん 1 日以内に返信
-
agent-triage-done
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/playwright#44264 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
microsoft/playwright#44290 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
microsoft/playwright#44288 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: page.goto never returns for a load started as a newer service worker takes over (Chromium)オープン
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
microsoft/playwright#44287 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright の issue をすべて見る
似ている issue
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
openclaw/openclaw#203385 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nwverse/persona#12800 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 半日 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
WISE-Community/WISE-Client#2404 ·
メンテナーはふだん 1 日以内に返信