Commit Graph
8 Commits
Author SHA1 Message Date
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
shbernal b9ee656980 Pin uBlock Origin to one release per package
The default addon was fetched from AMO's latest-version URL the first time
it was needed, and that copy was reused for good. So two machines on the
same Camoufox release could run different uBlock Origin builds, depending
on the day each cache was filled, and a new uBO release reached users
without passing through CI.

python/src/camoufox/addons.json now names the build: its AMO file URL,
version and sha256. Both packages read it, check each download against the
sha256 before extracting it, and cache each version in its own directory,
addons/<name>/<version>/, so a bump installs fresh instead of reusing
another release's copy. The file's note says where a bump takes its values
from.

The install gate now checks that fetch left the pinned uBO in the cache,
and no staging directories, as it already did for the GeoIP database.
2026-10-24 09:57:46 +02:00
shbernal 8d586f5b0c Fail a launch whose default addon cannot be downloaded
A failed download printed "Failed to download and extract UBO" and the
browser launched without the addon it was asked for. It now raises. A
complete copy another process installed meanwhile is used instead of
being dropped from the launch.
2026-10-24 02:20:52 +00:00
Jake WriterandClaude Opus 5.5 51e8757bf7 Keep a complete addon when this launch's download fails
When a download failed, maybe_download_addons removed the addon directory
unconditionally. If another process had finished installing the addon in the
meantime, that deleted its good copy, possibly while its browser was loading
it. The handler now removes the directory only when it has no manifest.json,
in both the Python and TypeScript launchers, each with a regression test.

One window remains: two processes that both find a stale, non-empty partial
directory can still interleave its removal and their renames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:37:14 -06:00
Jake WriterandClaude Opus 5.5 8f06d85bf5 Keep a complete addon another process installed first
The atomic extraction removed the target before renaming into it. With two
processes downloading at once, the second could delete the first's finished
addon while its browser was loading it. If the first renamed in between, the
second's rename failed on the non-empty directory, and its error handler then
deleted the good copy, so it launched without uBlock Origin.

Rename first. If the target is not empty and already holds a manifest.json,
keep it and drop the temp dir; only an incomplete target is replaced. The
TypeScript port mirrors this and gains the atomic-extraction test, and both
gain a regression test for an addon installed during extraction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:34:58 -06:00
coffeegrind123andClaude Opus 5.5 7246d98e70 Download the default addons once under concurrent launches
add_default_addons() took `with Lock():` on a multiprocessing.Lock made
fresh for each call, which guarded nothing: two launches in one process
both found no manifest.json and both downloaded and extracted uBO into
the same directory. The lock is now one threading.Lock for the module.

A launch in another process does not see that lock, and it trusts any
addon directory holding a manifest.json. Extraction now goes into a
sibling temp directory that is renamed into place last, so the manifest
never appears before the rest of the addon.

The TypeScript launcher serializes the same check-then-extract on one
promise chain and extracts the same way.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-18 09:53:19 +03: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