Skip to content

fix: keep ses.setProxy() config when the network service restarts - #55575

Merged
MarshallOfSound merged 2 commits into
46-x-yfrom
trop/46-x-y-bp-fix-keep-ses-setproxy-config-when-the-network-service-restarts-1793724713513
Nov 4, 2026
Merged

MarshallOfSound merged 2 commits into
46-x-yfrom
trop/46-x-y-bp-fix-keep-ses-setproxy-config-when-the-network-service-restarts-1793724713513

Conversation

@trop

@trop trop Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Backport of #55504

See that PR for details.

Notes: Fixed proxy switches replacing ses.setProxy() after a network service restart.

trop Bot and others added 2 commits November 3, 2026 16:52
Proxy command-line switches were re-applied to every session each time
its NetworkContext was rebuilt, overwriting a proxy the app had set with
ses.setProxy(). Apply them once, when the session's prefs are created.

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Noam Rubin <noam@anthropic.com>
Restart the network service with simulateNetworkServiceCrash() and add
flushSessionProxyConfigForTesting() so the spec no longer polls.

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Noam Rubin <noam@anthropic.com>
@trop trop Bot added 46-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Nov 3, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. This is a clean backport: the proxy-switch application moves from NetworkContext (re)creation to the session's one-time InitPrefs(), so ses.setProxy() no longer gets overwritten after a network service restart.

What was reviewed (standalone clone, no Chromium tree available):

  • InitPrefs() runs from the ElectronBrowserContext constructor after in_memory_pref_store_ is constructed, so the switch is still applied to every session. Session::SetProxy writes to the same store, so it now persists.
  • New testing binding: Session* conversion follows the same pattern used elsewhere in shell/, and NetworkContextServiceFactory::GetForContext creates the service on demand. It is exposed only through electron_common_testing.
  • The fixture covers both sessions, the one with its own proxy and the one inheriting the switch, before and after a simulated crash. The spec asserts on the collected output after the child exits, which follows the spec/CLAUDE.md rules.
Extended reasoning...

The change touches session pref initialization (shell/browser/electron_browser_context.cc), drops a per-NetworkContext call in shell/browser/net/network_context_service.cc, adds a test-only flush helper to the electron_common_testing binding, and adds a spec with a fixture app. It touches no auth, permission, IPC or renderer-reachable surface; the new binding method is only available in testing builds. It is a small backport from main by the trop bot, CODEOWNERS covers none of the changed paths, and no reviewer objections appear in the timeline. One behavioural nuance: a proxy switch appended after a session has been created no longer reaches that session when its NetworkContext is created later. This matches the documented use of switches before ready. The bug hunt ran to dry_streak and found nothing.

@claude claude Bot mentioned this pull request Nov 3, 2026
4 of 6 tasks
@MarshallOfSound
MarshallOfSound merged commit 8bae8c2 into 46-x-y Nov 4, 2026
89 of 91 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/46-x-y-bp-fix-keep-ses-setproxy-config-when-the-network-service-restarts-1793724713513 branch November 4, 2026 16:00
@release-clerk

release-clerk Bot commented Nov 4, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed proxy switches replacing ses.setProxy() after a network service restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant