#50278: refactor: replace CHILD_PLUGIN with CHILD_EMBEDDER_FIRST on macOS
Merged
Description of Change
Closes #50271
Chromium removed upstream support for child plugin processes without library validation in https://crbug.com/461717105, which we patched back via feat_restore_macos_child_plugin_process.patch.
Chromium's CHILD_EMBEDDER_FIRST mechanism already provides the right extensibility point for this: values > CHILD_EMBEDDER_FIRST are reserved for embedders and resolved via ContentBrowserClient::GetChildProcessSuffix(). Chrome itself uses this pattern for its Alerts helper process.
This commit replaces the Chromium patch with an Electron-native implementation.
Tested with:
const { app, utilityProcess } = require('electron');
app.whenReady().then(() => {
const child = utilityProcess.fork('/dev/null', [], {
allowLoadingUnsignedLibraries: true
});
child.on('spawn', () => {
const { execSync } = require('child_process');
// The process should be running as "Electron Helper (Plugin)"
console.log(execSync(`ps aux | grep "Helper (Plugin)"`).toString());
process.exit(0);
});
})Output
codebytere 52527 0.0 0.0 410060320 32 ?? S 12:05PM 0:00.00 /Users/codebytere/Developer/electron-gn/src/out/Testing/Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/MacOS/Electron Helper (Plugin) --type=utility --utility-sub-type=node.mojom.NodeService --lang=en-US --service-sandbox-type=none --user-data-dir=/Users/codebytere/Library/Application Support/royal-quiver-resolve-52r5b --shared-files --field-trial-handle=1718379636,r,2625428615576881707,17048915519166431862,262144 --enable-features=PdfUseShowSaveFilePicker,ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,MacWebContentsOcclusion,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TimeoutHangingVideoCaptureStarts,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=1935764596,r,4873601938494529188,8777684506488938851,4 --trace-process-track-uuid=4343401777029354128
codebytere 12125 0.0 0.1 1890425968 62336 ?? S 9:56AM 0:00.69 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist/serverWorkerMain --node-ipc --clientProcessId=7833
Checklist
- PR description included
- I have built and tested this PR
-
npm testpasses - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: none
Backports
42-x-y
In-flightSemver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
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