Skip to content

docs: fix utilityProcess 'login' args and setSSLConfig minVersion values - #54739

Merged
jkleinsc merged 2 commits into
electron:mainfrom
gengjiawen:docs-utility-login-ssl-min-version
Oct 13, 2026
Merged

jkleinsc merged 2 commits into
electron:mainfrom
gengjiawen:docs-utility-login-ssl-min-version

Conversation

@gengjiawen

@gengjiawen gengjiawen commented Oct 8, 2026 •

Copy link
Copy Markdown

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:docs passes, which includes regenerating electron.d.ts and running ts-smoke. I diffed the generated electron.d.ts before and after; the only changes are the five 'login' listener overloads on UtilityProcess and the minVersion type 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.fetch with session and respondToAuthRequestsFromMainProcess: true, and setSSLConfig() with each value.

    Case Result
    'login' listener arguments 4 args: Event (has preventDefault), details, authInfo, callback
    Example as currently documented TypeError: callback is not a function, request gets 401
    Async callback, no preventDefault() cancelled (401)
    Async callback with preventDefault() authenticated (200)
    setSSLConfig({ minVersion: 'tls1' / 'tls1.1' }) TypeError: Error processing argument at index 0, conversion failure
    setSSLConfig({ 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

Release Notes

Notes: Fixed TypeScript types for utilityProcess login and ses.setSSLConfig().

UtilityProcess emits 'login' through gin_helper::EventEmitterMixin::Emit(),
which prepends an Event object, so listeners receive
(event, authenticationResponseDetails, authInfo, callback). As with
app's 'login' event, the request is cancelled unless the listener calls
event.preventDefault() or invokes the callback synchronously.

The documented signature omitted `event`, so the example called
`authInfo` as the callback and threw "TypeError: callback is not a
function". Since electron.d.ts is generated from these docs, the
listener type was wrong as well.

Assisted-By: Claude Opus 5.5, Claude Code
SSLProtocolVersionFromString() only accepts "tls1.2" and "tls1.3"; any
other minVersion fails argument conversion and setSSLConfig() throws a
TypeError. Chromium's network::mojom::SSLVersion only has kTLS12 and
kTLS13, and SSLConfig defaults version_min to kTLS12.

Assisted-By: Claude Opus 5.5, Claude Code
@electron-cation electron-cation Bot added documentation 📓 semver/patch backwards-compatible bug fixes labels Oct 8, 2026
@release-clerk

release-clerk Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Release note looks good now.

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@deepak1556 deepak1556 added target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Oct 8, 2026
@jkleinsc
jkleinsc merged commit 04d2e11 into electron:main Oct 13, 2026
78 checks passed
@release-clerk

release-clerk Bot commented Oct 13, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed TypeScript types for utilityProcess login and ses.setSSLConfig().

@welcome

welcome Bot commented Oct 13, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@trop

trop Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54880

@trop

trop Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #54881

@trop

trop Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54882

@trop trop Bot added in-flight/43-x-y in-flight/45-x-y merged/44-x-y PR was merged to the "44-x-y" branch. and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. in-flight/44-x-y in-flight/43-x-y in-flight/45-x-y labels Oct 13, 2026
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. labels Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y documentation 📓 merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants