#54739: docs: fix utilityProcess 'login' args and setSSLConfig minVersion values
Description of Change
Two small API doc fixes. Both also change the generated electron.d.ts.
utilityProcess 'login' event is missing its event argument
UtilityProcessWrapper emits 'login' via gin_helper::EventEmitterMixin::Emit() (shell/browser/login_handler.cc), which prepends an Event. Listeners actually receive (event, authenticationResponseDetails, authInfo, callback), which is also what spec/api-utility-process.spec.ts destructures. As with app's 'login' event, the request is cancelled unless the listener calls event.preventDefault() (or calls callback synchronously).
The documented signature leaves out event, so the example passes credentials to authInfo and throws TypeError: callback is not a function. This PR adds event to the documented arguments, documents the preventDefault() requirement using the same wording as app's 'login', and fixes the example. The event was added in #51279.
ses.setSSLConfig() minVersion lists values that are rejected
The docs say minVersion can be tls1, tls1.1, tls1.2 or tls1.3, defaulting to tls1. In practice SSLProtocolVersionFromString() only accepts tls1.2 and tls1.3, and anything else makes setSSLConfig() throw. Chromium's network::mojom::SSLVersion only has kTLS12 and kTLS13, and SSLConfig defaults version_min to kTLS12. This PR corrects the docs, and the generated type narrows from 'tls1' | 'tls1.1' | 'tls1.2' | 'tls1.3' to 'tls1.2' | 'tls1.3'.
Verification
-
yarn lint:docspasses, which includes regeneratingelectron.d.tsand running ts-smoke. I diffed the generatedelectron.d.tsbefore and after; the only changes are the five'login'listener overloads onUtilityProcessand theminVersiontype and doc comment. -
I checked the runtime behavior against the released Electron v44.6.0 (linux-x64) with a small app: a local server that returns 401, a utility process that calls
net.fetchwithsessionandrespondToAuthRequestsFromMainProcess: true, andsetSSLConfig()with each value.Case Result 'login'listener arguments4 args: Event(haspreventDefault), details, authInfo, callbackExample as currently documented TypeError: callback is not a function, request gets 401Async callback, nopreventDefault()cancelled (401) Async callbackwithpreventDefault()authenticated (200) setSSLConfig({ minVersion: 'tls1' / 'tls1.1' })TypeError: Error processing argument at index 0, conversion failuresetSSLConfig({ minVersion: 'tls1.2' / 'tls1.3' })accepted
AI assistance: these changes were drafted with Claude Code (Claude Opus 5.5). I reviewed them and verified the behavior as described above.
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
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: Fixed TypeScript types for utilityProcess login and ses.setSSLConfig().
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