Mind restore-from-backup for no-csp-reports rule

Related commit:
- 7d90f97aa1
This commit is contained in:
Raymond Hill 2020-12-17 08:12:06 -05:00
parent 2ddf6904f0
commit a307cf5e6a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 15 additions and 2 deletions

View File

@ -926,6 +926,16 @@ const backupUserData = async function() {
const restoreUserData = async function(request) {
const userData = request.userData;
// https://github.com/LiCybora/NanoDefenderFirefox/issues/196
// Backup data could be from Chromium platform or from an older
// Firefox version.
if (
vAPI.webextFlavor.soup.has('firefox') &&
vAPI.app.intFromVersion(userData.version) <= 1031003011
) {
userData.hostnameSwitchesString += '\nno-csp-reports: * true';
}
// https://github.com/chrisaljoudi/uBlock/issues/1102
// Ensure all currently cached assets are flushed from storage AND memory.
µb.assets.rmrf();

View File

@ -114,8 +114,11 @@ const onVersionReady = function(lastVersion) {
if ( lastVersionInt === 0 ) { return; }
// https://github.com/LiCybora/NanoDefenderFirefox/issues/196
// Toggle on the blocking of CSP reports by default.
if ( lastVersionInt <= 1031003011 ) {
// Toggle on the blocking of CSP reports by default for Firefox.
if (
vAPI.webextFlavor.soup.has('firefox') &&
lastVersionInt <= 1031003011
) {
µb.sessionSwitches.toggle('no-csp-reports', '*', 1);
µb.permanentSwitches.toggle('no-csp-reports', '*', 1);
µb.saveHostnameSwitches();