diff --git a/src/js/messaging.js b/src/js/messaging.js index 1566c709d..4021fe5d4 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -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(); diff --git a/src/js/start.js b/src/js/start.js index 7ac10c0f0..79a1a441a 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -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();