mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Fix strict-block exceptions caused duplicate rule ids
Related issue: https://github.com/uBlockOrigin/uBOL-home/issues/304
This commit is contained in:
parent
3cd04c3806
commit
58f5c53fbb
1 changed files with 13 additions and 5 deletions
|
|
@ -49,10 +49,18 @@ let sessionRegexCount = 0;
|
|||
|
||||
const isStrictBlockRule = rule => {
|
||||
if ( rule.priority !== STRICTBLOCK_PRIORITY ) { return false; }
|
||||
if ( rule.action.type !== 'redirect' ) { return false; }
|
||||
const substitution = rule.action.redirect.regexSubstitution;
|
||||
return substitution !== undefined &&
|
||||
substitution.includes('/strictblock.');
|
||||
if ( rule.condition?.resourceTypes === undefined ) { return false; }
|
||||
if ( rule.condition.resourceTypes.length !== 1 ) { return false; }
|
||||
if ( rule.condition.resourceTypes[0] !== 'main_frame' ) { return false; }
|
||||
if ( rule.action.type === 'redirect' ) {
|
||||
const substitution = rule.action.redirect.regexSubstitution;
|
||||
return substitution !== undefined &&
|
||||
substitution.includes('/strictblock.');
|
||||
}
|
||||
if ( rule.action.type === 'allow' ) {
|
||||
return Array.isArray(rule.condition?.requestDomains);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
@ -365,7 +373,7 @@ async function updateStrictBlockRules(currentRules, addRules, removeRuleIds) {
|
|||
|
||||
const allExcluded = permanentlyExcluded.concat(temporarilyExcluded);
|
||||
if ( allExcluded.length === 0 ) { return; }
|
||||
addRules.push({
|
||||
addRules.unshift({
|
||||
action: { type: 'allow' },
|
||||
condition: {
|
||||
requestDomains: allExcluded,
|
||||
|
|
|
|||
Loading…
Reference in a new issue