Fix regression in handling mode changes

This commit is contained in:
Raymond Hill 2023-05-20 17:21:14 -04:00
parent d405460584
commit 56f67631d6
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 22 additions and 8 deletions

View File

@ -214,14 +214,28 @@ async function setFilteringModeDetails(afterDetails) {
async function getFilteringMode(hostname) { async function getFilteringMode(hostname) {
const filteringModes = await getFilteringModeDetails(); const filteringModes = await getFilteringModeDetails();
if ( filteringModes.none.has(hostname) ) { return 0; } const {
if ( isDescendantHostnameOfIter(hostname, filteringModes.none) ) { return 0; } none,
if ( filteringModes.network.has(hostname) ) { return 1; } network,
if ( isDescendantHostnameOfIter(hostname, filteringModes.network) ) { return 1; } extendedSpecific,
if ( filteringModes.extendedSpecific.has(hostname) ) { return 2; } extendedGeneric,
if ( isDescendantHostnameOfIter(hostname, filteringModes.extendedSpecific) ) { return 2; } } = filteringModes;
if ( filteringModes.extendedGeneric.has(hostname) ) { return 3; } if ( none.has(hostname) ) { return 0; }
if ( isDescendantHostnameOfIter(hostname, filteringModes.extendedGeneric) ) { return 3; } if ( none.has('all-urls') === false ) {
if ( isDescendantHostnameOfIter(hostname, none) ) { return 0; }
}
if ( network.has(hostname) ) { return 1; }
if ( network.has('all-urls') === false ) {
if ( isDescendantHostnameOfIter(hostname, network) ) { return 1; }
}
if ( extendedSpecific.has(hostname) ) { return 2; }
if ( extendedSpecific.has('all-urls') === false ) {
if ( isDescendantHostnameOfIter(hostname, extendedSpecific) ) { return 2; }
}
if ( extendedGeneric.has(hostname) ) { return 3; }
if ( extendedGeneric.has('all-urls') === false ) {
if ( isDescendantHostnameOfIter(hostname, extendedGeneric) ) { return 3; }
}
return getDefaultFilteringMode(); return getDefaultFilteringMode();
} }