Bug 1701414 - Use backup file for RSS feeds.json/feeditems.json. r=mkmelin

Also adds the .tmp and .corrupt name variants to the hacky whitelist of
files-to-not-treat-as-mboxes.

Differential Revision: https://phabricator.services.mozilla.com/D113070

--HG--
extra : amend_source : 6203f370d333e89ef27ec033d4e9562277c6a330
This commit is contained in:
Ben Campbell 2021-04-22 12:54:14 +03:00
Родитель 4df54ae306
Коммит 231b442a31
3 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -319,7 +319,13 @@ function isFileToCopy(name) {
"filterlog.html",
"junklog.html",
"feeds.json",
"feeds.json.tmp",
"feeds.json.backup",
"feeds.json.corrupt",
"feeditems.json",
"feeditems.json.tmp",
"feeditems.json.backup",
"feeditems.json.corrupt",
"mailfilt.log",
"filters.js",
];

Просмотреть файл

@ -1435,7 +1435,10 @@ var FeedUtils = {
let rssServer = aServer.QueryInterface(Ci.nsIRssIncomingServer);
let feedsFile = rssServer.subscriptionsPath; // Path to feeds.json
let exists = feedsFile.exists();
let ds = new JSONFile({ path: feedsFile.path });
let ds = new JSONFile({
path: feedsFile.path,
backupTo: feedsFile.path + ".backup",
});
ds.ensureDataReady();
if (!this[aServer.serverURI]) {
this[aServer.serverURI] = {};
@ -1508,7 +1511,10 @@ var FeedUtils = {
let rssServer = aServer.QueryInterface(Ci.nsIRssIncomingServer);
let itemsFile = rssServer.feedItemsPath; // Path to feeditems.json
let exists = itemsFile.exists();
let ds = new JSONFile({ path: itemsFile.path });
let ds = new JSONFile({
path: itemsFile.path,
backupTo: itemsFile.path + ".backup",
});
ds.ensureDataReady();
if (!this[aServer.serverURI]) {
this[aServer.serverURI] = {};

Просмотреть файл

@ -48,7 +48,13 @@ bool nsMsgLocalStoreUtils::nsShouldIgnoreFile(nsAString& name, nsIFile* path) {
// ignore RSS data source files (see FeedUtils.jsm)
if (name.LowerCaseEqualsLiteral("feeds.json") ||
name.LowerCaseEqualsLiteral("feeds.json.tmp") ||
name.LowerCaseEqualsLiteral("feeds.json.backup") ||
name.LowerCaseEqualsLiteral("feeds.json.corrupt") ||
name.LowerCaseEqualsLiteral("feeditems.json") ||
name.LowerCaseEqualsLiteral("feeditems.json.tmp") ||
name.LowerCaseEqualsLiteral("feeditems.json.backup") ||
name.LowerCaseEqualsLiteral("feeditems.json.corrupt") ||
name.LowerCaseEqualsLiteral("feeds.rdf") ||
name.LowerCaseEqualsLiteral("feeditems.rdf") ||
StringBeginsWith(name, u"feeditems_error"_ns))