From 5020e0b0705a1c0c25af531985be894245c5d4a8 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Mon, 2 Dec 2019 19:13:38 +0100 Subject: [PATCH] Resetting the settings had undesired side effects --- lib/settingsMigration.js | 2 +- options/options.js | 26 ++++++++++++++------------ releaseNotes.txt | 1 + 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/settingsMigration.js b/lib/settingsMigration.js index d541a40..0c6ed79 100644 --- a/lib/settingsMigration.js +++ b/lib/settingsMigration.js @@ -20,7 +20,7 @@ // eslint-disable-next-line no-unused-vars "": function(oldStorage){ return { - storageVersion: 0.5 + storageVersion: 0.6 }; }, 0.1: function(oldStorage){ diff --git a/options/options.js b/options/options.js index ec64241..13b8c43 100644 --- a/options/options.js +++ b/options/options.js @@ -141,21 +141,23 @@ alert(error); }); }, - resetSettings: function(){ - modal.confirm( - extension.getTranslation("resetSettings_confirm"), - { - node: this, - selector: ".settingRow .content" - } - ).then(function(clear){ + resetSettings: async function(){ + try { + const clear = await modal.confirm( + extension.getTranslation("resetSettings_confirm"), + { + node: this, + selector: ".settingRow .content" + } + ); if (clear){ - browser.storage.local.clear(); + await browser.storage.local.clear(); + await browser.storage.local.set({storageVersion: settings.storageVersion}); } - return; - }).catch(function(error){ + } + catch (error){ logging.warning("Unable to reset settings:", error); - }); + } } }; diff --git a/releaseNotes.txt b/releaseNotes.txt index 5e309fe..aaf3ee1 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -10,6 +10,7 @@ Version 0.5.15: - background color of the textarea in the settings export was not readable in the dark theme when the value was invalid - settings sanitation: added missing APIs - navigator.oscpu and navigator.buildID are undefined in non Gecko browsers + - resetting the settings had undesired side effects known issues: - if a data URL is blocked the page action button does not appear