mirror of
https://github.com/daijro/camoufox.git
synced 2026-10-04 16:00:21 +00:00
fix(python): fingerprint_preset=False no longer turns presets on
launch_options checked `fingerprint_preset is not None`, so passing False drew a random bundled preset, the opposite of what was asked. It now uses a truthiness check, and a test proves that None and False never draw a preset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b26381c15e
commit
99e2b0c363
@@ -1038,7 +1038,7 @@ def launch_options(
|
||||
# User passed a custom fingerprint
|
||||
if not i_know_what_im_doing:
|
||||
check_custom_fingerprint(fingerprint)
|
||||
elif fingerprint_preset is not None:
|
||||
elif fingerprint_preset:
|
||||
# User opted into real fingerprint presets
|
||||
if isinstance(fingerprint_preset, dict):
|
||||
preset = fingerprint_preset
|
||||
|
||||
@@ -162,3 +162,11 @@ class TestPrefsEnvIsAscii:
|
||||
joined = "".join(env[f"CAMOU_PREFS_{i}"] for i in range(1, len(env) + 1))
|
||||
assert joined.isascii()
|
||||
assert orjson.loads(joined) == prefs
|
||||
|
||||
|
||||
@pytest.mark.parametrize("off", [None, False])
|
||||
def test_fingerprint_preset_off_never_draws_a_preset(off):
|
||||
"""`fingerprint_preset=False` means off, the same as None. It used to be
|
||||
checked with `is not None`, so False drew a random bundled preset."""
|
||||
with mock.patch.object(utils, "get_random_preset", side_effect=AssertionError("preset drawn")):
|
||||
launch(fingerprint_preset=off)
|
||||
|
||||
Reference in New Issue
Block a user