#54506: fix: crashReporter.setUploadToServer() having no effect after start
Description of Change
crashReporter.setUploadToServer() did not change whether crash reports were uploaded once crashReporter.start() had run. It only updated the consent flag on Electron's crash reporter client, which Crashpad reads once while it is being initialized; the handler decides per report from the uploads-enabled setting in the Crashpad database, and nothing wrote that setting again after start(). So getUploadToServer() reported the new value while reports written after setUploadToServer(false) were still uploaded, and reports written after setUploadToServer(true) on a reporter started with uploadToServer: false were not. This applies to macOS, Windows and Linux alike.
setUploadToServer() now also writes the value to the Crashpad database through crash_reporter::SetUploadConsent(), the same call start() goes through. Two specs crash the main process after toggling the setting in each direction; the spec crash server now records the reports it receives so the existing "should not send a minidump" assertion can fail.
Checklist
- PR description included
-
npm testpasses (spec/api-crash-reporter.spec.tson Linux; the two new cases fail without the change) - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
- I have reviewed and verified the changes
Release Notes
Notes: Fixed an issue where crashReporter.setUploadToServer() had no effect after crashReporter.start() was called.
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