[mv3] Fix toggling of "no filtering" as default mode

A bad test prevented the "no filtering" by default mode to not take
effect immediately when activated while no site had yet been set to
"no filtering". It would however take effect as soon as a specific
site would be excluded from "no filtering".
This commit is contained in:
Raymond Hill 2025-03-26 07:28:00 -04:00
parent d7ae3a185e
commit 5936451082
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -559,7 +559,8 @@ async function filteringModesToDNR(modes) {
return Promise.all(promises);
}
const isDifferentAllowRules = (a, b) => {
const isDifferentAllowRules = (a = [], b = []) => {
if ( a.length !== b.length ) { return true; }
const pp = [
'requestDomains',
'excludedRequestDomains',
@ -567,8 +568,8 @@ const isDifferentAllowRules = (a, b) => {
'excludedInitiatorDomains',
];
for ( const p of pp ) {
const ac = a?.length && a[0].condition[p] || [];
const bc = b?.length && b[0].condition[p] || [];
const ac = a.length && a[0].condition[p] || [];
const bc = b.length && b[0].condition[p] || [];
if ( ac.join() !== bc.join() ) { return true; }
}
return false;