#53904: refactor: replace three gin and renderer Chromium patches with existing API
Description of Change
Three Chromium patches in the gin, content-main and worker areas that only give Electron a hook can be replaced with API that already exists. One commit per patch so each can be reviewed or reverted on its own; each commit message says what the patch did and what replaces it.
| Patch removed | Electron-side replacement |
|---|---|
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch |
The "isolate is being torn down" signal the weak second-pass callbacks in gin_helper::WrappableBase check was two process-wide bools patched into gin::IsolateHolder, written and read only by Electron. gin_helper::CleanedUpAtExit now records it when DoCleanup() starts. |
create_browser_v8_snapshot_file_name_fuse.patch |
With the LoadBrowserProcessSpecificV8Snapshot fuse on, ElectronMainDelegate::ShouldLoadV8Snapshot() opens browser_v8_context_snapshot.bin from the directory gin uses, hands it to gin::V8Initializer::LoadV8SnapshotFromFile() and tells content not to load the default snapshot, instead of a patched-in GetBrowserV8SnapshotFilename() delegate method. feat_add_support_for_embedder_snapshot_validation.patch is re-exported because it touches the same gin files. |
feat_plumb_node_integration_in_worker_through_workersettings.patch |
ElectronRendererClient implements ContentRendererClient::CreateWorkerContentSettingsClient(), which blink already hands to every dedicated worker and off-main-thread worklet a frame creates and Clone()s for nested workers, and carries the creating frame's nodeIntegrationInWorker decision in that client. The worker thread reads it back through WorkerOrWorkletGlobalScope::ContentSettingsClient() instead of a bit patched into blink::WorkerSettings and WorkletGlobalScope. |
Verified on Linux over a testing build: the chromium-spec web workers cases (per-frame and nodeIntegrationInSubFrames inheritance, SharedWorker, AudioWorklet across pooled threads, navigator.serviceWorker), the <webview> webpreferences-inheritance worker cases, a nested worker inheriting Node integration from its parent worker, and the api-js2c-code-cache-spec cases including the one that runs with the LoadBrowserProcessSpecificV8Snapshot fuse enabled pass.
Checklist
- PR description included and stakeholders cc'd
-
npm testpasses - I have reviewed and verified the changes
Release Notes
Notes: none
Backports
No Backports Requested
This pull request doesn't have any backports requested or created for older release branches.
What are backports?
Backports are copies of changes made to the main branch that are applied to older release branches. They ensure that bug fixes and important changes are available in maintained older versions of Electron.
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