mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
fix(wrapper): track real window geometry on headed launches
Headed launches applied a fixed emulated viewport on top of the real browser window, yielding outerWidth < innerWidth (an impossible window). Default headed new_page()/new_context() to no_viewport so the page tracks the real window; headless keeps a deterministic viewport. Covers Python launch/launch_context/launch_persistent_context (+async) and the JS Playwright/Puppeteer wrappers. Explicit viewport still honored.
This commit is contained in:
@@ -55,16 +55,19 @@ def get_default_stealth_args() -> list[str]:
|
||||
# Tell the fingerprint patches we're on macOS so GPU/UA match natively
|
||||
return base + ["--fingerprint-platform=macos"]
|
||||
|
||||
# Linux/Windows: Windows fingerprint profile
|
||||
# Hardware concurrency, device memory, screen, window size, and GPU are
|
||||
# auto-generated by the binary from the seed (v14+).
|
||||
# Linux/Windows: Windows fingerprint profile.
|
||||
# Screen and window size come from the real display, not this flag (verified:
|
||||
# identical across seeds), so the wrapper must not emulate a viewport on top in
|
||||
# headed mode — that would break outerWidth >= innerWidth coherence.
|
||||
return base + ["--fingerprint-platform=windows"]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Default viewport — realistic maximized Chrome on 1080p Windows
|
||||
# screen=1920x1080, availHeight=1032 (minus 48px taskbar, binary default),
|
||||
# innerHeight=947 (minus ~85px Chrome UI: tabs + address bar + bookmarks)
|
||||
# Default viewport — used for HEADLESS only (headed launches use no_viewport so
|
||||
# the page tracks the real window). Headless has no window chrome, so a fixed
|
||||
# viewport stays coherent (outer == inner) and gives deterministic dimensions.
|
||||
# Models a maximized Chrome on 1080p Windows: screen=1920x1080,
|
||||
# innerHeight=947 (minus ~85px Chrome UI: tabs + address bar + bookmarks).
|
||||
# ---------------------------------------------------------------------------
|
||||
DEFAULT_VIEWPORT = {"width": 1920, "height": 947}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user