Skip to content

fix(window): materialize lazy surfaces on retained detached globals - #1783

Open
ldm0 wants to merge 2 commits into
mainfrom
fix/detached-window-lazy-surfaces-20261021
Open

ldm0 wants to merge 2 commits into
mainfrom
fix/detached-window-lazy-surfaces-20261021

Conversation

@ldm0

@ldm0 ldm0 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Retaining an iframe Window and removing the frame before the first screen read returned undefined. Let the exact retained native global materialize an untouched lazy surface in its original Realm, while preserving native receiver checks, cross-origin authorization, captured objects, and SameObject identity.

The regression coverage now includes cold Screen reads and detached geometry, plus first Navigator/Performance reads after removal. The added test confirms both instances remain unmaterialized until detach, checks the original Realm prototypes and Navigator alias identity, compares Performance.timeOrigin with the native seed captured before detach, and ensures parent instances remain lazy.

Fixes 9f11881c1a5c9a1715245da3294af719b1d1b467 (#1651). This PR is independent of the other runtime splits from #1726.

Validation on d088b38371a:

  • cargo fmt --all
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo nextest run --no-fail-fast: 20,435 passed, 18 skipped, using default machine parallelism. The new cold Navigator/Performance test passed.

The original frontend timeouts did not reproduce on unchanged production code: the CI rerun completed successfully, including 1,020/1,020 matched frontend cases. Earlier focused rechecks matched all five reported cases, and full parent/head artifact rechecks each matched 1,020 cases with identical Chromium timelines. This follow-up adds test coverage only; the production patch remains unchanged.

No aggregate Cases snapshot or documentation is included.

A retained child's original SameObject getter captured undefined when
its lazy surface had never been read. Returning that snapshot after retirement
made Window.screen disappear when an iframe was removed before its first read.

Use captured objects when present, and let the exact retained native global
materialize an untouched surface in its original Realm. Retain receiver and
cross-origin authorization. Cover cold Screen reads, identity and zero geometry.

Fixes: 9f11881 (PR #1651)

Validate this independent patch on main ce0781f:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast
     Summary [ 380.812s] 20434 tests run: 20434 passed, 18 skipped

Original-commit: f202f5d
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

CI Regression Report

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

Check Status Signal
Release regression ✅ HEAD/base failures 0/0; raw binary 0.00%
Frontend differential ❌ 1,015/1,020 cases matched; 5 issues
Agent episodes ⚪ artifact unavailable or invalid
Runtime/CDP contracts ✅ 26 contract cases; 0 failures
CDP smoke ✅ 52/52 groups passed; 622 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.42 MiB 153.42 MiB 0 B 0.00%
Stripped binary 106.66 MiB 106.66 MiB 0 B 0.00%
gzip binary 52.85 MiB 52.85 MiB +852 B +0.001538%
Rootfs 160.32 MiB 160.32 MiB 0 B 0.00%
gzip rootfs 61.90 MiB 61.90 MiB +851 B +0.001311%

Startup latency and PSS

Case Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta
Serve ready 27.68 ms 27.11 ms −0.57 ms 3.61 MiB 4.67 MiB +1.06 MiB
CDP first page 52.30 ms 49.37 ms −2.94 ms 3.53 MiB 4.68 MiB +1.14 MiB
CDP warm page 13.36 ms 11.88 ms −1.48 ms 49.30 MiB 51.15 MiB +1.85 MiB
CLI about:blank 39.22 ms 37.61 ms −1.62 ms 2.98 MiB 4.65 MiB +1.67 MiB
CLI local JS 42.35 ms 41.40 ms −0.95 ms 3.39 MiB 3.16 MiB −234.50 KiB

Concurrency matrix

Concurrency Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta HEAD failures Unstable B/H
1 42.52 ms 40.79 ms −1.73 ms 549.00 KiB 600.00 KiB +51.00 KiB 0 0/0
5 42.86 ms 41.22 ms −1.64 ms 1.46 MiB 1.51 MiB +49.00 KiB 0 0/0
10 42.60 ms 40.75 ms −1.85 ms 1.46 MiB 1.50 MiB +45.00 KiB 0 0/0
25 44.19 ms 41.49 ms −2.70 ms 4.10 MiB 1.51 MiB −2.59 MiB 0 0/0
100 42.23 ms 41.25 ms −0.98 ms 1.52 MiB 2.71 MiB +1.19 MiB 0 0/0
Frontend differential — ❌ 1,015/1,020 cases matched; 5 issues
Match DOM mismatch Diagnostic mismatch Moli error Reference error Infrastructure error Mismatched frames Duration
1,015 0 0 5 0 0 0 12m 6.58s

First failing cases

  • react/history-navigation-boundaries/fragment-anchor-target — moli_error · Moli error unknown
  • react/history-navigation-boundaries/state-clone-security-errors — moli_error · Moli error unknown
  • react/history-navigation-boundaries/scroll-restoration-traversal — moli_error · Moli error unknown
  • react/history-navigation-boundaries/navigation-current-entry-state — moli_error · Moli error unknown
  • react/history-navigation-boundaries/navigation-intercept-lifecycle — moli_error · Moli error unknown
Agent episodes · Moli vs Chromium — ⚪ artifact unavailable or invalid

Artifact unavailable or invalid. See the source CI run for infrastructure details.

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 41.73 ms 42.30 ms 639.00 KiB
Long-lived CDP session 13 0 17.46 ms 18.13 ms —
CDP smoke — ✅ 52/52 groups passed; 622 scenarios

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

Slowest group Scenarios Duration Status
scrollbar-visibility 22 20.48 s ✅
target-lifecycle 24 14.48 s ✅
dom-input 27 11.10 s ✅
multi-page 45 10.03 s ✅
chromium-cdp 56 9.79 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.

@github-actions

github-actions Bot commented Oct 21, 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 ce0781f2ad7e → HEAD d088b38371a7; 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 56.59 s 46.04 s -10.55 s (-18.64%)
Estimated CPU 34.90 s 36.88 s +1.98 s (+5.67%)
Peak PSS 230.43 MiB 249.21 MiB +18.78 MiB (+8.15%)
Peak RSS 233.96 MiB 258.89 MiB +24.93 MiB (+10.66%)
Peak threads 26 27 +1 (+3.85%)
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.536, 3.039, 4.04, 4.541, 6.542, 8.044, 9.544, 11.044, 12.546, 14.048, 15.55, 17.555, 19.057, 20.558, 21.059, 22.062, 23.562, 24.063, 25.064, 26.567, 28.569, 30.07, 31.571, 33.071, 34.574, 36.077, 37.581, 39.084, 41.086, 42.587, 44.087, 45.587, 47.087, 48.59, 50.093, 52.097, 53.599, 55.102]
    y-axis "CPU percent" 0 --> 200
    line [2, 17.96, 0, 4, 106, 121.84, 129.98, 114.02, 129.78, 133.73, 67.87, 59.87, 21.97, 43.93, 157.71, 65.82, 109.96, 99.89, 109.86, 113.74, 129.61, 89.98, 71.93, 29.99, 99.84, 0, 3.99, 0, 0, 2, 2, 2, 0, 2, 81.86, 35.92, 111.96, 103.93]
Loading
xychart-beta
    title "Base memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.036, 1.536, 3.039, 4.04, 4.541, 6.542, 8.044, 9.544, 11.044, 12.546, 14.048, 15.55, 17.555, 19.057, 20.558, 21.059, 22.062, 23.562, 24.063, 25.064, 26.567, 28.569, 30.07, 31.571, 33.071, 34.574, 36.077, 37.581, 39.084, 41.086, 42.587, 44.087, 45.587, 47.087, 48.59, 50.093, 52.097, 53.599, 55.102, 56.591]
    y-axis "Memory MiB" 0 --> 500
    line [13.64, 61.96, 90.91, 79.65, 79.83, 122.28, 147.03, 125.53, 145.57, 133.31, 142.22, 138.15, 144.96, 118.13, 131.61, 149.28, 124.71, 159.93, 233.96, 175.57, 207.18, 164.86, 157.34, 146.91, 136.48, 131.21, 129.82, 128.13, 128.13, 128.13, 128.13, 128.13, 128.13, 128.13, 128.13, 145.61, 140.11, 155.77, 139.15, 0]
    line [10.34, 58.53, 87.48, 76.21, 76.45, 118.89, 143.59, 122.3, 141.94, 129.71, 139.17, 134.6, 141.41, 114.6, 128.09, 145.83, 121.16, 156.38, 230.43, 172.01, 203.66, 160.75, 153.92, 143.47, 133.23, 127.97, 126.58, 124.89, 124.89, 124.71, 124.88, 124.88, 124.76, 124.76, 124.76, 142.25, 134.02, 152.4, 135.61, 0]
Loading

HEAD

xychart-beta
    title "HEAD CPU"
    x-axis "Elapsed seconds" [1.035, 1.536, 2.538, 4.04, 5.041, 6.544, 7.544, 9.046, 10.047, 11.547, 13.051, 14.051, 15.551, 16.551, 18.054, 18.555, 19.056, 20.557, 21.557, 23.06, 24.564, 25.064, 25.564, 27.066, 28.067, 29.569, 30.569, 32.072, 33.072, 34.575, 36.076, 37.078, 38.58, 39.58, 41.082, 42.084, 43.585, 44.585]
    y-axis "CPU percent" 0 --> 200
    line [2, 91.8, 4, 123.8, 85.89, 123.7, 145.98, 139.63, 99.98, 69.95, 129.74, 15.99, 6, 99.97, 41.91, 0, 5.99, 42.01, 93.93, 117.77, 109.75, 105.89, 113.94, 103.88, 129.76, 127.93, 99.9, 99.72, 73.94, 8, 95.82, 39.98, 3.99, 0, 85.97, 119.69, 14, 120]
Loading
xychart-beta
    title "HEAD memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.035, 1.035, 1.536, 2.538, 4.04, 5.041, 6.544, 7.544, 9.046, 10.047, 11.547, 13.051, 14.051, 15.551, 16.551, 18.054, 18.555, 19.056, 20.557, 21.557, 23.06, 24.564, 25.064, 25.564, 27.066, 28.067, 29.569, 30.569, 32.072, 33.072, 34.575, 36.076, 37.078, 38.58, 39.58, 41.082, 42.084, 43.585, 44.585, 46.04]
    y-axis "Memory MiB" 0 --> 500
    line [13.56, 64.73, 89.89, 80.21, 129.74, 124.53, 140.41, 142.17, 147.8, 146.42, 134.45, 157.79, 141.47, 122.92, 146.8, 131.36, 131.64, 116.18, 129.84, 161.85, 141.51, 203.4, 258.89, 171.25, 190.66, 209.45, 153.71, 167.29, 132.84, 141.09, 127.81, 167.85, 129.89, 137.5, 125.45, 134.22, 150.88, 129.44, 145.78, 0]
    line [10.37, 61.32, 86.71, 76.81, 126.59, 121.16, 137.01, 138.77, 144.52, 143.02, 131.06, 154.43, 138.04, 119.34, 143.21, 127.92, 128.2, 112.74, 126.31, 158.31, 138.01, 199.78, 249.21, 167.87, 187.2, 206, 150.9, 163.66, 129.28, 138.42, 124.25, 163.84, 126.33, 133.94, 121.89, 130.67, 147.32, 125.89, 143.22, 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.90 s 19.86 s -0.05 s (-0.25%)
Estimated CPU 0.42 s 0.42 s +0.00 s (+0.24%)
Peak PSS 67.63 MiB 67.66 MiB +0.03 MiB (+0.05%)
Peak RSS 70.96 MiB 71.02 MiB +0.05 MiB (+0.08%)
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 21, 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 ce0781f2ad → HEAD d088b38371; benchmark order: head-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 199 / 200 199 / 200
Failures / recovered 1 / 1 1 / 1
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 502.1 s 405.1 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 257.3 MiB 233.9 MiB -23.4 MiB
Periodic peak PSS 253.5 MiB 230.3 MiB -23.2 MiB
RSS · first 10 avg 149.5 MiB 163.8 MiB +14.4 MiB
RSS · last 10 avg 184.1 MiB 172.3 MiB -11.8 MiB
RSS · last − first window +34.6 MiB +8.4 MiB -26.2 MiB
RSS · warm slope / 100 nav +8.7 MiB +4.3 MiB -4.3 MiB
PSS · first 10 avg 145.8 MiB 160.3 MiB +14.5 MiB
PSS · last 10 avg 180.6 MiB 168.4 MiB -12.2 MiB
PSS · last − first window +34.8 MiB +8.1 MiB -26.8 MiB
PSS · warm slope / 100 nav +8.7 MiB +4.2 MiB -4.5 MiB
Peak file descriptors 64 60 -4
Peak threads 29 29 0

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 164.1 MiB 151.0 MiB 214.0 MiB 160.5 MiB 147.4 MiB 54
51–100 170.3 MiB 156.5 MiB 219.2 MiB 166.6 MiB 152.9 MiB 54
101–150 171.0 MiB 157.6 MiB 210.4 MiB 167.2 MiB 153.8 MiB 59
151–200 170.8 MiB 160.4 MiB 223.0 MiB 167.1 MiB 156.7 MiB 54

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.

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.

1 participant