Repository navigation
fix: keep ses.setProxy() config when the network service restarts - #55575
Conversation
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>
There was a problem hiding this comment.
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 theElectronBrowserContextconstructor afterin_memory_pref_store_is constructed, so the switch is still applied to every session.Session::SetProxywrites to the same store, so it now persists.- New testing binding:
Session*conversion follows the same pattern used elsewhere inshell/, andNetworkContextServiceFactory::GetForContextcreates the service on demand. It is exposed only throughelectron_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.
|
Release Notes Persisted
|
Backport of #55504
See that PR for details.
Notes: Fixed proxy switches replacing
ses.setProxy()after a network service restart.