mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:29:59 +02:00
Fix issue with corrupted themes data file
This commit is contained in:
parent
3dc7738737
commit
83a612c6e5
1 changed files with 16 additions and 1 deletions
|
@ -31,7 +31,22 @@ var ZenThemesCommon = {
|
|||
await IOUtils.writeJSON(this.themesDataFile, {});
|
||||
}
|
||||
|
||||
this.themes = await IOUtils.readJSON(this.themesDataFile);
|
||||
try {
|
||||
this.themes = await IOUtils.readJSON(this.themesDataFile);
|
||||
} catch (e) {
|
||||
// If we have a corrupted file, reset it
|
||||
await IOUtils.writeJSON(this.themesDataFile, {});
|
||||
this.themes = {};
|
||||
gNotificationBox.appendNotification(
|
||||
"zen-themes-corrupted",
|
||||
{
|
||||
label: { "l10n-id": "zen-themes-corrupted" },
|
||||
image: "chrome://browser/skin/notification-icons/persistent-storage-blocked.svg",
|
||||
priority: gNotificationBox.PRIORITY_INFO_MEDIUM,
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
return this.themes;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue