From 59364510828e7f003657b605bf884368aab2c537 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 26 Mar 2025 07:28:00 -0400 Subject: [PATCH] [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". --- platform/mv3/extension/js/ruleset-manager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/mv3/extension/js/ruleset-manager.js b/platform/mv3/extension/js/ruleset-manager.js index 6667b6dea..eee885f13 100644 --- a/platform/mv3/extension/js/ruleset-manager.js +++ b/platform/mv3/extension/js/ruleset-manager.js @@ -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;