27 Commits
Author SHA1 Message Date
Jake WriterandClaude Fable 5.2 340cf16170 CI: build pull requests with the release's command, and preflight its other targets (#1055)
Four prerelease cuts failed on commits whose tests had passed (runs
41280578561, 43352392915, 43395652803, 43631788944), each in a step only
release.yml ran: midl.exe under Wine (twice), verify-fonts.py, and
make set-target. tests.yml built with `make build`; release.yml built with
multibuild.py after installing its own packages. A step only a release runs
is run for the first time by a release.

- make set-target (scripts/patch.py --mozconfig-only) writes the mozconfig
  and nothing else. It used to reset the tree and copy the additions over
  it, which in a tree without a git repository undid any patch hunk to an
  addition while leaving _READY in place, so the build went on with the
  reverted files. The mozconfig it writes is byte for byte the same.
- ci.run_build runs multibuild.py for one target. tests.yml's build job runs
  it for linux x86_64 and release.yml's for every target, so the pull
  request retargets, builds and packages exactly as a release does.
- multibuild.py --preflight (make preflight, scripts/preflight.py) checks a
  target without building it: configure, the pre-export, export and
  pre-compile tiers, then the object of every source file a patch or an
  addition touches. tests.yml preflights the five targets only a release
  builds, beside the build; the gate requires them. A target that passed is
  not run again for the same compiled inputs, except by the scheduled run.
- .github/actions/build-host frees the disk, installs the packages and adds
  the swap for all three jobs, so no build depends on a package only one of
  them installs.
- browser/multibuild.py is a browser input: changing it rebuilds.

The preflight does not link or package, so a link error on a cross-compiled
target is still first seen by a release.

Tests: ci/tests/test_set_target.py fails on main ('as added' != 'as patched');
test_preflight.py covers the source-to-object mapping and that an object left
by an earlier run is compiled again; test_ci.py holds the preflight matrix to
release.yml's and all three jobs to build-host; the tribal rule
one-build-entry-point holds all three to ci.run_build.

Run locally on Firefox 159 with CI's tree (make setup-minimal, make dir):
- All five preflights pass, in 2 to 6.5 minutes each on 16 cores.
- With the four additions as run 43631788944's tree had them, the linux
  arm64 preflight fails with that run's error,
  SkBitmapProcState_opts.cpp:41:13: use of undeclared identifier
  'sk_cpu_emulates_x86'.
- python3 -m ci.run_build --target linux --arch arm64, the release's
  command for a target that run never linked, builds and packages
  camoufox-159.0-beta.35-lin.arm64.zip in 41 minutes.
No workflow here has run on a GitHub runner yet; this pull request's run is
the first.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 06:54:41 +00:00
Jake WriterandClaude Opus 5.5 df9ca1156a verify-fonts: check aliases per OS version, and run it on pull requests (#1036)
#997 made an alias name (a macOS TTC weight such as "Noto Sans Canadian
Aboriginal Regular") part of an OS version's base only where that version
has the alias's target, and took it off the always-reported list. The
verifier still required every live alias on that list, so the release
failed before building on macOS's Canadian Aboriginal alias, which only
Sonoma reports, with its target.

The check now asks what the launcher reports: every OS version that
reports an alias's target (its base plus the essentials) must report the
alias, and no optional font group may add a target on its own.

verify-fonts.py ran only in the release, so the pull request that broke it
merged green. build-tester now runs it with --quick on the fonts its
browser artifact carries.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 08:16:24 +00:00
Jake WriterandClaude Opus 5.5 9c473387e4 cpu-vendor-estimates: compute as Intel or AMD x86-64 on an ARM64 host (#1034)
* cpu-vendor-estimates: compute as Intel or AMD x86-64 on an ARM64 host

general.cpu_identity 1 or 2 on an aarch64 build now gives what Firefox's
x86-64 build gives on that vendor's AVX2 and FMA CPU, the reverse of the
ARM64 emulation on x86-64:

- Skia, Web Audio, the speex resampler and libopus compile their x86 paths
  for aarch64 against third_party/simde/x86emu, SIMDe's intrinsics with
  x86's default NaN, NaN operand order and out-of-range conversions. Skia
  and libopus keep the recorded vendor estimate tables.
- ffvpx's FFT runs its x86-64 AVX2/FMA3 assembly translated to C by
  browser/scripts/x86toc.py.
- The JIT, the interpreter, constant folding and Math make x86's negative
  default NaN, and wasm relaxed SIMD gives the x64 backend's lanes
  (JS::SetEmulateX86).

The cpu-vendor-estimates guard now runs on an ARM64 host too, checking the
Intel and AMD launches against stock x86-64. On an Apple M4 (Linux
container) both match in all 46 probe keys that split the architectures,
plus canvas and Opus; on a Ryzen 9850X3D the ARM64 leg still matches.

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

* Regenerate the Math.cpp hunks in patch-apply order

cpu-vendor-estimates.patch applies before windows-crt-math.patch, but its
Math.cpp hunks were written against a tree that already had the CRT patch,
so three hunks were rejected on a clean `make dir`. Each patch's Math.cpp
section is now the diff from the tree its predecessors leave; the resulting
file is unchanged.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 23:47:31 +00:00
Jake WriterandClaude Opus 5.5 21fdf1c59c Canvas and Opus follow a claimed CPU vendor (Intel/AMD); vendor joins the fingerprint (#1024)
* Canvas: reproduce Intel's or AMD's RCPPS/RSQRTPS, chosen per identity

Skia's raster pipeline uses x86's estimate instructions for the
non-separable and dodge/burn blend modes, perspective and matrix
inversion. Intel and AMD implement them with different tables (the same
across each vendor's generations and OSes), so canvas readback shows the
host's CPU vendor.

- cpu-vendor-estimates.patch: pref gfx.skia.cpu_vendor_estimates
  (0 host, 1 Intel, 2 AMD). When it names the other vendor, rcp_approx
  and rsqrt_approx in the HSW and SSE paths compute that vendor's bits
  from a recorded table (SkCpuEstimates.h, SkCpuEstimateTables.h).
- browser/tests/cpu-estimates: records each vendor's table and checks the
  emulation against the native instruction over all 2^32 inputs, and
  against the other vendor's recorded hashes.
- Launcher (Python and TypeScript): cpu_vendor option and cpu:vendor key.
  The identity derives it from the GPU where only one vendor carries that
  GPU, and otherwise draws it at Firefox's x86 share (81.4% Intel). A
  coherence rule warns when the two disagree. Apple Silicon gets none.
- Guard cpu-vendor-estimates: stock Firefox 159 hashes from an Intel and
  an AMD CPU; the build matches each when told to.

Audio is not affected: its render splits x86-64 from ARM64, not Intel
from AMD.

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

* Opus: encode with the claimed CPU vendor's RCPPS/RSQRTPS; add the CPU probe

libopus's PVQ search (celt/x86/vq_sse2.c) uses the same two estimate
instructions as Skia, so a WebCodecs, MediaRecorder or WebRTC Opus stream
showed the host's vendor: stock Firefox 159 gives one byte stream on Intel
and another on AMD. libopus lives in libgkcodecs, which cannot read prefs,
so Gecko hands it the table gfx.skia.cpu_vendor_estimates selects
(opus_mozilla_set_cpu_estimates) before each encoder is created, and the
SSE2 search computes the estimates from it lane by lane.

The guard now also encodes one second of Opus and checks it against both
vendors' stock streams, on a secure page since WebCodecs needs one. It
passes on an AMD host for both vendors.

browser/tests/cpu-probe/ is the probe that found it: Math, DOMMatrix,
layout, canvas, WebGL, relaxed SIMD, Web Audio and WebCodecs, with stock
Firefox 159 results from Intel and AMD on Linux and Windows and from an
Apple M4 on macOS and Linux. Intel and AMD differ only in the six
estimate-based composite operations and Opus; ARM64 differs in much more,
which docs/HOST-PARITY.md now lists as not emulated.

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

* cpu:vendor: a core count only Intel ships implies Intel

No AMD x86 CPU since 2015 reports 10, 14, 18, 22 or 28 logical cores:
AMD runs one or two threads per core, and its one-thread parts have 2 to 8
cores. Intel's hybrids report all of them (Core Ultra 5 225, 245K, 125H,
155H; i7-14700K). So an identity with such a hardwareConcurrency is drawn
Intel, and a cpu_vendor='amd' beside it is reported and repaired.

The GPU still decides first: a Radeon APU beside an Intel-only count keeps
AMD and is reported, since no vendor matches both. The rule is renamed
cpu-vendor-matches-hardware. The counts live in launcher-constants.json
(intelOnlyCoreCounts) for both launchers.

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

* cpu {arch, manufacturer}: ARM64 emulation on x86 alongside Intel/AMD

The fingerprint's CPU is now { arch: "x86" | "arm", manufacturer } instead
of a bare vendor, validated per OS (launcher-constants cpuManufacturers):
e.g. Apple + x86 or AMD on macOS is rejected, as is a GPU that never sits
beside the claimed CPU. general.cpu_identity = 3 makes an x86 build compute
what Firefox's aarch64 build computes:

- Skia: the NEON raster pipeline and blend kernels, emulated lane for lane
  (SkOpts_neonemu, SkNeonEmu.h, SkArmEstimates.h).
- Opus: the aarch64 CELT kernels and the NEON inverse MDCT (celt_neonemu.c,
  celt_tx_neonemu.c, translated from celt_tx_neon.S by scripts/a64toc.py),
  for decode and encode.
- WebAudio / wasm / NaN payloads follow the ARM rules.
- libvpx: Firefox configures libvpx realtime-only for linux/arm64 and
  win/aarch64 (not mac/arm64), which changes WebCodecs VP9 output and
  rejects quality-mode VP8. The ARM64 configs are now the full encoder and
  realtime-only is a runtime switch (media.libvpx.realtime_only), so either
  build can produce either result. libvpx NEON itself is bit-exact with x86.

The launchers (Python and TypeScript) set general.cpu_identity and, for an
ARM Windows/Linux identity, media.libvpx.realtime_only.

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

* ARM64 identity: make the guard's probe reproducible, fail loudly in ffvpx

The guard served only the probe's own files, so the two webfonts 404ed and
the layout step threw. The probe page draws every input from one seeded
stream, so the throw shifted every later key and made wasm relaxed SIMD and
the convolver look wrong. The fonts now ship beside the probe (both freely
licensed, from Firefox's layout reftests), and the guard fails on any probe
step that errors where stock does not.

Canvas text is rasterized at the identity's devicePixelRatio, which the
launcher draws, so the guard leaves it out; at a ratio of 1 it matches the
M4's.

FFVPXRuntimeLinker asserts that libmozavutil exports the ARM64 switch
instead of skipping it silently. cpu:vendor is kept in properties.json as
removed, and the tribal rule, docs and the constants test follow the
general.cpu_identity pref.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 05:59:20 +00:00
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
b395a45caa Ship release packages every user can read (#1002)
* fetch-ubo: stage the addon readable by every user

addons/UBO was a tempfile.mkdtemp renamed into place, so it kept mode
0700 and the release zip carried it that way. Unzipped by root and run
by another user (a Docker image's app user, a shared install), the
launcher could not read the manifest, passed no addon, and the browser
ran without uBO.

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

* package: refuse a zip other users can't read

unzip restores each entry's stored mode. Besides addons/UBO, the
beta.41 zip carried 64 Windows fonts in fonts/W as 0600 (their mode in the
font bundle), so a non-owner install also lacked Book Antiqua,
Bookman Old Style, Century, Dubai, Franklin Gothic and others: a
Windows identity reported fonts it could not render.

Packaging now opens up the staged tree (group and others get read,
plus search on dirs and on owner-executable files) and fails when the
finished zip still has an entry other users can't read.

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-08 23:10:41 +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 WriterandClaude Opus 5.5 7ac4b2132c Bundle AMO's newest uBlock Origin in every browser release
The packages downloaded uBO from AMO at fetch, pinned in
python/src/camoufox/addons.json, so a new uBO, and with #946 its filter
lists, reached users only when someone bumped the pin.

browser/scripts/fetch-ubo.py now resolves AMO's newest release (its guid
and sha256 checked) and extracts it into the package as addons/UBO/
(Contents/Resources/addons/UBO/ on macOS). Both launchers load it from
beside the binary they launch, and `camoufox fetch` no longer downloads
an addon. A build without one, an older release or an unpackaged build,
launches without uBO and warns.

A cut resolves the release once, in a ubo job ahead of tests, and hands
it to tests.yml and every build through CAMOUFOX_UBO, so a uBO published
mid-run cannot ship untested. The release's manifest.json and notes name
it. tests.yml resolves one per run and stages it into the browser every
suite uses; `make stage-ubo` does the same for a local build.

addons.json and the per-version addon cache are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 16:31:23 -06:00
Jake WriterandClaude Opus 5.5 5012fb65a8 Make the hidden-font check a manual Mac script
CI has no Mac, so as a parity guard it always skipped. It now lives in
browser/scripts and checks .SFNS-Regular (from the host) and SegoeUI (from
the bundle), with and without an identity. docs/FONTS.md names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:09:00 -06:00
Jake Writer 365883614c Merge pull request #894 from coffeegrind123/pr/windows-identity
Make a Windows identity on another host behave as Windows
2026-10-23 21:13:57 +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 1464780d09 Math as Windows 11 computes it, recorded on Windows 11 and Firefox 158
Windows 11 24H2 and later (ucrtbase 10.0.26100) replaced the CRT's pow with
Arm optimized-routines' pow: a 128-entry log table and FMA in the log step,
a 256-entry exp table with the wide degree-5 polynomial. The port now follows
that source, its configuration read from ucrtbase.dll's FMA3 pow, and the
generator derives its tables from Arm's rules; they equal the DLL's word for
word. For an infinite argument sin/cos/tan return the CRT's default NaN
(fff8000000000000), and a NaN argument comes back quieted, not replaced.

expected.u64.xz and windows-crt-math.json are re-recorded on Windows 11 25H2
(build 26200.9711, i9-11900H, ucrtbase 10.0.26100.9711) with stock Firefox
158.0. inputs.py gains the trig specials (infinities, NaNs of each sign and
payload). record_firefox.py wrote a shape the guard did not read; it now
writes {results, constants} and refuses when cold and hot disagree, and
check.py checks the Firefox asset is the sample record_firefox.py draws and
agrees with the CRT reference. HOST-PARITY.md gives the provenance and says
Windows 10 and Windows 11 before 24H2 have the older pow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:23:01 -06:00
Jake WriterandClaude Opus 5.5 4b48bffd74 Generate the Windows CRT math tables from their definitions
UcrtMathPow.c and UcrtMathTrig.c carried their tables as literal
values with no account of where they came from. They are the tables of
the published algorithms the CRT uses: P. T. P. Tang's table-driven
logarithm and exponential (ACM TOMS 1990 and 1989) for pow, and Cody
and Waite's and Payne and Hanek's argument reduction with AMD LibM's
polynomial kernels for sin, cos and tan. Every table and constant is
the same as in AMD's aocl-libm-ose (src/isa/avx/gas/pow.S and
remainder_piby2_new.S), and the minimax coefficients are AMD's.

browser/scripts/gen-ucrt-math-tables.py now computes them from their
definitions (1/F, ln(2F), 2^(j/64), the bits of 2/pi, splits of ln 2
and pi/2) with the standard library, at two precisions, and writes
UcrtMathPowTables.h and UcrtMathTrigTables.h. Every value is
bit-identical to the old literals. The 2/pi table keeps the 158 bytes
that hold 2/pi's bits; the 98 bytes after them were not part of it and
are never read. check.py fails if the headers are stale, and still
matches ucrtbase.dll on all 33,386 sin, cos and tan and 27,249 pow
inputs under GCC and Clang.

The file headers now describe the algorithms and cite their sources,
carry the MPL-2.0 notice, and name the special cases by AMD's flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:23:50 -06: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 Writer 2f44062b79 Merge pull request #882 from coffeegrind123/pr/ascii-font-names
Give packaged font files ASCII names
2026-10-22 21:12:25 +00:00
Jake WriterandClaude Opus 5.5 adc7d59938 Test the ASCII font names through the packaging step
The test renamed a directory with ascii_file_names directly, so it would
still pass if add_includes_to_package stopped calling it. It now packages
a small font bundle, with 7z and the language packs stubbed out, and
checks the names that would go into the zip. A font file's extension is
always ASCII, so the name keeps it as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:35:20 -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
coffeegrind123andClaude Opus 5.5 4db36c3ae3 Give packaged font files ASCII names
The font bundle carries macOS faces named in Japanese (Hiragino). The
zip stores them correctly as UTF-8, but unzip 6.0 under a C/POSIX
locale -- a Docker build, a bare SSH shell -- calls each a mismatching
local filename and exits 1, which stops every consumer's `set -e`
install. Packaging now keeps the ASCII part of a non-ASCII file name
and replaces the rest with a digest of the original; nothing reads a
font by file name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-18 09:52:54 +03: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 12b81fdada Read the font bundle only through its group layout, and run a lost test
gen-fonts-json.py and verify-fonts.py read the groups listed in groups.json
through _font_bundle.read_groups(). Neither falls back to the per-OS layout
the group layout replaced any more: a bundle without groups.json is an error.

test_salt_of_equal_objects_is_equal had slipped inside another test's body
and never ran; it is back in TestPinnedIdentityIsStable and passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:39:01 -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 914b575e8f feat: working on cleaning up and fixing patches 2026-10-06 20:47:49 -06:00
Jake Writer 658806eb23 chore: major code cleanup/refactor 2026-10-06 19:10:22 -06:00