12 Commits
Author SHA1 Message Date
b09085c8f0 Bundle a committed uBlock Origin release, not AMO's newest (#1012)
* Bundle a committed uBlock Origin release, not AMO's newest

uBO 1.76.0 reached AMO and changed what pages observe: in every tab
after the first, RegExp moved after URL in the page's global order,
where stock 158 and 159 (every tab and window), no uBO and uBO 1.75.4
keep it after Number. main-world-eval-globals.py caught it, and
534430e0 then took the first tab out of the comparison, which hides
the difference instead of removing it.

fetch-ubo.py resolve now reads browser/scripts/data/ubo.json (1.75.4,
sha256-pinned); `newest` prints AMO's latest as a candidate, so a bump
is a reviewed commit. main-world-eval-globals.py compares the first
tab again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Describe the bundled uBlock Origin as the committed pin everywhere

README.md, ci/README.md, release.yml, package.py and ci/release.py still
said every package bundles AMO's newest uBO, and release.py that the pin is
in no commit. It is now browser/scripts/data/ubo.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jake Writer <jake_writer@jobharvest.com>
2026-11-11 02:33:45 +00:00
Jake WriterandClaude Opus 5.5 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>
2026-11-07 17:51:40 +00:00
AntonandClaude Opus 5.5 e48193ad72 Upgrade to v159 (#986)
* Pin v159.0

Camoufox beta.35 is built on Firefox 159.0 (was 158.0.1), with the PGO profiles Mozilla trained for that release. Linux arm64 is still built with the x86_64 Linux profile in 159's taskcluster/kinds/build.

* Port the Playwright bootstrap patch to Firefox 159

Firefox 159 gives each BrowsingContext field its CanSet policy inside the FIELD macro and removes the per-field CanSet() overloads. PrefersContrastOverride's old CanSet() returned IsTop(), which is {.mTopOnly = true, .mCanSet = CanSet::Unrestricted}, the policy 159 gives its sibling ForcedColorsOverride. The hunk that only shortened two mozilla::dom:: qualifiers is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the SessionStore popup-close guard to Firefox 159

Firefox 159 keys SessionStore's windows by a private #windowIds WeakMap instead of the aWindow.__SSi expando. maybeDontRestoreTabs looks the window up the same way onClose now does, and still returns early for a window SessionStore never registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Refresh two patches' context for Firefox 159

Both applied with fuzz 2. font-hijacker.patch's DWrite hunk sits where 159 moved the factory into the bundled-fonts branch, and wheel-native-ticks.patch's hunk now sits before 159's new mIsSynthesizedForTests line in SendWheelEvent. Only context lines change. The wheel flag matches what jugglerSendMouseEvent already sets for mouse input (isDOMEventSynthesized), and camoufox.cfg zeroes the user-input delay it would bypass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop remote-security-settings.patch; Firefox 159 ships the OneCRL import

Bug 2084311's startup import of the bundled OneCRL list is in Firefox 159's RemoteSecuritySettings.sys.mjs, so the backport's hunk reads as already applied. The certificate-revocations guard passes on 159 without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Record stock Firefox 159.0's content-accessible chrome files

Regenerated with gen-contentaccessible-manifest.py from the stock 159.0 Linux x86_64 release (build 20261022150525). Regenerating from stock 158.0.1 reproduces the previous manifest byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Import jsdebugger from its Firefox 159 location in Juggler

Firefox 159 moved jsdebugger.sys.mjs to moz-src:///devtools/platform/. The old resource://gre/modules/ URL no longer resolves, Runtime.js throws on load in every content process, and Playwright's launch never completes. Every other module Juggler imports still exists in 159's omni.ja.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Grant the Marionette guards system access the way Firefox 159 requires

Firefox 159 removed --remote-allow-system-access; RemoteAgent reads MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1 instead, and Marionette:SetContext refuses the chrome context without it. helpers.marionette_env() supplies it to every guard that drives Marionette.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Expose EXT_texture_norm16 on macOS and Linux WebGL2, as Firefox 159 does

Bug 1735401 took EXT_texture_norm16 out from behind webgl.enable-draft-extensions. It is exposed on WebGL2 wherever the GL has 16-bit normalized textures, core in desktop GL 3.1: every macOS (CGL GL 4.1) and x86_64 Linux WebGL2 context. Measured on stock 159.0 on M1 and on Linux llvmpipe; 158.0.1 and 146.0 do not list it. stock-gpu-parity failed on macOS on exactly this extension and passes with the change. Windows is unchanged: ANGLE decides per device from its D3D11 format support, which no recording carries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Run make clean's revert from browser/, not the source tree

The cd into the source tree persisted into the next command, so $(MAKE) revert ran inside the Firefox tree, found no such target, and left the patched tree in place. The step-by-step patch upgrade workflow starts with make clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Expose EXT_clip_control and EXT_texture_mirror_clamp_to_edge where Firefox 159 does

Both extensions are new in Firefox 159 and reach WebGL1 and WebGL2 wherever the GL backend has them. Stock 159.0 on Linux llvmpipe (x86_64 and aarch64) lists both where 158.0.1 lists neither, and stock 159.0 on Apple M1 lists neither: CGL's GL 4.1 lacks clip control (GL 4.5) and mirror clamp (GL 4.4). ANGLE's D3D11 backend sets textureMirrorClampToEdgeEXT on every device and clipControlEXT from feature level 10_0, the level WebGL2 needs, so Windows follows the rule EXT_polygon_offset_clamp already uses. Linux keys on the desktop GL mark (EXT_depth_clamp) as that rule does. stock-gpu-parity failed on Linux on exactly these two extensions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:22:13 -08:00
6e9a1de13b Build with cross-language LTO and PGO, as stock Firefox does (#886)
* Build with cross-language LTO and PGO, as stock Firefox does

Without them Gecko's C++ ran 1.3-1.8x stock while JIT-compiled script
did not, and a page can time that ratio (JSON.parse over a regexp
replace read ~3.3 here, ~2.2 in stock). Stock's recipe is two stages:
an instrumented build trains on Mozilla's own pages, then the release
links with --enable-lto=cross and --enable-profile-use=cross.

The "PGO profile" workflow is stage one: it publishes the merged
profile as a release asset, pinned by sha256 in
browser/assets/optimized-build.json. ci/pgo.py exports the switches
base.mozconfig reads; a local build without them is unchanged. The CI
build job pins Rust, checks the pairing, and builds LTO-only with a
warning while no profile is pinned for the tree's Firefox. None is
pinned for 156.0.1 yet.

Rust is pinned to 1.95.0. Cross-language LTO hands Rust bitcode to lld,
so rustc's LLVM may not be newer than the bootstrapped clang's. Firefox
156 bootstraps clang 22 (linux64-clang in toolchain/clang.yml) and
Mozilla builds it with Rust 1.95.0 (linux64-rust in toolchain/rust.yml),
whose LLVM is 22. 1.90.0, the pin for 152, is still 156's minimum but
no longer what stock compiles with.

ccache is restored and saved in separate steps, so a build that fails
late keeps what it compiled, under opt- keys that include the profile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Link every build with cross-language ThinLTO, from the one mozconfig

LTO had entered only the tests.yml build, through an environment
variable, so a release would have been tested on an LTO Linux binary and
shipped Linux, Windows and macOS binaries built without it. base.mozconfig
now has --enable-lto=cross and --enable-rust-simd unconditionally, and
every build copies it: the tests.yml build, multibuild.py and the
release matrix.

Firefox 158's lto-pgo.configure makes --enable-lto=cross full LTO only
when PGO and MOZ_AUTOMATION are on and the target is x86_64 Linux or
Windows, so without a profile it is ThinLTO across C++ and Rust on every
target. That is what stock links outside those two, and PGO is the
remaining difference. ./mach configure on 158 with the generated mozconfig
gives MOZ_LTO_RUST_CROSS=thin, -Clinker-plugin-lto and an lld linker for
linux x86_64/arm64, windows x86_64/i686 (clang-cl, lld-link) and macOS
x86_64/arm64.

lld cannot read Rust bitcode from an LLVM newer than its own, and the
runner's stable Rust can be. scripts/patch.py now installs the Rust release
taskcluster/kinds/toolchain/rust.yml aliases as linux64-rust (1.95.0,
LLVM 22, for 158's clang 22) and writes RUSTUP_TOOLCHAIN into the
mozconfig, so the pin follows each Firefox bump by itself. The build jobs
no longer install a system LLVM 18 from apt.llvm.org: mach bootstrap
already fetches the clang and lld the tree builds with.

The PGO training workflow, ci/pgo.py, the profile pin and the separate
ccache keys are removed; PGO needs a profile to pin first. The commented
out mozconfig lines go too, and linux.mozconfig, which held only one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Document the LTO build: what it costs and where its Rust comes from

AGENTS.md and README.md said an incremental build takes about five
minutes; with LTO every build, incremental ones included, relinks
libxul across C++ and Rust, and ccache cannot cache that link. ci/README.md
lists it under cost control. On CI the libxul ThinLTO link took about
nine minutes, and the cold build step 57 minutes against 54-99 for
recent cold non-LTO builds, since rustc no longer runs its own fat LTO
over gkrust.

mozilla_rust_version's docstring now says what the pairing is: Rust's
LLVM has the bootstrapped clang's major version (1.95.0 has LLVM 22.1.2,
158's clang is 22.1.8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Build with stock's PGO profile, and full LTO where stock uses it

Stock builds every desktop release with a profile Mozilla trains on that
release (taskcluster kind generate-profile), and with full cross-language LTO
on x86_64 Linux and Windows. LTO alone left the remaining difference from stock
in how Gecko's C++ is optimized, which a page can time against script.

scripts/pgo.py fetches, for each target, the profile Mozilla trained for the
stock release of the same Firefox: Taskcluster indexes the generate-profile
task by the release commit, and the task's chain of trust records the
archive's sha256. data/pgo-profiles.json pins all five (Linux arm64 uses the
x86_64 Linux profile, as stock's does). `make dir` fetches and verifies the
profile, and base.mozconfig builds with it, with full LTO on x86_64 Linux and
Windows and ThinLTO elsewhere, as stock's configure picks under MOZ_AUTOMATION.
A function a patch changes loses its profile data; configure makes that a
warning. A pin for another Firefox fails `make dir` and says to run
`scripts/pgo.py pin`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jake Writer <jake_writer@jobharvest.com>
2026-10-31 06:20:35 +00:00
Jake WriterandClaude Opus 5.5 9b98b58642 Update to Firefox 158.0.1 (#944)
* Pin Firefox 158.0.1

Camoufox beta.34 is built on Firefox 158.0.1 (was 158.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep XUL window placement for dependent windows on Linux

Firefox 158.0.1 (bug 2076558) adds browser.load-xul-position.enabled and
defaults it to false on GTK, so AppWindow::LoadPositionFromXUL returns early
for every window, including dependent ones that 158.0 placed relative to their
parent. window-position-wm-placement.patch already leaves independent windows
to the window manager. Turning the pref back on keeps the window placement
Camoufox 158.0 shipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Record stock Firefox 158.0.1's content-accessible chrome files

The contentaccessible-parity guard compares a build against the manifest of
stock Firefox's page-loadable chrome files and refuses to compare across
versions. Regenerated with gen-contentaccessible-manifest.py from the stock
158.0.1 release (build 20261019185856). Besides the version, two files changed
upstream in bug 2076834 (places/bookmarksSidebar.js and .xhtml), and
buildconfig.html changed with the release build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop the OneCRL dump from remote-security-settings.patch; Firefox 158.0.1 ships it

158.0's dump plus the removed hunks is byte-identical to 158.0.1's
security-state/onecrl.json, so on 158.0.1 the hunks read as already
applied and patching failed. The startup import of the bundled list
is not in 158.0.1 and stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:28:17 +00:00
Jake Writer 5230f5518b Merge pull request #871 from epcosta17/fix/832-system-font-aliases
Claim the macOS system font under one name, not thirty
2026-10-23 18:52:59 +00:00
Jake WriterandClaude Opus 5.5 c19aabc5e8 Measure the system-font stall locally, against a control
system-font-alias-stall loaded https://badssl.com/, counted a probe that
errored at once as a fast answer, and judged a 5 s span of 1000 ms
answers on the runner's own clock over three 30 s windows.

The page is now served from camoufox.test: badssl.com's fifteen heading
emoji and an Adlam sentinel that only a claimed Noto family covers. A
50 ms timer keeps its longest interval, and the page reports when the
sentinel's width changes, which is the end of the reflow that follows
the cmap load. The verdict is that block divided by the one a control
launch shows when it claims System Font once, so it counts the names
fallback pays for that face under, whatever the runner's speed. Every
error, a missed deadline and an absent System Font fail the guard.

On camoufox 158.0-beta.40, x86_64: every healthy base 0.9-1.6x the
control, sonoma with main's 30 names 27-30x, idle or with all 16 cores
busy; the threshold is 6x. A passing run takes about 16 s, down from 90.

The sonoma manifest's source note records the dropped names and why.
font-bases.json and font-groups.json regenerate unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:13:51 -06:00
Jake WriterandClaude Opus 5.5 8599955e0f Update to Firefox 158.0 (#914)
* Pin Firefox 157.0

Camoufox beta.33 is built on Firefox 157.0 (was 156.0.1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* e2e: expect exactly the identity's input kinds from enumerateDevices()

The probe asserted a non-empty pre-grant device list. Stock Firefox lists one
entry per input kind the machine has and no outputs, so a speaker-only identity
(about 6% of Windows draws) correctly lists nothing. Firefox 157.0's UA bump
re-seeded the Windows preset onto such a machine, and 156.0.1 returns the same
empty list for it.

Compare against the kinds the config claims instead: it still fails on an
empty list for a mic/camera identity, and it now also catches a wrong or
missing kind, a host device leaking through, or an enumerateDevices() error.

Gate-Change: Firefox 157.0's version in the UA re-seeds the Windows preset's media-device draw (pythonlib fingerprints.py from_preset -> identity_seed); verified the same empty list on 156.0.1-beta.32 and 157.0 for the no-mic/no-camera identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep independent window placement with the WM, which Firefox 157 stopped doing

Firefox 157 landed bug 2070008, which deleted the Unix special case in
AppWindow::SizeShell():

    bool positionSet = !mIgnoreXULPosition;
  #if defined(XP_UNIX) && !defined(XP_MACOSX)
    // don't override WM placement on unix for independent, top-level windows
    if (!parentWindow) positionSet = false;
  #endif

so a top-level window now takes the position persisted in the profile's XUL
store instead of leaving placement to the window manager.

That makes window.screenX/screenY a function of leftover profile state, and a
page can read it. Measured on this branch before the fix, same identity, same
Xvfb:

    throwaway profile   screenX 4   screenY 4
    persistent profile  screenX 26  screenY 0

v156.0.1-beta.32 reports 0/0 for both, so the two session types were
indistinguishable and are no longer. fingerprint-injection.patch only answers
GetScreenX/GetScreenY from the config when window.screenX is set, and the
launcher does not draw it for every identity, so the real position shows
through whenever it is absent. A position that varies with profile type
correlates a user's fresh and persistent sessions, and it moves the browser
rect MouseDispatch.js measures (docs/input-dispatch.md).

Nobody places an automation browser's window by hand, so there is no UX here
to gain and determinism to lose. Restores the guard for independent windows
only; dependent windows are still placed relative to their parent, as upstream
intended before and after. Both profile types report 0/0 again.

Caught by typescript/tests/e2e.test.ts:506 in CI, which asserts a persistent
profile presents the same device as a throwaway one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Pin Firefox 157.0.1

Camoufox beta.33 is built on Firefox 157.0.1 (was 157.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pin Firefox 158.0

Camoufox beta.33 is built on Firefox 158.0 (was 157.0.1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the Playwright bootstrap patch to Firefox 158

Firefox 158 moved the code under six hunks:

- Bug 2072511 replaced HeadlessWidget::mCompositorWidget with a generic
  CompositorWidgetDelegate so the compositor can live in the GPU process.
  The screencast snapshot listener now reaches the in-process
  HeadlessCompositorWidget through AsHeadlessCompositorWidget().
- Bug 2071024 added movementX/movementY to SynthesizeMouseEventData and
  changed the mMovement coalescing check; jugglerEventId and the drag
  event synthesis sit beside the new code.
- Bug 1688932 took bit 25 of nsIWebBrowserChrome's chrome flags for
  CHROME_MEDIA_PIP. JUGGLER_WINDOW_EXPLICIT_SIZE keeps bit 26, the last
  free one.
- Bug 2070965 made UserAgentOverride an nsCString, which moved the
  context of the BrowsingContext field-namespace hunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Refresh camoufox-window-module.patch context for Firefox 158

Bug 2070772 removed PartnerLinkAttribution.sys.mjs from browser/modules,
so the module list hunk applied only with fuzz. The change is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port config.patch to Firefox 158's top-level moz.build

Bug 2070828 appended the SBOM GeneratedFile block to the end of the
top-level moz.build, where config.patch adds the lw directory. The lw
directory is still appended last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the worker userAgent override to Firefox 158's nsCString

Bug 2070965 made WorkerNavigator::GetUserAgent take an nsCString, so the
navigator.userAgent override assigns the UTF-8 config value directly
instead of converting it to UTF-16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port font-hijacker.patch to Firefox 158's gfx/thebes/moz.build

Bug 2070824 appended license declarations to gfx/thebes/moz.build after
the line the camoucfg include followed. The include is still appended
at the end of the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the network geolocation override to Firefox 158

Bug 2060572 moved the request's logging into the try block and made it
throw first when geo.provider.network.url is unset. The CAMOU_CONFIG
coordinates are now chosen before that check, so a configured location
is reported without depending on the provider URL, as on Firefox 156.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the per-context userAgent to Firefox 158's nsACString getters

Bug 2070965 made Navigator::GetUserAgent and WorkerNavigator::GetUserAgent
return UTF-8 and collapsed the window's custom user agent lookup. The
per-context value is still checked first in both getters and is
converted from the UTF-16 it is stored as.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Refresh screen-spoofing.patch context for Firefox 158

nsRFPService::GetSpoofedStorageLimit, next to the declaration the patch
changes, now returns int64_t, so the hunk applied only with fuzz. The
change is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Refresh sessionstore-popup-close-crash.patch context for Firefox 158

Firefox 158 documented SessionStore.maybeDontRestoreTabs with a JSDoc
block, so the guard applied only with fuzz. The guard is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port webrtc-ip-spoofing.patch's include to Firefox 158

Bug 2072208 removed NS_PRINTING and the nsIPrintSettings.h include that
followed xpcpublic.h in nsGlobalWindowInner.cpp. WebRTCIPManager.h is
still included after xpcpublic.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Qualify webgl-spoofing's dom names in ClientWebGLContext.cpp

ClientWebGLContext.cpp declares no 'using namespace mozilla::dom'. It
compiled on Firefox 157 only because CanvasImageCache.cpp, earlier in the
same unified dom/canvas chunk, did. Bug 2048943 removed that directive
ahead of renaming nsRange to dom::Range, so the patch now names
RoverfoxStorageManager, WorkerPrivate and WebGLParamsManager with their
dom:: namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Record Firefox 158.0's content-accessible files and chrome names

The contentaccessible-parity guard compares a build against what stock
Firefox of the same version exposes to pages, and refuses a manifest
recorded from another release. Regenerated with
scripts/gen-contentaccessible-manifest.py from the official 158.0 Linux
x86_64 build (BuildID 20261007201254). Among the changes, Firefox 158 no
longer registers the extra-themes-previews resource host (bug 1990883
removed colorways).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Claim EXT_polygon_offset_clamp where Firefox 158 exposes it

Bug 1854003 added EXT_polygon_offset_clamp to WebGL1 and WebGL2 wherever
the GL backend clamps polygon offsets (GLFeature::polygon_offset_clamp:
GL 4.6, ARB_ or EXT_polygon_offset_clamp). fpgen's records come from
Firefox 146, so no identity claimed it, and stock-gpu-parity found stock
158.0 exposing it on this Linux host where Camoufox did not.

- Windows: ANGLE's D3D11 backend sets polygonOffsetClampEXT from feature
  level 10_0 (renderer11_utils.cpp), which WebGL2 needs, so devices with
  WebGL2 claim it.
- Linux: Mesa (radeonsi, llvmpipe on this host, in GL and GLES contexts)
  and NVIDIA's GL 4.6 driver expose it. Recordings from a desktop GL
  profile, marked by EXT_depth_clamp (96.6% of Linux records), claim it;
  the GLES-only records keep what the device reported.
- macOS: release builds keep webgl.disable-angle and run WebGL on CGL's
  GL 4.1, which lacks it. Metal ANGLE is Nightly-only (bug 2072535).

Both launchers place it in Firefox's alphabetical extension order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Expect EXT_polygon_offset_clamp from the backends Firefox 158 adds it on

The converter and draft-extension tests hard-coded Firefox 156's backend
extensions. The GTX 980 Linux fixture's expected lists now include
EXT_polygon_offset_clamp in Firefox's order, and the Windows device with
WebGL2 expects it beside EXT_depth_clamp; every other assertion is
unchanged. A new test derives the expectation for 100 draws per OS from
each draw itself: Windows devices with WebGL2, Linux desktop GL
recordings, never macOS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gate-Change: Firefox 158 (bug 1854003) exposes EXT_polygon_offset_clamp where GLFeature::polygon_offset_clamp holds, and ANGLE D3D11 sets it from feature level 10_0; verified in the 158.0 source (dom/canvas/WebGLExtensions.cpp, gfx/gl/GLContextFeatures.cpp, third_party/angle renderer11_utils.cpp) and by stock-gpu-parity against stock 158.0 on this host

* Follow Firefox 158's WebSocket frame callbacks in Juggler

Bug 1719394 added the HTTP channel ID to
nsIWebSocketEventListener.frameReceived and frameSent, ahead of the
frame. Juggler's listener still took (serialID, frame), so it read the
channel ID as the frame, found no opCode and dropped every frame:
Playwright's framereceived and framesent events never fired
(test_websocket.py::test_should_emit_frame_events and
test_should_reject_wait_for_event_on_close_and_error failed on 158 and
pass on 156.0.1). The listener now takes the new argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Key Juggler's pending promises by their Debugger.Object

Bug 2044184 removed Debugger.Object.promiseID in Firefox 158. Juggler
keyed the promises it awaits by it, so every pending promise shared the
key undefined: a second awaited evaluate overwrote the first, which then
never resolved. Playwright waits that poll in the page (waitForElementState,
selectText waiting for visibility) hung whenever another evaluate
returning a promise ran meanwhile. The Debugger.Object is unique per
promise within the debugger and serves as the key instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the environment out of forked children's command lines

Firefox's setproctitle() marks the end of the old argv space so the
kernel shows only the new title, then copies the environment strings
right after the title, inside that space. When an environment string's
null lands on the marker, the kernel shows the whole space: the title
followed by the environment. Whether it does depends only on the length
of the install path and of the environment, so it is rare in stock
Firefox. The Firefox 158 package at the parity harness's path hit it on
the RDD process, whose /proc/PID/cmdline then ended in the launching
shell's environment instead of 'rdd'. The marker is set again after the
copy; it lies outside /proc/PID/environ, which is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:08:56 +00:00
Ernesto c27396c385 Claim the macOS system font under one name, not thirty
The sonoma base claimed `System Font` plus 29 translations of it, and
fontconfig resolves every one of them to the same file. Font fallback walks the
claimed family list once per codepoint the page's own fonts do not cover, so an
emoji-heavy page loaded and scanned that single face thirty times per miss: the
content process spent about 12 s of a 30 s window inside one reflow, answering
nothing.

A real macOS resolves none of the 29. CTFontCreateWithName returns Helvetica
for them, exactly as it does for a name that cannot exist, so a page measuring
text in `Police système` saw it absent on a real Mac and present on a sonoma
identity. Claiming them was a tell of its own, and the freeze is measurable
from script. `tahoe26` and `macos27` already claim one name each.

font-bases.json is the regenerated projection of the manifest
(browser/scripts/gen-font-groups.py), not a hand edit; font-groups.json, which
that script also writes, comes out unchanged.

Closes #832
2026-10-16 18:59:30 -06:00
Jake WriterandClaude Opus 5.5 e3f9a20e55 Hide Juggler from pages, and show them an official Firefox build (#847)
hCaptcha's hsw.js runs new Worker("chrome://juggler/content/content/WorkerMain.js").
Content processes receive every registered chrome package, and the Worker
constructor returns for a registered name but throws a SecurityError for an
absent one, so any build that registered a `juggler` package got a puzzle and
had its solved tokens rejected, with or without Playwright attached.

Juggler is no longer a chrome package. Its files are installed with
FINAL_TARGET_FILES under modules/juggler/ and loaded from
resource://gre/modules/juggler/. resource://gre exists in every Firefox, and
inside it a page cannot tell which files exist. ci/browser_inputs.py reads the
resource mapping from that moz.build instead of jar.mn.

Camoufox also builds with MOZILLA_OFFICIAL, which drops
browser-development-helpers.js from a content-accessible package as stock
does, and serves Firefox's official logos from chrome://branding/content/.
Telemetry reporting stays off, and dump() is re-enabled because Playwright
waits for Juggler's readiness line.

contentaccessible-parity.py now compares every content-reachable file's
SHA-256 with stock, compares the registered chrome packages and resource hosts,
and runs hCaptcha's Worker probe. It fails on the previous build and passes on
this one. viewport-no-rdm.py fails with one line, instead of a traceback, on a
Playwright older than 1.61, whose driver rejects is_mobile for Firefox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:41:40 -06:00
Jake WriterandClaude Opus 5.5 6c3850f60a Remove dead and duplicated code across the launchers, scripts and CI
Values both launchers hard-coded (marker fonts, the Windows 11 fonts, the
Apple Silicon and Intel Mac core and panel tables, plausible DPR and core
counts, the macOS MacinTalk/Eloquence voices, the cache prefs) now live in
python/src/camoufox/launcher-constants.json, which the TypeScript package
ships as a data file. gen-fonts-json.py and verify-fonts.py read the same
file, so the drifted PingFang marker copy is gone (fonts.json regenerates
byte-identical) and verify-fonts no longer ast-parses fingerprints.py.

- Drop the duplicate fpgen model pin under browser/scripts/data; the TS
  test checks the fpgen package's MODEL_PIN against the Python copy.
- Move pin-fpgen-model.py and clean-fingerprint-data.py to python/scripts.
- Delete the font licence report (font-metrics/licences.py and its saved
  output, open-fonts.txt): the bundle ships as built, so the report checks
  nothing.
- Delete unreferenced files: cleanfonts.sh, python/examples,
  typescript/renovate.json.
- Delete dead code: classify_installs, remove_mmdb, write_upstream_sh,
  bump_release, unused test constants and fixture helpers, the
  _virtual_display attribute writes, package.py's pre-groups font copy (a
  missing groups.json now fails).
- Share require_bundle, zip_entries, gh_headers and parse_shard instead of
  keeping copies; fold GitHubDownloader into CamoufoxFetcher in both
  launchers.
- TS raises ValueError where Python does, and `camoufox version` prints the
  fpgen package version as Python does.
- Python tests get src/ from pytest's pythonpath instead of sys.path
  inserts; skips that hid untested paths now assert or test the behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:38:55 -06:00
Jake Writer 658806eb23 chore: major code cleanup/refactor 2026-10-06 19:10:22 -06:00