Commit Graph
16 Commits
Author SHA1 Message Date
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