fix: Chrome без менеджера паролей, перевода и автозаполнения (#111)
Перед каждым запуском окна в Default/Preferences профиля дописываются prefs: credentials_enable_service, profile.password_manager_enabled, translate.enabled, autofill.* = false. Применяется и к новым, и к существующим профилям, остальные настройки Chrome не трогаются. Пузырь «Сохранить пароль?» и предложение перевода больше не появляются, пароли не оседают в Login Data профиля. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
677fea0090
commit
232385f8d8
3 files changed
+74
No files matched your search
@@ -69,3 +69,39 @@ def test_profiles_get_different_canvas_seeds(tmp_path):
|
||||
(tmp_path / str(i)).mkdir()
|
||||
seeds.add(profile.load_or_create(tmp_path / str(i))["fingerprint"]["canvas_seed"])
|
||||
assert len(seeds) == 20
|
||||
|
||||
|
||||
def test_chrome_prefs_for_new_profile(tmp_path):
|
||||
profile.apply_chrome_prefs(tmp_path)
|
||||
prefs = json.loads((tmp_path / "Default" / "Preferences").read_text())
|
||||
assert prefs["credentials_enable_service"] is False
|
||||
assert prefs["profile"]["password_manager_enabled"] is False
|
||||
assert prefs["translate"]["enabled"] is False
|
||||
assert prefs["autofill"]["credit_card_enabled"] is False
|
||||
|
||||
|
||||
def test_chrome_prefs_keep_existing_profile_settings(tmp_path):
|
||||
"""Существующий профиль: prefs дописываются, остальные настройки Chrome остаются."""
|
||||
path = tmp_path / "Default" / "Preferences"
|
||||
path.parent.mkdir()
|
||||
path.write_text(json.dumps({
|
||||
"profile": {"name": "Person 1", "password_manager_enabled": True},
|
||||
"translate": {"enabled": True},
|
||||
"autofill": {"autofill_ai": {"opt_in_status": {}}},
|
||||
"intl": {"accept_languages": "ru-RU,ru"},
|
||||
}))
|
||||
profile.apply_chrome_prefs(tmp_path)
|
||||
prefs = json.loads(path.read_text())
|
||||
assert prefs["profile"] == {"name": "Person 1", "password_manager_enabled": False, "password_manager_leak_detection": False}
|
||||
assert prefs["translate"]["enabled"] is False
|
||||
assert prefs["autofill"]["autofill_ai"] == {"opt_in_status": {}}
|
||||
assert prefs["intl"] == {"accept_languages": "ru-RU,ru"}
|
||||
assert prefs["credentials_enable_service"] is False
|
||||
|
||||
|
||||
def test_chrome_prefs_replace_broken_preferences(tmp_path):
|
||||
path = tmp_path / "Default" / "Preferences"
|
||||
path.parent.mkdir()
|
||||
path.write_text("{broken")
|
||||
profile.apply_chrome_prefs(tmp_path)
|
||||
assert json.loads(path.read_text())["translate"] == {"enabled": False}
|
||||
Reference in new issue
Block a user