mirror of
https://github.com/daijro/camoufox.git
synced 2026-11-19 00:07:28 +00:00
main
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e90abccee6 |
Firefox 159: stock parity for a driven browser (#997)
* 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> |
||
|
|
b3679d28c2 |
Say which Windows values were measured, and what a macOS host gets
The test docstring claimed every value was measured on stock Windows; four behaviour prefs were, and the rest are Firefox 158's Windows defaults from its pref files. windows-keyboard.patch's tables, text bindings and AltGr are GTK code, so on a macOS host only the editor caret style changes. The test UAs claim 158. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9bb4181cf8 |
Windows identity: drop behaviour prefs no page can observe
searchclipboardfor.middleclick is browser chrome, clipboard.autocopy only fills the X primary selection, middlemouse.openNewWindow is overridden by the browser's own link handling, and select popups are drawn in the parent process. use-system-size is read only by Windows' own LookAndFeel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4e2515bc64 |
Leave EME at the build's default for Windows identities
Windows Firefox has PlayReady behind EME; a Linux build cannot supply it, so turning media.eme.enabled on claimed more than the build delivers. The pref is no longer among the Windows behaviour defaults, and the Python and TypeScript tests now require that it is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e3b76b2acf |
Draw Windows' scrollbars for Windows identities on another host
The launcher pins overlay versus classic scrollbars per identity, but the scrollbars were still drawn by the host build's theme. On a Linux host a Windows 10 identity's classic gutter measured 12 px (GTK's); stock Firefox on Windows measures 17. For a Windows identity on a non-Windows host the launchers now select Windows' non-native scrollbar style (Windows 10 or 11, following ui.useOverlayScrollbars), at Windows' own size rather than the host's system metric. A Linux or macOS identity, and any identity on a Windows host, is left as before. viewport-no-rdm.py now runs for a Linux and a Windows identity: the Linux one must show the host theme's non-zero gutter, the Windows one stock Windows' 17 px. The skiplist's 12 px entries stay right: the Playwright suite launches the bare binary, which claims no OS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
4812579537 |
Set Windows behaviour defaults for Windows identities
A Linux build claiming Windows kept Linux's defaults for prefs a page
or the user can observe: EME was off ("EME has been preffed off" is a
Linux-only message), middle click pasted the X11 primary selection,
double-click left out the trailing space, fullscreen was instant,
<select> popups ignored page styling, and scrollbar track clicks
followed GTK.
The launchers now set Firefox's Windows defaults for these
(windowsBehaviourPrefs in launcher-constants.json, shared by the
Python and TypeScript launchers) when a Windows identity runs on a
non-Windows host, where upstream did nothing. Caller-supplied values
still win. Each one was checked against 156.0.1's all.js, firefox.js
and StaticPrefList.yaml and still differs between the Windows and GTK
builds, the fullscreen transition included: GTK builds default to
"0 0" there, so it is not redundant now that camoufox.cfg no longer
sets it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
||
|
|
1912e974fa |
Give Windows identities Windows' keyboard
A Linux build claiming Windows edited text the GTK way, which both the user and the page could tell: Alt+Backspace did not undo, Shift+Delete with nothing selected did nothing, Ctrl+Up in a textarea moved up a line instead of to its start, Ctrl+/ selected all, Ctrl+Backspace on a rich text selection deleted only the selection, and AltGr reported keyCode 225 where Windows reports 18. windows-keyboard.patch switches on config input:windowsKeyboard, which the launcher sets for Windows identities on a non-Windows host, where upstream did nothing. The shortcut tables are Windows' own, built from the same definitions file with the Windows platform macros; GTK's native text bindings are skipped, including the emulated ones that synthesized (Playwright) key events get from GetEditCommandsForTests; AltGr reports Alt and HTML editors take Windows' caret style. Without the key, or with it false, behaviour is unchanged. The key is launch-wide: the shortcut tables and GTK's key handling are process-level. The patch relies on touchscreen-fingerprint-spoofing for /camoucfg in dom/events and was re-derived on 156. The windows-keyboard guard checks each behaviour for a Windows and a Linux identity, with real X11 keys where only a native event exercises the code, so the parity leg installs xdotool and setxkbmap. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
580f4aee99 |
Compute Math.sin/cos/tan/pow as the Windows CRT does
The last bit of these differs between glibc (or fdlibm) and the Windows CRT, so one call told a page that a build claiming Windows ran on Linux: against stock 152.0.4 on Windows, sin differed on 22, cos on 26 and tan on 30 of 1,670 inputs, pow on 45 of 1,410. windows-crt-math.patch adds javascript.options.use_ucrt_math, which routes them to ports of ucrtbase.dll's FMA3 code path (browser/additions/js/src/builtin/UcrtMath*.c), keeping SpiderMonkey's own pow fast paths. On 156 the pow hook sits in pow_libm_or_fdlibm, the one place both callers already reach the platform pow. It is built only for 64-bit non-Windows targets, without FP contraction. The launcher turns it on for Windows identities on a non-Windows host, where upstream did nothing; the TypeScript launcher does the same. browser/tests/ucrt-math checks the C alone against ucrtbase.dll on ~127,000 results in the static job. The windows-crt-math guard checks the browser against stock Windows Firefox cold, JIT-hot and constant folded, with a pref-off control that must differ; a missing result counts as a difference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |