Fix mv3 build

This commit is contained in:
Raymond Hill 2023-04-06 17:42:21 -04:00
parent d33633ecc9
commit f2698b097c
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 13 additions and 10 deletions

View file

@ -41,10 +41,10 @@
<script src="lib/codemirror/addon/selection/active-line.js"></script>
<script src="lib/hsluv/hsluv-0.1.0.min.js"></script>
<script src="js/codemirror/search.js"></script>
<script src="js/codemirror/search.js" type="module"></script>
<script src="js/codemirror/search-thread.js"></script>
<script src="js/fa-icons.js"></script>
<script src="js/fa-icons.js" type="module"></script>
<script src="js/vapi.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-client.js"></script>

View file

@ -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; }

View file

@ -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);