mirror of
https://github.com/daijro/camoufox.git
synced 2026-11-19 00:07:28 +00:00
* Firefox 159: stock parity for a driven browser A page driven through Camoufox should read like stock Firefox in a person's hands. This brings the Firefox 159 port up to that. Stock defaults - Remote Settings, Safe Browsing, region detection, Push, connectivity checks and the new tab keep Firefox's defaults; Nimbus is tied to Normandy so the new tab starts without it. - No policies.json: any policy file puts Firefox in enterprise mode, which a page can see (DNS over HTTPS stands down). - Firefox's 100% release rollouts are default prefs; stock's search engines are back. - WebGL, devicePixelRatio and worker getters cost what stock's do; Linux builds use --enable-stdcxx-compat, as Mozilla's do. Juggler - Driver code defines no interfaces on the page's window, isolated and main-world evaluates included. - Input arrives as a person's: click hold, hover dwell and double-click gap; fill() and insert_text() type key by key; the wheel turns notches; moves coalesce per frame; drags behave as a GTK drag session. Input waits for Firefox's user-input gate. - Focus, Fission and bfcache stay Firefox's unless a driver needs them. - Screenshots and document.fonts.ready leave the page alone. Humanize - One engine per channel (mouse, keyboard, scroll) behind one seam in Juggler, a seed for repeatable input, and custom(fn) engines run in the caller's process (Python). The build lists its engines in humanize-engines.json. Network - A SOCKS5 proxy with a username and password works for the launch and per context. - The User-Agent header follows the context's identity. - WebRTC UDP goes through a SOCKS5 proxy's UDP ASSOCIATE relay (webrtc-socks5-udp.patch), so a page's STUN server sees the exit and the srflx is real. Nothing goes around the proxy: a page with no HTTP-loaded document behind it counts as proxied, a proxy that carries no UDP gets none, and a relay address inside the proxy's own NAT is replaced by the proxy's public one. Identity - Bundled fonts and speech voices follow the drawn identity. - The window holds the identity's size and position through startup, and on a virtual display a window outside the root is neither occluded nor refused focus. CI runs every new guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLGoGNeymhNcr3EAQX5hJE * Paste inserted text; draw input delays from one normal helper fill() and keyboard.insert_text() typed the text key by key, a quarter of a second per character, which ran past Playwright's timeouts and is not how a person enters a whole string. They now paste: the paste shortcut (Ctrl+V, Cmd+V for a Mac platform) goes down, Firefox's own paste runs with the text through nsIEditor.pasteTransferable (a trusted paste event with the text as clipboardData, then beforeinput/input insertFromPaste), and the shortcut comes up. The shortcut's keypress, where Firefox would read the system clipboard, is cancelled in the system group, which content cannot observe; the system clipboard is never used. A page that cancels the paste or the shortcut gets nothing, and the call fails saying so. input/HumanDelay.js holds normalDelay(mean, sd, min, max), the one draw for the delays between a person's input events: the click hold (normal around 110 ms, SD 30, never under 50 ms, with no ceiling), the double-click gap, the hover dwell, the paste key's hold, and the Shift and paste modifiers' lead and trail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLGoGNeymhNcr3EAQX5hJE * Fix driven input and headless parity * Headless with a display uses that display's GL A headless probe that failed to load EGL still recorded TEST_TYPE EGL, so Firefox refused GLX and every headless WebGL context died. Probe EGL only when there is no display, and only claim it when that probe initialized. Move spacing starts when the move is sent, so a steps path stays a 125 Hz mouse instead of one move per frame. * Fix focus, humanize-off, and WebRTC proxy parity - A stock identity mirror adds no humanize keys when humanize is off. - Keep the real focus and run the upstream focus tests. - Add the per-context WebRTC proxy flag; do not fabricate a srflx behind a proxy. - Refresh the Python/TypeScript parity tests, skiplist and docs. - Install Mesa DRI so the software WebGL guards can run. * Fix TypeScript humanize float encoding Encode humanize option values as PyFloat so a duration serializes as 1.0, matching Python, and apply Biome's import formatting. * Close a relay overflow, stop inventing srflx, and fix driven input gaps WebRTC: - A SOCKS5 relay read larger than the caller's buffer overran the stack buffer. A page-named STUN server could send one. Drop the datagram. - Remove the fabricated srflx candidate; a srflx now only comes from a STUN answer, and the guards run against a server that answers. - Juggler records each proxy it sets, so a caller's own new_context(proxy=...) cannot gather around it. This replaces the launcher's webrtc:proxied key and its page-visible setter. - Headless GL probes use the surfaceless platform without launcher plumbing. Input: - A wheel without a scroll engine takes the activation slot per notch, so a long scroll no longer stalls input in every other context. - Paste and fill work inside an iframe. - Python fill honours the caller's timeout. TypeScript humanize matches Python: off, seeds, duplicate options and the scroll warning. Guards with a missing prerequisite fail rather than pass. Add navigation-preconnect-proxied. Move the tweened click test to a skiplist pattern entry, since whether it passes depends on machine speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check the tweened click entry with its guard, not the audit Whether test_click_with_tweened_mouse_movement passes depends on machine speed: 0 of 20 runs on all cores here, 3 of 15 on two, and it passed on CI. The audit cannot demand a failure from it, and a pattern entry would leave its reason unchecked. A skiplist entry's checked_by now names the patch guard that checks the reason, here driven-move-coalescing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ask the display-less GL probe for a pbuffer config Mesa's surfaceless platform has only pbuffer configs. The probe asked for the default window surface type, so eglChooseConfig matched nothing and eglCreateContext got an uninitialized config. With no GPU, a display-less headless launch then had an empty gfxInfo: no WebGL and no WebRTC H264. A host where NVIDIA's EGL answers first never reaches Mesa here, so the guards only failed on machines without a GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Open about:blank for a driver and run first-page init scripts after PageAgent A headed persistent launch opened about:home once the start page prefs went back to stock. browser.startup.page now becomes 0 only when a driver attaches, so a browser nobody drives keeps Firefox's start page. Init scripts on a page's initial document ran before PageAgent existed, so their binding calls and console messages had no listener and were lost. They now run after PageAgent has reported the page's execution contexts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Warm up the crash growth test past Firefox 159's timed startup work The parent holds up to 400 MB more for a while at fixed times after launch, in stock Firefox 159 as well. Two RSS readings taken across one of those peaks read as growth or shrinkage, and pushed the test over its limit with no leak. Warm up by time instead of by context count. The metric and limit are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Close WebRTC paths around a proxy, stop background traffic, fix driven input WebRTC behind a proxy no longer shows the host's address: ICE uses the proxy's SOCKS5 UDP relay when it has one, and UDP is dropped otherwise. A page on the bypass list behind a forced proxy is blocked on UDP and ICE TCP. A proxy hanging up straight after CONNECT no longer crashes the parent process. Remote Settings stops polling, with the page-visible lists bundled as a snapshot pinned by scripts/remote_settings.py, and Push connects on demand. fill clicks an unfocused text field and types when a page blocks paste. Click throughput across contexts is restored. The TypeScript launcher gains custom humanize engines and driver defaults, in step with Python, and caps WebGL2 MAX_UNIFORM_BLOCK_SIZE at Firefox 159's 64 KiB. docs/input-dispatch.md records a person's wheel on macOS, which is one line a notch where the driven wheel sends three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Leave the humanize engine system for its own pull request Per-channel engines, seeded streams, custom() and the keyboard and scroll-into-view plans are a separate feature. humanize keeps main's meaning here: a human cursor move, on or off, with an optional duration cap, planned by CursorTrajectory.js and paced by Pacer.js. The five per-channel config keys were declared on this branch, so they stay declared as removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Warn, not raise, on a browser that cannot read voices:speechd A new package has to launch an older build (#835, and the install gate launches the last release). A Linux identity there reports no voices, so it warns and the warning cannot be silenced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give a macOS identity macOS's wheel A person's notched mouse on macOS sends one line for a slow notch, with no native tick, and accelerates a faster turn from there. Driven input sent Linux's three ticked lines. A macOS identity now sends lines at 16 px each, starting at one and growing, and stock's per-OS system scroll override follows the identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Install the tracking lists where a clean build's reader looks A relative wildcard keeps its directory under recursive make and drops it under faster make. The clean build nested the attachments one directory too deep, so the classifier had no tables. An incremental objdir hid this with old links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Make two guards deterministic: the wheel's OS and a dropped relay A launch without `os` draws one, and a macOS draw now gets macOS's wheel, so the guards asserting three notches failed by the draw. They assert Linux's now. The browser flushes queued datagrams when UDP ASSOCIATE is granted, so a relay closed just after the grant could forward one, and the STUN server heard the proxy's own relay port as if it had gone around the proxy. It closes first now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
SETTINGS = Path(__file__).resolve().parents[2] / 'browser' / 'settings'
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def no_host_gpu_probe(monkeypatch):
|
|
"""launch_options launches the browser to read the host's GPU when an
|
|
identity claims the host's OS. This suite has no browser, and its results
|
|
must not depend on the machine running it, so the host reads as having no
|
|
WebGL. Tests of the probe's consumers patch it themselves."""
|
|
from camoufox import utils
|
|
|
|
monkeypatch.setattr(utils, 'host_gpu', lambda *args: None)
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def properties_of_this_checkout(monkeypatch):
|
|
"""launch_options reads properties.json from the installed build, and CI
|
|
installs the last published one. This suite tests the checkout, whose
|
|
launcher may draw a key that build predates, so it reads the checkout's."""
|
|
from camoufox import utils
|
|
|
|
load = utils._load_properties
|
|
monkeypatch.setattr(
|
|
utils, '_load_properties', lambda path=None: load(path or SETTINGS / 'camoufox-bin')
|
|
)
|