#54840: fix: prevent renderer crashes during ShadowRealm GC
Description of Change
Fixes #54637. Backports the landed Chromium fix until Electron's Chromium rolls include it. Full-GC metrics attributed to a ShadowRealm currently reach NOTREACHED() in its UKM accessor and crash the renderer. Return no recorder and an invalid source ID, which the existing metrics caller handles.
Adds a crash fixture covering ordinary, ShadowRealm, and nested ShadowRealm full GC. Credits Hidekazu Kondo's original fix in #52386 and supplies the upstream change and regression coverage requested there.
Please consider backporting to 44-x-y and 45-x-y. The patch applies cleanly to the Chromium versions currently pinned by main (157.0.8091.0), Electron 44 (152.0.7977.130), and Electron 45 (156.0.8078.12).
Validation on Windows x64:
- Built the PR's native source with Electron's standard testing configuration.
- All 39 crash cases passed, including the ShadowRealm GC regression.
- Full repository lint passed on the PR source.
- Full, unfiltered
npm testcompleted but did not pass; failures remain under investigation. - Local validation covers Windows x64; release-branch and cross-platform validation remain pending.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change
Release Notes
Notes: Fixed renderer crashes during garbage collection inside ShadowRealms.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron