Skip to content

fix(fetch): read constructed Blob bodies on file-reading tasks - #1690

Merged
ldm0 merged 1 commit into
wpt/20261018-native-fetch-body-consumptionfrom
wpt/20261018-constructed-blob-fetch-bodies
Nov 4, 2026
Merged

ldm0 merged 1 commit into
wpt/20261018-native-fetch-body-consumptionfrom
wpt/20261018-constructed-blob-fetch-bodies

Conversation

@ldm0

@ldm0 ldm0 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Constructing a Request or Response from a Blob eagerly copied its bytes and bypassed the Blob FileReading task and current stream state. Retain a typed native BodyInit source and create Blob-backed streams through the shared FileReading FIFO, preserving source metadata, MIME, realm ownership, and the receiver-owned Networking completion from #1689. Keep typed RequestInit conversion, bytes::Bytes storage, and lazy Blob I/O; XHR and beacon retain their existing buffered paths.

Propagate Blob/File read failures through both direct fetch and inherited Request uploads before starting transport. Fetch materializes only the selected input body, so an explicit replacement does not read an unreadable old body. Copy public and internal native Headers lists with their guards and immutability when cloning a Blob-backed Response; this fix is included here so this layer is independently safe to merge.

The unchanged Window/child and worker fixtures retain 856 and 76 assertions. New regressions use a normally responding local HTTP server and assert TypeError plus zero requests for unreadable Blob/File/FormData uploads, with successful replacement-body and GET controls. A separate 64-assertion Window/child Blob/File matrix checks independent Headers identity, mutation, entries, MIME and realm. Preserve the existing unreadable-source construction/NotReadableError checks, all 12 Request/Response/fetch/XHR paths, multipart errors, and zero author string coercions.

Integrate current main's native HTML/XML Document serialization and UTF-8 XHR charset policy with typed BodyInit buffering. Preserve URLSearchParams/text charset rewriting and the existing Blob/File/FormData/BufferSource policy.

Rebased onto main 57da451d9657 through the existing PR dependencies. Preserve this layer's reviewed behavior and the unchanged original JS fixtures.

Depends on #1689. One topic commit.

Validation before committing 3c81fabcc888, with 32 build jobs, 16 Nextest threads, and zero retries:

  • cargo fmt --all
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • 79 focused tests passed.
  • cargo nextest run --no-fail-fast: 22,377 passed, 20 skipped.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Spider Bench A/B

✅ All benchmark browser service runs completed; results are informational.

Public HEAD: 189 / 240 rows; 39 / 48 sites produced rows; 9 unexpected empty sites.

✅ Deterministic fixture contract is clean.

Common ancestor 67fed63de59d → HEAD b9ebae54ce9f; benchmark order: base-first; workflow: success.

Public 48-site run · informational

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 189 / 240 189 / 240 0 (0.00%)
Contract fill 78.75% 78.75% 0.00 pp (0.00%)
Sites with rows 39 / 48 39 / 48 0 (0.00%)
Sites meeting row contract 37 / 48 37 / 48 0 (0.00%)
Unexpected empty sites 9 9 0 (0.00%)
Partial-row sites 2 2 0 (0.00%)
Site outcomes extracted: 37; HTTP error + rows: 2; empty: 8; snapshot error + empty: 1 extracted: 38; HTTP error + rows: 1; empty: 8; snapshot error + empty: 1 —
Observed duration 43.21 s 45.14 s +1.93 s (+4.47%)
Estimated CPU 36.94 s 43.53 s +6.59 s (+17.85%)
Peak PSS 281.35 MiB 251.68 MiB -29.68 MiB (-10.55%)
Peak RSS 280.22 MiB 255.64 MiB -24.58 MiB (-8.77%)
Peak threads 30 31 +1 (+3.33%)
Mismatched sites 0 0 0
Timeout with items 0 0 0
Category rows Base HEAD Δ
news 35 / 40 35 / 40 0
stocks 20 / 40 20 / 40 0
tech 35 / 40 35 / 40 0
sports 27 / 40 27 / 40 0
games 37 / 40 37 / 40 0
life 35 / 40 35 / 40 0

Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression.

CPU and memory timelines

These are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available.

Base

xychart-beta
    title "Base CPU"
    x-axis "Elapsed seconds" [1.036, 2.037, 2.538, 3.538, 5.04, 6.042, 7.545, 8.547, 9.548, 11.05, 12.052, 13.554, 14.555, 15.557, 17.059, 18.061, 19.563, 20.565, 22.067, 23.069, 24.071, 25.573, 26.574, 28.077, 28.577, 29.078, 30.079, 31.58, 32.581, 34.083, 35.084, 36.586, 37.588, 38.59, 40.091, 41.092, 42.594, 43.095]
    y-axis "CPU percent" 0 --> 200
    line [31.97, 105.91, 135.84, 107.92, 123.74, 139.7, 157.67, 85.79, 135.95, 117.78, 19.96, 52.01, 125.75, 115.94, 43.91, 127.75, 85.79, 103.77, 111.7, 101.81, 111.72, 125.79, 97.82, 9.99, 0, 35.97, 69.94, 113.9, 17.98, 151.86, 91.9, 0, 0, 105.84, 153.81, 41.97, 137.74, 167.66]
Loading
xychart-beta
    title "Base memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.036, 1.036, 2.037, 2.538, 3.538, 5.04, 6.042, 7.545, 8.547, 9.548, 11.05, 12.052, 13.554, 14.555, 15.557, 17.059, 18.061, 19.563, 20.565, 22.067, 23.069, 24.071, 25.573, 26.574, 28.077, 28.577, 29.078, 30.079, 31.58, 32.581, 34.083, 35.084, 36.586, 37.588, 38.59, 40.091, 41.092, 42.594, 43.095, 43.21]
    y-axis "Memory MiB" 0 --> 500
    line [14.16, 85.96, 106.82, 117.43, 127.08, 151.52, 137.23, 132.21, 134.07, 135.65, 137.05, 130.97, 124.6, 161.92, 145.58, 123.93, 144.21, 146.44, 141.55, 280.22, 184.96, 197.65, 133.02, 196.64, 129.07, 129.07, 131.54, 133.29, 143.61, 141.1, 170.37, 150.58, 126.33, 126.23, 156.75, 163.11, 149.11, 163.79, 175.91, 0]
    line [11.03, 82.73, 103.51, 114.12, 123.78, 148.2, 133.92, 128.91, 130.78, 132.35, 133.91, 127.84, 121.25, 158.65, 142.26, 120.61, 140.98, 143.02, 138.04, 281.35, 181.47, 189.56, 129.62, 193.29, 125.73, 125.62, 128.09, 129.99, 140.14, 137.65, 167.07, 147.13, 122.88, 122.78, 154.08, 159.24, 145.68, 160.36, 172.46, 0]
Loading

HEAD

xychart-beta
    title "HEAD CPU"
    x-axis "Elapsed seconds" [1.036, 1.537, 2.538, 4.04, 4.54, 5.04, 6.54, 7.542, 9.044, 10.044, 11.546, 12.548, 14.051, 15.051, 16.554, 17.555, 19.058, 20.06, 21.563, 23.063, 24.065, 25.567, 26.568, 28.069, 29.07, 30.571, 31.573, 33.074, 34.076, 34.577, 35.578, 36.58, 38.083, 39.084, 40.585, 41.586, 43.087, 44.089]
    y-axis "CPU percent" 0 --> 200
    line [4, 109.72, 109.84, 115.91, 163.79, 124.04, 130.01, 135.88, 107.92, 125.99, 85.97, 133.73, 5.99, 44.02, 115.74, 121.94, 135.74, 109.84, 149.74, 128.01, 81.8, 91.88, 87.96, 69.96, 67.95, 53.94, 45.88, 80.02, 45.92, 2, 91.96, 101.71, 99.92, 99.87, 124.04, 157.83, 91.93, 111.89]
Loading
xychart-beta
    title "HEAD memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.036, 1.537, 2.538, 4.04, 4.54, 5.04, 6.54, 7.542, 9.044, 10.044, 11.546, 12.548, 14.051, 15.051, 16.554, 17.555, 19.058, 20.06, 21.563, 23.063, 24.065, 25.567, 26.568, 28.069, 29.07, 30.571, 31.573, 33.074, 34.076, 34.577, 35.578, 36.58, 38.083, 39.084, 40.585, 41.586, 43.087, 44.089, 45.142]
    y-axis "Memory MiB" 0 --> 500
    line [13.84, 64.63, 97.96, 110.52, 148.1, 133.71, 142.52, 132.28, 160.3, 155.82, 154.89, 129.06, 134.75, 132.07, 138.02, 162.16, 153.58, 159.45, 255.64, 197.86, 164.03, 148.97, 158.33, 155.18, 135.18, 140.8, 149.43, 144.59, 145.71, 144.62, 144.62, 147.75, 172.52, 177.36, 177.36, 165.8, 148.27, 143.43, 171.71, 0]
    line [10.68, 61.24, 94.57, 107.12, 144.88, 131.07, 139.18, 128.81, 156.97, 152.48, 151.44, 125.6, 132.25, 128.6, 134.63, 158.77, 150.2, 156.04, 251.68, 194.24, 160.39, 145.46, 154.69, 151.73, 131.66, 137.42, 145.98, 141.12, 142.4, 141.29, 141.29, 144.42, 169.19, 174.02, 174.02, 162.87, 145.32, 141.52, 167.57, 0]
Loading

Deterministic fixture · required contract

The fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 40 / 40 40 / 40 0 (0.00%)
Contract fill 100.00% 100.00% 0.00 pp (0.00%)
Sites with rows 8 / 15 8 / 15 0 (0.00%)
Sites meeting row contract 15 / 15 15 / 15 0 (0.00%)
Unexpected empty sites 0 0 0
Partial-row sites 0 0 0
Site outcomes extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 —
Observed duration 19.85 s 19.86 s +0.00 s (+0.02%)
Estimated CPU 0.42 s 0.41 s -0.01 s (-2.37%)
Peak PSS 69.90 MiB 70.08 MiB +0.18 MiB (+0.26%)
Peak RSS 73.44 MiB 73.55 MiB +0.11 MiB (+0.15%)
Peak threads 21 21 0 (0.00%)
Mismatched sites 0 0 0
Timeout with items 0 0 0

Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full spider-bench-results artifact.

The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Sequential Navigation Soak A/B

✅ HEAD completed the 200-navigation resilience and memory observation.

One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Page.navigate commands per binary.

Common ancestor 67fed63de5 → HEAD b9ebae54ce; benchmark order: base-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 162 / 200 186 / 200
Failures / recovered 38 / 38 14 / 14
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 1,158.4 s 793.0 s

A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence.

Process-tree memory

Metric Base HEAD Δ
Boundary samples 200 200 0
Boundary RSS samples 200 200 0
Boundary PSS samples 200 200 0
Periodic peak RSS 261.8 MiB 258.8 MiB -3.0 MiB
Periodic peak PSS 258.7 MiB 255.4 MiB -3.3 MiB
RSS · first 10 avg 170.4 MiB 171.7 MiB +1.3 MiB
RSS · last 10 avg 194.8 MiB 191.1 MiB -3.7 MiB
RSS · last − first window +24.4 MiB +19.3 MiB -5.0 MiB
RSS · warm slope / 100 nav +5.7 MiB +6.3 MiB +0.6 MiB
PSS · first 10 avg 167.2 MiB 168.4 MiB +1.2 MiB
PSS · last 10 avg 191.3 MiB 187.3 MiB -4.0 MiB
PSS · last − first window +24.1 MiB +18.9 MiB -5.2 MiB
PSS · warm slope / 100 nav +5.5 MiB +6.2 MiB +0.6 MiB
Peak file descriptors 67 65 -2
Peak threads 33 33 0

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 176.4 MiB 125.4 MiB 222.0 MiB 172.9 MiB 121.8 MiB 59
51–100 192.3 MiB 222.1 MiB 236.6 MiB 188.6 MiB 218.3 MiB 60
101–150 191.5 MiB 132.9 MiB 237.2 MiB 187.8 MiB 129.2 MiB 61
151–200 189.8 MiB 219.9 MiB 234.1 MiB 186.0 MiB 216.1 MiB 60

Raw reports and per-navigation boundary samples: workflow run and full sequential-navigation-soak-results artifact.

Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

CI Regression Report

Source CI run · source state at render: in_progress · artifacts: 6/6

Check Status Signal
Release regression ✅ HEAD/base failures 0/0; raw binary +0.006053%
Frontend differential ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes ✅ 8/8 Moli episodes passed; 0 failures
Runtime/CDP contracts ✅ 26 contract cases; 0 failures
CDP smoke ✅ 108/108 groups passed; 1,402 scenarios
WebMainBench ✅ 545/545 completed; 0 unexpected failures
Release regression — ✅ HEAD/base failures 0/0; raw binary +0.006053%

Package and image size

Metric Base HEAD Delta Delta %
Raw binary 153.28 MiB 153.28 MiB +9.50 KiB +0.006053%
Stripped binary 105.86 MiB 105.86 MiB +8.00 KiB +0.007380%
gzip binary 52.84 MiB 52.85 MiB +4.83 KiB +0.008928%
Rootfs 160.18 MiB 160.19 MiB +10.00 KiB +0.006097%
gzip rootfs 61.89 MiB 61.89 MiB +4.37 KiB +0.006898%

Startup latency and PSS

Case Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta
Serve ready 26.88 ms 26.89 ms +0.00 ms 4.80 MiB 4.40 MiB −412.50 KiB
CDP first page 49.12 ms 49.43 ms +0.31 ms 4.53 MiB 4.77 MiB +253.00 KiB
CDP warm page 12.25 ms 12.14 ms −0.12 ms 52.72 MiB 52.50 MiB −226.50 KiB
CLI about:blank 18.45 ms 18.49 ms +0.05 ms 5.62 MiB 4.40 MiB −1.22 MiB
CLI local JS 24.39 ms 25.29 ms +0.90 ms 3.97 MiB 4.04 MiB +77.50 KiB

Concurrency matrix

Concurrency Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta HEAD failures Unstable B/H
1 23.57 ms 23.50 ms −0.07 ms 643.00 KiB 659.00 KiB +16.00 KiB 0 0/0
5 26.45 ms 25.52 ms −0.93 ms 13.56 MiB 13.51 MiB −49.75 KiB 0 0/0
10 26.86 ms 26.34 ms −0.52 ms 13.00 MiB 12.26 MiB −755.00 KiB 0 0/0
25 26.06 ms 27.59 ms +1.53 ms 13.40 MiB 13.02 MiB −392.00 KiB 0 0/0
100 27.12 ms 27.46 ms +0.35 ms 13.12 MiB 13.54 MiB +431.00 KiB 0 0/0
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Match DOM mismatch Diagnostic mismatch Moli error Reference error Infrastructure error Mismatched frames Duration
1,020 0 0 0 0 0 0 6m 41.45s
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Fast contract Episodes Passed Assertions Ready p50 Episode p50
Moli 8 8 47/47 28.54 ms 29.41 ms
Chromium 8 8 47/47 259.59 ms 80.13 ms
Operation p50 Chromium Moli Delta Delta %
navigate 42.32 ms 5.72 ms −36.60 ms −86.49%
observe 0.79 ms 0.90 ms +0.11 ms +14.13%
fill 3.39 ms 3.51 ms +0.12 ms +3.65%
click 5.19 ms 3.81 ms −1.38 ms −26.56%
Idle-resource episode Peak RSS Peak PSS Average CPU Peak CPU Peak processes Sampler
Moli 70.18 MiB 66.52 MiB 0.78% 10.02% 1 ✅
Chromium 1277.50 MiB 324.23 MiB 0.54% 6.00% 13 ⚠️ PSS partial
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
Suite Cases Failures Median case p50 Median case p95 Median peak PSS p50
Synthetic fetch 13 0 33.94 ms 39.15 ms 629.00 KiB
Long-lived CDP session 13 0 19.38 ms 21.45 ms —
CDP smoke — ✅ 108/108 groups passed; 1,402 scenarios

Workers: 4 · cumulative group time: 470.73 s · failed groups: 0

Slowest group Scenarios Duration Status
dom-input 62 28.77 s ✅
dom-input 62 28.60 s ✅
scrollbar-visibility 22 28.11 s ✅
scrollbar-visibility 22 27.61 s ✅
target-lifecycle 25 23.07 s ✅
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Completed Successful Expected DNS failure Unexpected failures Panics Crashes Timeouts Empty output
545/545 544 1 0 0 0 0 0

Frozen HTML · Linux · --wait done · 45 seconds per page · no retries. Content quality is evaluated separately.

Diagnostics: webmainbench-results — every page's Markdown, stderr, and exit status. Source run and artifacts

All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable.

@ldm0
ldm0 added this pull request to stack #1695 October 18, 2026 11:51
@lanyue-llk lanyue-llk changed the title fix(fetch): read constructed Blob bodies on file-reading tasks fix(fetch): handle Blob bodies and consolidate benchmark docs Oct 26, 2026
@lanyue-llk lanyue-llk changed the title fix(fetch): handle Blob bodies and consolidate benchmark docs fix(fetch): read constructed Blob bodies on file-reading tasks Oct 26, 2026
@lanyue-llk

Copy link
Copy Markdown
Contributor

The README commit was applied here by mistake and has been fully reverted in 7c2dc73. This PR again contains only its original Blob-body code and tests; the README work is in #1609.

@ldm0
ldm0 force-pushed the wpt/20261018-constructed-blob-fetch-bodies branch from 7c2dc73 to bce8b5f Compare November 3, 2026 14:17
@ldm0
ldm0 force-pushed the wpt/20261018-constructed-blob-fetch-bodies branch from bce8b5f to b9ebae5 Compare November 3, 2026 18:44
@ldm0
ldm0 force-pushed the wpt/20261018-constructed-blob-fetch-bodies branch from b9ebae5 to 3c81fab Compare November 4, 2026 06:38
@ldm0
ldm0 merged commit dbdf0d0 into main Nov 4, 2026
9 of 10 checks passed
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.

2 participants