1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

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/codemirror/addon/selection/active-line.js"></script>
<script src="lib/hsluv/hsluv-0.1.0.min.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/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.js"></script>
<script src="js/vapi-common.js"></script> <script src="js/vapi-common.js"></script>
<script src="js/vapi-client.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.addFlags(AST_FLAG_HAS_ERROR);
this.astError = AST_ERROR_PATTERN; this.astError = AST_ERROR_PATTERN;
this.addNodeFlags(next, NODE_FLAG_ERROR); this.addNodeFlags(next, NODE_FLAG_ERROR);
} else if ( normal === '' || pattern === '*' ) { } else if ( normal === '*' ) {
this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_ANY; this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_ANY;
} else if ( this.reHostnameAscii.test(normal) ) { } else if ( this.reHostnameAscii.test(normal) ) {
this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_HOSTNAME; this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_HOSTNAME;
@ -1680,6 +1680,7 @@ export class AstFilterParser {
} }
parsePatternParts(parent, pattern) { parsePatternParts(parent, pattern) {
if ( pattern.length === 0 ) { return 0; }
const parentBeg = this.nodes[parent+NODE_BEG_INDEX]; const parentBeg = this.nodes[parent+NODE_BEG_INDEX];
const matches = pattern.matchAll(this.rePatternAllSpecialChars); const matches = pattern.matchAll(this.rePatternAllSpecialChars);
const head = this.allocHeadNode(); const head = this.allocHeadNode();
@ -1723,11 +1724,12 @@ export class AstFilterParser {
// Encode Unicode characters beyond the hostname part. // Encode Unicode characters beyond the hostname part.
// Prepend with '*' character to prevent the browser API from refusing to // Prepend with '*' character to prevent the browser API from refusing to
// punycode -- this occurs when the extracted label starts with a dash. // punycode -- this occurs when the extracted label starts with a dash.
needPatternNormalization() { needPatternNormalization(pattern) {
return this.hasUppercase || this.hasUnicode; return pattern.length === 0 || this.hasUppercase || this.hasUnicode;
} }
normalizePattern(pattern) { normalizePattern(pattern) {
if ( pattern.length === 0 ) { return '*'; }
if ( this.reHasInvalidChar.test(pattern) ) { return; } if ( this.reHasInvalidChar.test(pattern) ) { return; }
let normal = pattern.toLowerCase(); let normal = pattern.toLowerCase();
if ( this.hasUnicode === false ) { return normal; } if ( this.hasUnicode === false ) { return normal; }

View File

@ -3814,12 +3814,13 @@ class FilterCompiler {
// block filter. // block filter.
if ( this.modifyType === MODIFIER_TYPE_REDIRECT ) { if ( this.modifyType === MODIFIER_TYPE_REDIRECT ) {
this.modifyType = MODIFIER_TYPE_REDIRECTRULE; 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 // 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); this.compileToFilter(writer);