From 8e694a603c586d01be6ff5ca3b79285563835a62 Mon Sep 17 00:00:00 2001 From: hackademix Date: Tue, 18 Aug 2020 17:30:45 +0200 Subject: [PATCH] Added option to forget temporary settings immediately whenever NoScript gets updated. --- src/_locales/en/messages.json | 4 ++++ src/bg/Defaults.js | 1 + src/bg/LifeCycle.js | 4 ++++ src/ui/options.html | 7 +++++++ src/ui/options.js | 2 ++ 5 files changed, 18 insertions(+) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 3d42b62..bbae32c 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -228,6 +228,10 @@ "OptIncognitoPerm": { "message": "Enable setting permanent permissions in incognito/private tabs.\nBEWARE: doing this can leak site information!" }, + "OptAmnesticUpdates": { + "message": "Always forget temporary permissions across NoScript updates immediately, even if the browsers is not restarted" + }, + "KeepLocked": { "message": "Keep this element locked (recommended)" }, diff --git a/src/bg/Defaults.js b/src/bg/Defaults.js index 1d55f6b..f9fa2eb 100644 --- a/src/bg/Defaults.js +++ b/src/bg/Defaults.js @@ -8,6 +8,7 @@ var Defaults = { showCtxMenuItem: true, showCountBadge: true, showFullAddresses: false, + amnesticUpdates: false, }, sync: { global: false, diff --git a/src/bg/LifeCycle.js b/src/bg/LifeCycle.js index 37c598d..51cbddf 100644 --- a/src/bg/LifeCycle.js +++ b/src/bg/LifeCycle.js @@ -194,6 +194,10 @@ var LifeCycle = (() => { async onUpdateAvailable(details) { try { + if (ns.local.amnesticUpdates) { + // user doesn't want us to remember temporary settings across updates: bail out + return; + } await include("/lib/Ver.js"); if (Ver.is(details.version, "<", browser.runtime.getManifest().version)) { // downgrade: temporary survival might not be supported, and we don't care diff --git a/src/ui/options.html b/src/ui/options.html index bc40d3b..51bac06 100644 --- a/src/ui/options.html +++ b/src/ui/options.html @@ -124,6 +124,13 @@ +
+ + + + +
+
diff --git a/src/ui/options.js b/src/ui/options.js index 1a16e29..bc720ea 100644 --- a/src/ui/options.js +++ b/src/ui/options.js @@ -38,6 +38,8 @@ opt("overrideTorBrowserPolicy"); + opt("amnesticUpdates", "local"); + { document.querySelector("#btn-reset").addEventListener("click", async () => { if (confirm(_("reset_warning"))) {