Two spots allocate a filesystem resource then run a download that can throw, with no cleanup on the failure path - the same shape as the install() temp-dir leak in #300, but with a worse symptom: the leftover is later treated as valid.
addons.ts - empty addon dir read as installed
maybeDownloadAddons (src/addons.ts:88-94) does fs.mkdirSync(addonPath) then downloadAndExtract, which can throw. The catch only logs, so the empty dir persists. The existsSync(addonPath) guard at the top of the loop then treats it as installed on the next run, pushes it to the addon list, and the addon silently never loads.
A fix needs care: addDefaultAddons runs on every launch(), not just camoufox fetch. Just removing the dir on failure makes a persistently-failing addon URL re-download (webdl's 5x/5s retry = ~25s stall) on every launch, and the cleanup itself must be guarded so it can't throw and break the launch.
locale.ts - truncated GeoIP DB used as valid
downloadMMDB (src/locale.ts:198-199) streams straight into the live MMDB_FILE path. A download that throws mid-stream leaves a truncated file, and getGeolocation only checks existsSync(MMDB_FILE) (locale.ts:213), so the partial DB is opened as valid. A temp-file + rename-on-success fixes it, but the temp name should be randomised - a fixed ${MMDB_FILE}.download collides if two launches sharing an INSTALL_DIR download concurrently.
Happy to send PRs for both if useful - flagging them together since they share the root cause with #300.
Two spots allocate a filesystem resource then run a download that can throw, with no cleanup on the failure path - the same shape as the
install()temp-dir leak in #300, but with a worse symptom: the leftover is later treated as valid.addons.ts - empty addon dir read as installed
maybeDownloadAddons(src/addons.ts:88-94) doesfs.mkdirSync(addonPath)thendownloadAndExtract, which can throw. The catch only logs, so the empty dir persists. TheexistsSync(addonPath)guard at the top of the loop then treats it as installed on the next run, pushes it to the addon list, and the addon silently never loads.A fix needs care:
addDefaultAddonsruns on everylaunch(), not justcamoufox fetch. Just removing the dir on failure makes a persistently-failing addon URL re-download (webdl's 5x/5s retry = ~25s stall) on every launch, and the cleanup itself must be guarded so it can't throw and break the launch.locale.ts - truncated GeoIP DB used as valid
downloadMMDB(src/locale.ts:198-199) streams straight into the liveMMDB_FILEpath. A download that throws mid-stream leaves a truncated file, andgetGeolocationonly checksexistsSync(MMDB_FILE)(locale.ts:213), so the partial DB is opened as valid. A temp-file + rename-on-success fixes it, but the temp name should be randomised - a fixed${MMDB_FILE}.downloadcollides if two launches sharing an INSTALL_DIR download concurrently.Happy to send PRs for both if useful - flagging them together since they share the root cause with #300.