fix(theseus/addons): reseed a bundled add-on only when the bundle is strictly newer

seedBundledAddons reseeded whenever the user copy's version differed from
the bundled one. promoteStagedUpdates runs just before it, so a signed
over-the-air update that had just been promoted (e.g. Aegis 0.6.14 over
the bundled 0.6.2) was backed up and replaced by the older bundle on the
same boot — every OTA add-on update silently reverted at the next launch.
Reseed now only when the bundle is newer, using the same version compare
the promoter uses.
This commit is contained in:
Local Dev 2026-09-13 19:49:23 +02:00
parent d7d127d7b4
commit a43089782a

View file

@ -1590,7 +1590,14 @@ function seedBundledAddons() {
if (!bundleVer) continue; // broken bundle — skip rather than corrupt user state if (!bundleVer) continue; // broken bundle — skip rather than corrupt user state
if (fs.existsSync(target)) { if (fs.existsSync(target)) {
const userVer = readAddonVersion(target); const userVer = readAddonVersion(target);
if (userVer === bundleVer) continue; // Only reseed when the bundle is STRICTLY NEWER than what's in
// userData. The old check `userVer === bundleVer ? continue` would
// reseed whenever the versions differed — including the OTA case
// where promoteStagedUpdates just promoted a newer addon than the
// one baked into the installer, silently downgrading it on the same
// boot. Version-compare with the same cmpVer helper the promoter
// uses so both sides agree on ordering.
if (userVer && cmpVersions(userVer, bundleVer) >= 0) continue;
// Backups go in a sibling folder so AddonHost's directory scan doesn't // Backups go in a sibling folder so AddonHost's directory scan doesn't
// pick them up as duplicate addons with the same manifest id. // pick them up as duplicate addons with the same manifest id.
const backupsRoot = addonsBackupDir(); const backupsRoot = addonsBackupDir();