diff --git a/src/devtools.html b/src/devtools.html
index 6ebf75fdf..5598968e3 100644
--- a/src/devtools.html
+++ b/src/devtools.html
@@ -41,10 +41,10 @@
-
+
-
+
diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js
index 1f2cbbe69..5a06d086c 100644
--- a/src/js/static-filtering-parser.js
+++ b/src/js/static-filtering-parser.js
@@ -1648,7 +1648,7 @@ export class AstFilterParser {
this.addFlags(AST_FLAG_HAS_ERROR);
this.astError = AST_ERROR_PATTERN;
this.addNodeFlags(next, NODE_FLAG_ERROR);
- } else if ( normal === '' || pattern === '*' ) {
+ } else if ( normal === '*' ) {
this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_ANY;
} else if ( this.reHostnameAscii.test(normal) ) {
this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_HOSTNAME;
@@ -1680,6 +1680,7 @@ export class AstFilterParser {
}
parsePatternParts(parent, pattern) {
+ if ( pattern.length === 0 ) { return 0; }
const parentBeg = this.nodes[parent+NODE_BEG_INDEX];
const matches = pattern.matchAll(this.rePatternAllSpecialChars);
const head = this.allocHeadNode();
@@ -1723,11 +1724,12 @@ export class AstFilterParser {
// Encode Unicode characters beyond the hostname part.
// Prepend with '*' character to prevent the browser API from refusing to
// punycode -- this occurs when the extracted label starts with a dash.
- needPatternNormalization() {
- return this.hasUppercase || this.hasUnicode;
+ needPatternNormalization(pattern) {
+ return pattern.length === 0 || this.hasUppercase || this.hasUnicode;
}
normalizePattern(pattern) {
+ if ( pattern.length === 0 ) { return '*'; }
if ( this.reHasInvalidChar.test(pattern) ) { return; }
let normal = pattern.toLowerCase();
if ( this.hasUnicode === false ) { return normal; }
diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js
index 41abf70fb..1c1e60e1d 100644
--- a/src/js/static-net-filtering.js
+++ b/src/js/static-net-filtering.js
@@ -3814,12 +3814,13 @@ class FilterCompiler {
// block filter.
if ( this.modifyType === MODIFIER_TYPE_REDIRECT ) {
this.modifyType = MODIFIER_TYPE_REDIRECTRULE;
- const parsedBlock = this.clone();
- parsedBlock.modifyType = undefined;
- parsedBlock.optionUnitBits &= ~this.REDIRECT_BIT;
- parsedBlock.compileToFilter(writer);
// Do not generate block rule when compiling to DNR ruleset
- if ( parser.options.toDNR ) { return true; }
+ if ( parser.options.toDNR !== true ) {
+ const parsedBlock = this.clone();
+ parsedBlock.modifyType = undefined;
+ parsedBlock.optionUnitBits &= ~this.REDIRECT_BIT;
+ parsedBlock.compileToFilter(writer);
+ }
}
this.compileToFilter(writer);