mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 423154 - off-by-one error for browser.bookmarks.max_backups (r=mano)
This commit is contained in:
parent
e70fa35d2a
commit
6ab6ccb5f6
@ -1411,19 +1411,30 @@ var PlacesUtils = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNumberOfBackups > 0 && backupFileNames.length >= aNumberOfBackups) {
|
var numberOfBackupsToDelete = 0;
|
||||||
var numberOfBackupsToDelete = backupFileNames.length - aNumberOfBackups;
|
if (aNumberOfBackups > -1)
|
||||||
|
numberOfBackupsToDelete = backupFileNames.length - aNumberOfBackups;
|
||||||
|
|
||||||
|
if (numberOfBackupsToDelete > 0) {
|
||||||
|
// If we don't have today's backup, remove one more so that
|
||||||
|
// the total backups after this operation does not exceed the
|
||||||
|
// number specified in the pref.
|
||||||
|
if (!backupFile)
|
||||||
|
numberOfBackupsToDelete++;
|
||||||
|
|
||||||
backupFileNames.sort();
|
backupFileNames.sort();
|
||||||
while (numberOfBackupsToDelete--) {
|
while (numberOfBackupsToDelete--) {
|
||||||
backupFile = bookmarksBackupDir.clone();
|
let backupFile = bookmarksBackupDir.clone();
|
||||||
backupFile.append(backupFileNames[0]);
|
backupFile.append(backupFileNames[0]);
|
||||||
backupFile.remove(false);
|
backupFile.remove(false);
|
||||||
backupFileNames.shift();
|
backupFileNames.shift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backupFile)
|
// do nothing if we either have today's backup already
|
||||||
return; // already have today's backup, job done
|
// or the user has set the pref to zero.
|
||||||
|
if (backupFile || aNumberOfBackups == 0)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
backupFile = bookmarksBackupDir.clone();
|
backupFile = bookmarksBackupDir.clone();
|
||||||
|
Loading…
Reference in New Issue
Block a user