Skip to content

fix(renderer): use native prototypes for browser-created objects - #1585

Merged
ldm0 merged 1 commit into
mainfrom
codex/webfetch-prototypes
Oct 15, 2026
Merged

ldm0 merged 1 commit into
mainfrom
codex/webfetch-prototypes

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Replacing public constructors could change or break browser-created CustomElementRegistry, MediaError and HTMLAllCollection objects. Custom-element definitions also missed the supported move callback when the public Element constructor was replaced.

Change

Use the saved realm-native interface prototypes and existing callback collection. Keep author-visible constructor replacement separate from the native objects the browser creates; cover both live and detached document collections.

This preserves existing native object behavior and callback support. It adds no new browser interface.

Reproduce and verify

Save HTMLAllCollection.prototype, replace window.HTMLAllCollection, then read document.all and a detached document's collection. Both must keep the saved prototype and working native methods. Companion fixtures replace CustomElementRegistry, Element and MediaError before exercising native construction and callbacks.

cargo nextest run --locked -p moli-renderer-v8 --lib -E 'test(public_constructor_replacement) | test(custom_element_move_callback_support)' --no-fail-fast

Before extraction, this source passed cargo fmt --all, workspace/all-target/all-feature Clippy with -D warnings, and the full workspace nextest suite (20,140 passed, 17 skipped). This unit has no source changes since that validation. The PR CI checks its extraction onto main be610b8fe.

Regression fixtures:

Dependencies

Independent change targeting main; no other open PR is required. Extracted from #1501. Review map and sibling PRs.

Review units and their dependencies

@github-actions

github-actions Bot commented Oct 15, 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 be610b8fe3 → HEAD 6473dd43fd; benchmark order: head-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 193 / 200 193 / 200
Failures / recovered 7 / 7 7 / 7
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 784.1 s 832.5 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 244.5 MiB 246.3 MiB +1.8 MiB
Periodic peak PSS 241.3 MiB 242.9 MiB +1.6 MiB
RSS · first 10 avg 155.6 MiB 180.1 MiB +24.5 MiB
RSS · last 10 avg 193.8 MiB 186.2 MiB -7.6 MiB
RSS · last − first window +38.2 MiB +6.1 MiB -32.1 MiB
RSS · warm slope / 100 nav +5.6 MiB +0.2 MiB -5.4 MiB
PSS · first 10 avg 152.1 MiB 176.5 MiB +24.5 MiB
PSS · last 10 avg 190.2 MiB 182.7 MiB -7.5 MiB
PSS · last − first window +38.1 MiB +6.2 MiB -32.0 MiB
PSS · warm slope / 100 nav +5.7 MiB +0.0 MiB -5.6 MiB
Peak file descriptors 61 62 1
Peak threads 29 31 2

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 181.1 MiB 166.5 MiB 242.1 MiB 177.6 MiB 163.1 MiB 55
51–100 182.3 MiB 172.2 MiB 245.3 MiB 179.0 MiB 168.6 MiB 55
101–150 183.4 MiB 164.7 MiB 237.6 MiB 179.9 MiB 161.2 MiB 54
151–200 184.2 MiB 176.9 MiB 238.2 MiB 180.7 MiB 173.4 MiB 58

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 15, 2026 •

Copy link
Copy Markdown

Spider Bench A/B

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

Public HEAD: 184 / 240 rows; 38 / 48 sites produced rows; 10 unexpected empty sites.

✅ Deterministic fixture contract is clean.

Common ancestor be610b8fe391 → HEAD 6473dd43fde0; benchmark order: head-first; workflow: success.

Public 48-site run · informational

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 184 / 240 184 / 240 0 (0.00%)
Contract fill 76.67% 76.67% 0.00 pp (0.00%)
Sites with rows 38 / 48 38 / 48 0 (0.00%)
Sites meeting row contract 36 / 48 36 / 48 0 (0.00%)
Unexpected empty sites 10 10 0 (0.00%)
Partial-row sites 2 2 0 (0.00%)
Site outcomes extracted: 37; HTTP error + rows: 1; empty: 7; HTTP error + empty: 1; snapshot error + empty: 2 extracted: 36; HTTP error + rows: 2; empty: 7; HTTP error + empty: 1; snapshot error + empty: 2 —
Observed duration 50.68 s 49.54 s -1.14 s (-2.24%)
Estimated CPU 52.34 s 46.96 s -5.38 s (-10.27%)
Peak PSS 260.84 MiB 289.05 MiB +28.21 MiB (+10.81%)
Peak RSS 264.56 MiB 292.89 MiB +28.32 MiB (+10.71%)
Peak threads 26 26 0 (0.00%)
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 30 / 40 30 / 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.537, 2.537, 3.038, 4.538, 5.54, 7.042, 8.542, 10.043, 11.545, 13.046, 14.047, 15.55, 17.051, 18.554, 20.055, 21.056, 21.557, 22.557, 24.059, 25.561, 27.063, 28.565, 30.065, 31.067, 32.57, 34.072, 35.574, 37.076, 38.577, 39.578, 41.079, 41.579, 42.581, 44.082, 45.584, 47.086, 48.088, 49.59]
    y-axis "CPU percent" 0 --> 500
    line [119.88, 133.86, 135.8, 165.78, 201.72, 155.78, 157.94, 175.48, 155.75, 143.84, 95.92, 127.84, 133.87, 81.97, 77.85, 0, 4, 0, 0, 155.59, 119.83, 149.98, 111.97, 101.81, 117.79, 113.74, 152.05, 77.9, 7.99, 7.99, 135.85, 119.89, 83.89, 13.98, 61.92, 111.78, 21.97, 113.82]
Loading
xychart-beta
    title "Base memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.537, 2.537, 3.038, 4.538, 5.54, 7.042, 8.542, 10.043, 11.545, 13.046, 14.047, 15.55, 17.051, 18.554, 20.055, 21.056, 21.557, 22.557, 24.059, 25.561, 27.063, 28.565, 30.065, 31.067, 32.57, 34.072, 35.574, 37.076, 38.577, 39.578, 41.079, 41.579, 42.581, 44.082, 45.584, 47.086, 48.088, 49.59, 50.677]
    y-axis "Memory MiB" 0 --> 500
    line [12.41, 115.11, 123.48, 133.07, 142.08, 178.24, 225.22, 234.82, 185.22, 191.15, 171.34, 169.54, 191.98, 158.13, 161.71, 178.52, 149, 147.29, 147.29, 151.79, 174.32, 160.28, 175.74, 212.21, 215.39, 158.3, 187.38, 157.55, 165.9, 155.92, 156.99, 213.42, 264.56, 263.05, 187.02, 184.13, 205.15, 171.26, 173.16, 0]
    line [9.08, 111.41, 119.82, 129.79, 138.43, 174.65, 221.64, 231.09, 180.7, 187.46, 167.55, 165.92, 187.93, 154.4, 157.98, 174.79, 145.27, 143.56, 143.56, 148.06, 170.75, 156.6, 172.46, 208.53, 211.66, 154.58, 183.7, 153.67, 162.37, 152.21, 153.27, 209.7, 260.84, 259.6, 183.4, 180.66, 201.49, 167.55, 169.46, 0]
Loading

HEAD

xychart-beta
    title "HEAD CPU"
    x-axis "Elapsed seconds" [1.538, 2.54, 3.041, 4.043, 5.545, 7.047, 8.549, 9.549, 11.052, 12.553, 14.056, 15.057, 16.56, 18.062, 19.564, 20.565, 22.068, 23.57, 24.571, 25.072, 26.073, 27.576, 29.078, 30.58, 31.581, 33.083, 34.585, 36.087, 37.088, 38.589, 40.092, 41.593, 42.595, 44.096, 45.599, 46.099, 47.1, 48.101]
    y-axis "CPU percent" 0 --> 200
    line [131.79, 141.63, 131.8, 87.82, 157.75, 167.87, 133.65, 177.88, 63.94, 69.95, 121.88, 27.95, 83.93, 17.98, 57.95, 137.81, 95.88, 139.78, 109.96, 113.84, 125.76, 65.89, 147.94, 127.7, 77.89, 133.97, 13.99, 0, 2, 103.92, 73.79, 7.99, 15.98, 109.84, 115.88, 187.69, 69.99, 121.87]
Loading
xychart-beta
    title "HEAD memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.538, 2.54, 3.041, 4.043, 5.545, 7.047, 8.549, 9.549, 11.052, 12.553, 14.056, 15.057, 16.56, 18.062, 19.564, 20.565, 22.068, 23.57, 24.571, 25.072, 26.073, 27.576, 29.078, 30.58, 31.581, 33.083, 34.585, 36.087, 37.088, 38.589, 40.092, 41.593, 42.595, 44.096, 45.599, 46.099, 47.1, 48.101, 49.54]
    y-axis "Memory MiB" 0 --> 500
    line [12.37, 115.07, 113.01, 136.8, 132.06, 197.8, 170.17, 182, 172.21, 151.52, 173.81, 161.55, 147.44, 162.96, 196.88, 152.85, 176.49, 167.61, 177.4, 292.89, 208.08, 216.05, 155.91, 189.29, 172.6, 156.45, 173.43, 155.75, 158.67, 157.86, 171.83, 170.14, 153.27, 151.93, 161.65, 181.68, 171.91, 154.64, 173.71, 0]
    line [9.12, 111.5, 109.48, 133.21, 128.45, 190.84, 165.32, 178.4, 168.61, 147.91, 170.21, 158.47, 143.81, 159.39, 193.3, 149.22, 172.96, 163.99, 173.87, 289.05, 204.5, 212.54, 152.31, 185.96, 169.01, 152.85, 169.98, 152.16, 155.08, 154.28, 168.35, 166.61, 149.68, 148.23, 158.14, 178, 168.71, 151.01, 170.09, 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.86 s 19.89 s +0.03 s (+0.17%)
Estimated CPU 0.40 s 0.47 s +0.07 s (+17.16%)
Peak PSS 66.86 MiB 67.01 MiB +0.15 MiB (+0.22%)
Peak RSS 70.36 MiB 70.46 MiB +0.10 MiB (+0.14%)
Peak threads 18 18 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 15, 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.00%
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 ✅ 52/52 groups passed; 621 scenarios
WebMainBench ✅ 545/545 completed; 0 unexpected failures
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%

Package and image size

Metric Base HEAD Delta Delta %
Raw binary 153.02 MiB 153.02 MiB 0 B 0.00%
Stripped binary 106.34 MiB 106.34 MiB 0 B 0.00%
gzip binary 52.70 MiB 52.70 MiB −238 B −0.000431%
Rootfs 159.92 MiB 159.92 MiB 0 B 0.00%
gzip rootfs 61.74 MiB 61.74 MiB −760 B −0.001174%

Startup latency and PSS

Case Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta
Serve ready 27.23 ms 27.38 ms +0.15 ms 3.83 MiB 4.57 MiB +752.00 KiB
CDP first page 51.01 ms 49.50 ms −1.51 ms 3.54 MiB 3.97 MiB +444.50 KiB
CDP warm page 12.55 ms 11.60 ms −0.94 ms 49.79 MiB 50.46 MiB +685.00 KiB
CLI about:blank 15.17 ms 16.27 ms +1.11 ms 2.48 MiB 3.98 MiB +1.50 MiB
CLI local JS 18.30 ms 18.37 ms +0.07 ms 3.46 MiB 3.92 MiB +474.50 KiB

Concurrency matrix

Concurrency Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta HEAD failures Unstable B/H
1 18.09 ms 17.99 ms −0.10 ms 688.00 KiB 683.00 KiB −5.00 KiB 0 0/0
5 19.53 ms 21.14 ms +1.62 ms 13.62 MiB 27.27 MiB +13.65 MiB 0 0/0
10 21.22 ms 20.74 ms −0.48 ms 18.10 MiB 12.59 MiB −5.51 MiB 0 0/0
25 19.39 ms 19.48 ms +0.09 ms 27.67 MiB 13.33 MiB −14.35 MiB 0 0/0
100 20.09 ms 20.22 ms +0.13 ms 28.33 MiB 14.03 MiB −14.29 MiB 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 35.55s
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 3.83 ms 25.54 ms
Chromium 8 8 47/47 294.92 ms 96.21 ms
Operation p50 Chromium Moli Delta Delta %
navigate 45.56 ms 5.94 ms −39.62 ms −86.96%
observe 2.07 ms 0.97 ms −1.10 ms −53.25%
fill 4.96 ms 3.48 ms −1.48 ms −29.81%
click 6.31 ms 4.12 ms −2.19 ms −34.65%
Idle-resource episode Peak RSS Peak PSS Average CPU Peak CPU Peak processes Sampler
Moli 66.77 MiB 64.69 MiB 0.82% 10.01% 1 ✅
Chromium 1309.45 MiB 417.34 MiB 2.45% 95.69% 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 18.22 ms 18.98 ms 683.00 KiB
Long-lived CDP session 13 0 17.59 ms 18.41 ms —
CDP smoke — ✅ 52/52 groups passed; 621 scenarios

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

Slowest group Scenarios Duration Status
scrollbar-visibility 22 28.62 s ✅
target-lifecycle 24 16.49 s ✅
dom-input 27 12.87 s ✅
multi-page 45 10.91 s ✅
chromium-cdp 56 10.88 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.

@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-prototypes branch from 431cf7b to 6473dd4 Compare October 15, 2026 13:35
@ldm0 ldm0 added the 1.1.18 label Oct 15, 2026
@ldm0
ldm0 merged commit 55deac6 into main Oct 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants