#54492: fix: apply setContentProtection() in Windows remote sessions again
Description of Change
Since Electron 44, win.setContentProtection(true) has done nothing when the app runs in a Windows remote session, while win.isContentProtected() kept returning true. Chromium stopped excluding windows from capture in remote sessions so that its own Picture-in-Picture windows stay visible to the remote user (https://chromium-review.googlesource.com/c/chromium/src/+/7918332), and setContentProtection() goes through the same code path.
This enables AllowWindowCaptureExclusionInRemoteSessions by default, so an explicit request for protection is honored again as it is on 43. Apps that would rather leave windows unprotected in remote sessions can pass the feature to --disable-features, which takes precedence. A second commit documents that the change takes effect with the next desktop composition.
Measured on Windows 11 24H2 in a Remote Desktop session: 43.7.5 sets WDA_EXCLUDEFROMCAPTURE, the window stays visible in the mstsc client and is absent from a capture taken inside the session; 44.4.5 leaves WDA_NONE and the capture contains the window. 44.4.3 launched with --enable-features=AllowWindowCaptureExclusionInRemoteSessions, which is what this change makes the default, applies the exclusion again and the window is absent from desktopCapturer.getSources(). At the console all of them set it. There's no spec because CI can't switch a session between console and remote.
Checklist
- I have filled out the PR description
- I have reviewed and verified the changes
- relevant API documentation, tutorials, and examples are updated and follow the documentation style guide
Release Notes
Notes: Fixed setContentProtection(true) having no effect in Windows remote sessions.
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