fix(config): stop passing --disable-features twice, and disable OptimizationHints - #274
fix(config): stop passing --disable-features twice, and disable OptimizationHints#274alkaz-nodemaven wants to merge 1 commit into
Conversation
…izationHints Config.__call__ appended a second --disable-features switch on top of the one in _default_browser_args. Chrome keeps switches in a map, so the last occurrence wins and the first list was silently discarded, taking DisableLoadExtensionCommandLineSwitch with it. Removing the duplicate makes the declared list effective again. Adding OptimizationHints to it stops the Optimization Guide from downloading an on-device model on every fresh profile: measured over a 60 s idle window on about:blank, 39.4 MB before and under 0.1 MB after.
|
Flagging something against my own PR before anyone spends time merging it. After I opened this, SeleniumBase's maintainer pointed out that he had already What I have measured since, on Chrome 151.0.7922.137, Ubuntu 24.04.4, headful
12 of 12 started and reached a page, and bare But one platform and one build is not a refutation. His report is from when 151 Until that is settled, please treat the
Happy to push either version, or to close this and re-open once the 151 question |
What changed
Two lines in
zendriver/core/config.py:Config.__call__appended--disable-features=IsolateOrigins,site-per-processon top of the longer list already in
_default_browser_args. Chrome storesswitches in a map, so the last occurrence of a switch wins and the earlier one
is dropped whole. The declared list, including
DisableLoadExtensionCommandLineSwitch, never reached the browser.OptimizationHintsis added to the surviving list, which stops theOptimization Guide from downloading an on-device model on every fresh profile.
The duplicate switch
config.py:134declares:and
config.py:205then appended:Both are on the command line today;
Config()()returns two of them. Which oneChrome honours is not something I wanted to take from reading Chromium, so I
measured it, using a feature whose effect is visible in network traffic:
OptimizationHintsfirst,IsolateOriginssecondIsolateOriginsfirst,OptimizationHintssecondSo the last switch wins and the first is discarded entirely, which is why adding
OptimizationHintsto line 134 alone changed nothing until line 205 was removed.The bandwidth
Measured 2026-08-25, Windows 10, Chrome 149.0.7827.201,
headless=True, 60 sparked on
about:blankwith nothing navigated. Bytes are counted at a loopbackCONNECT proxy and attributed per authority, so this is what the socket saw rather
than what any framework-level hook reported.
optimizationguide-pa.googleapis.commainat 2c6d9c7, run 1mainat 2c6d9c7, run 2OptimizationHintsis the master switch for the service. Disabling the narrowerOptimizationHintsFetching,OptimizationTargetPredictionandOptimizationGuideModelDownloadingdoes not help, because the service is stillconstructed; I checked that separately against a library that ships all three and
fetches anyway.
One caveat on the numbers, because it cost me an hour: the fetch does not fire on
every start. Seven of eight runs without the flag fetched and one was quiet, so a
single quiet run is not evidence a flag worked. Every row above is one of two
runs, and the flagged runs are quiet in all of them.
Fingerprint
OptimizationHintsis not page-visible. 31 probes sampled from the same enginewith and without the flag - the full
navigatorprototype property list (83names), all 1232
windowown-property names,plugins,mimeTypes, WebGLvendor/renderer/extension list,
userAgentData,Intl.resolvedOptions, screenmetrics,
PerformanceObserver.supportedEntryTypes- are identical. Patchrightalso ships
OptimizationHintsin its default--disable-featureslist.One thing I could not confirm
Removing the duplicate makes
DisableLoadExtensionCommandLineSwitcheffectivefor the first time, and I expected that to restore
--load-extension, whichbrowser.py:355still passes. It does not, at least here: a minimal MV3extension with a
document_startcontent script fails to load both before andafter this change on Chrome 149, headful. So the dead switch is real but it is
not the whole story for extensions, and I am deliberately not claiming this
patch fixes them. Happy to open that separately if it is news to you.
config.py:206also duplicates--disable-session-crashed-bubblefrom line 135.That one is a valueless switch, so the duplicate is harmless, and I left it alone
to keep this diff to the lines that change behaviour.