Pin firefox-12: cross-OS render parity + always-present standard fonts

- BINARY_VERSION -> firefox-12 (self-calibrating font widths, per-family canvas
  distinctness, render-noise that preserves solid reference renders).
- font_pool: the standard Windows fonts (Calibri, Franklin Gothic, Gadugi,
  Javanese Text, Myanmar Text) move from the per-profile optional set to core,
  so they are always present and the detected font set matches a real Windows
  install on every host. Defensive dedup in derive_font_prefs.
- GPU persona applied on every platform (Linux/macOS present a coherent Windows
  GPU + WebGL params); pool re-rooted on a real-device GPU mix; render seeds
  recalibrated.
- prefs: emit absolute per-family font widths that the binary self-calibrates.
- geoip: always pull the latest mmdb via the releases/latest permalink, checked
  each launch, offline-safe (no pinned tag that can 404).
- tests: per-font canvas distinctness, solid-readback purity under render-noise,
  always-present standard-font invariant, no duplicate families.
This commit is contained in:
feder-cr 2026-06-19 03:14:38 +02:00
parent 6dcdc42c05
commit 8f4b20a19d
15 changed files with 1885 additions and 430 deletions

View file

@ -306,9 +306,9 @@ def test_windows_virtual_display_with_socks_proxy(monkeypatch):
@pytest.mark.integration
def test_linux_xvfb_workarounds_with_socks_proxy(monkeypatch):
"""IT11 — Linux + SOCKS5 proxy: Xvfb workarounds applied, GPU renderer
spoofed from profile, SOCKS keys written. virtual_display is a Windows-
only concept so we omit it here; passing ``virtual_display=True`` on
Linux must NOT set ``security.sandbox.gpu.level`` (covered by VD3)."""
spoofed from the validated WebGL persona, SOCKS keys written. virtual_display
is a Windows-only concept so we omit it here; passing ``virtual_display=True``
on Linux must NOT set ``security.sandbox.gpu.level`` (covered by VD3)."""
monkeypatch.setattr(sys, "platform", "linux")
profile = generate_profile(seed=42)
prefs = translate_profile_to_prefs(profile, virtual_display=True)
@ -323,9 +323,15 @@ def test_linux_xvfb_workarounds_with_socks_proxy(monkeypatch):
assert prefs["webgl.force-enabled"] is True
# Windows-only sandbox key absent on Linux even with virtual_display=True.
assert "security.sandbox.gpu.level" not in prefs
# GPU renderer is spoofed from the profile (not cleared like on Windows).
assert prefs["zoom.stealth.webgl.renderer"] == profile.gpu.renderer
# GPU renderer is spoofed from the validated WebGL persona (a coherent Windows
# ANGLE GPU whose renderer + params cross-check), applied on every host — NOT the
# raw profile.gpu.renderer, which has no coherent param set and is never exposed.
from invisible_playwright._webgl_personas import select_persona
_persona = select_persona(profile.seed)
assert _persona, "expected a validated persona for this seed"
assert prefs["zoom.stealth.webgl.renderer"] == _persona["prefs"]["zoom.stealth.webgl.renderer"]
assert prefs["zoom.stealth.webgl.renderer"] # non-empty
assert "ANGLE" in prefs["zoom.stealth.webgl.renderer"] # Windows ANGLE form
# SOCKS branch wrote its keys without clobbering the Linux prefs above.
assert prefs["network.proxy.type"] == 1
assert prefs["network.proxy.socks"] == "127.0.0.1"