Skip to content

fix: preserve cancellation reasons across capture and images - #654

Draft
bubkoo wants to merge 3 commits into
masterfrom
codex/svg-style-cancellation-master
Draft

bubkoo wants to merge 3 commits into
masterfrom
codex/svg-style-cancellation-master

Conversation

@bubkoo

@bubkoo bubkoo commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Aborting with null, false, 0 or an empty string loses the original reason at capture entry, during pending work and while decoding an image. SVG style preparation has the same issue and can also deliver an already disposed document through its queued resource-lock continuation.

Preserve cancellation reasons through the task, renderer, image loader and SVG environment. Use explicit success/error outcomes, check the signal's aborted state, and recheck ownership before delivering the private document. Manual disposal errors, existing CSP/sandbox restrictions and readiness deadlines remain unchanged.

This is based directly on master f8d1c4b; it does not depend on #650 or contain #651's native-scroll implementation. The old stacked #652 and its failed GC evidence remain separate. This change makes no general GC-stability or native-pixel-fidelity claim.

Two independent fixed-input comparisons:

  • Master factory baseline: same tests/configuration, changing only src/svg-style-scope.ts, 60 failed / 33 passed before and 93 passed after across Chromium, Firefox and WebKit.
  • With that factory repair already present: same public-capture and real-image tests, changing the four remaining reason checks in task/renderer/util, 48 failed / 36 passed before and 84 passed after. Capture tests use a real pending transform barrier; image tests use native data-SVG loading with a temporary decode barrier on that image instance, restored afterward. No network requests, mocked timers or prototype replacement.

Validation:

  • Complete local checks before a final formatting-only change: 1411 coverage / 1292 source passes, with 4 inherited skips in each phase; all 162 built-package tests pass. All 996 measured inputs remain unchanged within each run.
  • Final formatting removes redundant parentheses around a renderer throw expression. Normalized source and ESM/CJS runtime ASTs match; UMD bytes are identical. The two generated renderer JS files and three source maps have explicitly recorded byte differences. Fresh build, package consumers (TS 4.9/current), browser types, lint, formatting, all 84 added cases and 40 existing Chromium renderer controls pass afterward. The complete suite is not misrepresented as rerun on those final bytes.
  • The original three-GC count, browser flags, assertions, timeouts and retries are unchanged. Actual browser-run overlap and the early package-controller port conflict are retained; no failure is attributed to concurrency without evidence.

docs/evidence/cancellation-reasons-master.json and its 207-member raw archive, SHA index and portable verifier retain both baselines, actual failed results, final six-file identities and formatting proof. The two before/after groups are not pooled into one baseline.

Current-head remote results for b652860210997de165e3790674eb13b06ef029fa: CI run 45489531716 failed; CodeQL passed. Coverage passed 1411 tests with 4 skips; source tests passed 1291 with 1 WebKit failure and 4 skips. svg-fragment-lifetime.test.ts:44 failed because the source Document WeakRef remained after the original three GC calls. The iframe comparison at line 45 and image/pixel checks at line 46 onward were not reached; built-package tests and Codecov were skipped. This is the SVG host-tree case, separate from old #652's plain-HTML case; no common retaining owner or general GC fix has been established. Failing job and original assertion. The local results above do not replace this remote failure. Published exact-head remote evidence. Keep this draft; physical-device acceptance remains deferred. No npm publication, Mac network change or original contributor-PR closure.

Related: #560, #585.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant