Skip to content

Commit 7d90f97

Browse files
committed
Enable the blocking of CSP reports by default
Related issue: - LiCybora/NanoDefenderFirefox#196
1 parent d0a0984 commit 7d90f97

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

src/js/hnswitches.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/******************************************************************************/
2828

29-
µBlock.HnSwitches = (function() {
29+
µBlock.HnSwitches = (( ) => {
3030

3131
/******************************************************************************/
3232

src/js/start.js

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,33 +111,16 @@ const onVersionReady = function(lastVersion) {
111111
µb.redirectEngine.invalidateResourcesSelfie();
112112

113113
const lastVersionInt = vAPI.app.intFromVersion(lastVersion);
114+
if ( lastVersionInt === 0 ) { return; }
114115

115-
// https://github.com/uBlockOrigin/uBlock-issues/issues/494
116-
// Remove useless per-site switches.
117-
if ( lastVersionInt <= 1019003007 ) {
118-
µb.sessionSwitches.toggle('no-scripting', 'behind-the-scene', 0);
119-
µb.permanentSwitches.toggle('no-scripting', 'behind-the-scene', 0);
116+
// https://github.com/LiCybora/NanoDefenderFirefox/issues/196
117+
// Toggle on the blocking of CSP reports by default.
118+
if ( lastVersionInt <= 1031003011 ) {
119+
µb.sessionSwitches.toggle('no-csp-reports', '*', 1);
120+
µb.permanentSwitches.toggle('no-csp-reports', '*', 1);
120121
µb.saveHostnameSwitches();
121122
}
122123

123-
// Configure new popup panel according to classic popup panel
124-
// configuration.
125-
if ( lastVersionInt !== 0 ) {
126-
if ( lastVersionInt <= 1026003014 ) {
127-
µb.userSettings.popupPanelSections =
128-
µb.userSettings.dynamicFilteringEnabled === true ? 0b11111 : 0b01111;
129-
µb.userSettings.dynamicFilteringEnabled = undefined;
130-
µb.saveUserSettings();
131-
} else if (
132-
lastVersionInt <= 1026003016 &&
133-
(µb.userSettings.popupPanelSections & 1) !== 0
134-
) {
135-
µb.userSettings.popupPanelSections =
136-
(µb.userSettings.popupPanelSections << 1 | 1) & 0b111111;
137-
µb.saveUserSettings();
138-
}
139-
}
140-
141124
vAPI.storage.set({ version: vAPI.app.version });
142125
};
143126

@@ -240,13 +223,14 @@ const fromFetch = function(to, fetched) {
240223
const createDefaultProps = function() {
241224
const fetchableProps = {
242225
'dynamicFilteringString': [
226+
'no-csp-reports: * true',
243227
'behind-the-scene * * noop',
244228
'behind-the-scene * image noop',
245229
'behind-the-scene * 3p noop',
246230
'behind-the-scene * inline-script noop',
247231
'behind-the-scene * 1p-script noop',
248232
'behind-the-scene * 3p-script noop',
249-
'behind-the-scene * 3p-frame noop'
233+
'behind-the-scene * 3p-frame noop',
250234
].join('\n'),
251235
'urlFilteringString': '',
252236
'hostnameSwitchesString': [

0 commit comments

Comments
 (0)